Previous 15994 Revisions Next

r3958 Tuesday 23rd December, 2008 at 04:12:23 UTC by Nathan Woods
Updated to MAME 0.128u7; disabled some drivers and some Win32-specific
functionality temporarily
[docs]messnew.txt
[src/emu]clifront.c cpuexec.c cpuexec.h cpuintrf.c cpuintrf.h debugger.c debugger.h deprecat.h devintrf.c devintrf.h info.c inptport.c mame.c mconfig.c mconfig.h memory.c memory.h romload.c sndintrf.c sndintrf.h sound.c streams.c streams.h timer.c timer.h ui.c validity.c video.c video.h
[src/emu/cpu]cpu.mak drcbex64.c drcbex86.c drcfe.c vtlb.c
[src/emu/cpu/adsp2100]2100ops.c adsp2100.c adsp2100.h
[src/emu/cpu/alph8201]alph8201.c alph8201.h
[src/emu/cpu/apexc]apexc.c apexc.h
[src/emu/cpu/arm]arm.c arm.h
[src/emu/cpu/arm7]arm7.c arm7.h
[src/emu/cpu/asap]asap.c asap.h
[src/emu/cpu/ccpu]ccpu.c ccpu.h
[src/emu/cpu/cdp1802]cdp1802.c cdp1802.h
[src/emu/cpu/cop400]cop400.h cop410.c cop420.c cop440.c
[src/emu/cpu/cp1610]cp1610.c cp1610.h
[src/emu/cpu/cubeqcpu]cubeqcpu.c cubeqcpu.h
[src/emu/cpu/dsp32]dsp32.c dsp32.h
[src/emu/cpu/dsp56k]dsp56dsm.c dsp56k.c dsp56k.h dsp56ops.c dsp56pcu.c
[src/emu/cpu/e132xs]e132xs.c e132xs.h
[src/emu/cpu/f8]f8.c f8.h
[src/emu/cpu/g65816]g65816.c g65816.h g65816cm.h g65816op.h
[src/emu/cpu/h6280]h6280.c h6280.h
[src/emu/cpu/h83002]h8.h h8_16.c h8_8.c
[src/emu/cpu/hd6309]hd6309.c hd6309.h
[src/emu/cpu/i386]i386.c i386.h i386priv.h*
[src/emu/cpu/i8085]i8085.c i8085.h i8085cpu.h
[src/emu/cpu/i86]i286.c i286.h* i86.c i86.h i86priv.h*
[src/emu/cpu/i8x41]i8x41.c i8x41.h
[src/emu/cpu/i960]i960.c i960.h
[src/emu/cpu/jaguar]jaguar.c jaguar.h
[src/emu/cpu/konami]konami.c konami.h
[src/emu/cpu/lh5801]lh5801.c lh5801.h
[src/emu/cpu/lr35902]lr35902.c lr35902.h
[src/emu/cpu/m37710]m37710.c m37710.h m37710cm.h m37710op.h
[src/emu/cpu/m6502]m4510.c m4510.h m6502.c m6502.h m6509.c m6509.h m65ce02.c m65ce02.h
[src/emu/cpu/m6800]m6800.c m6800.h
[src/emu/cpu/m68000]m68000.h m68kcpu.c
[src/emu/cpu/m6805]m6805.c m6805.h
[src/emu/cpu/m6809]m6809.c m6809.h
[src/emu/cpu/mb86233]mb86233.c mb86233.h
[src/emu/cpu/mb88xx]mb88xx.c mb88xx.h
[src/emu/cpu/mc68hc11]mc68hc11.c mc68hc11.h
[src/emu/cpu/mcs48]mcs48.c mcs48.h
[src/emu/cpu/mcs51]mcs51.c mcs51.h
[src/emu/cpu/minx]minx.c minx.h
[src/emu/cpu/mips]mips3.c mips3.h mips3com.c mips3com.h mips3drc.c psx.c psx.h r3000.c r3000.h
[src/emu/cpu/nec]nec.c nec.h necpriv.h*
[src/emu/cpu/pdp1]pdp1.c pdp1.h tx0.c tx0.h
[src/emu/cpu/pic16c5x]16c5xdsm.c pic16c5x.c pic16c5x.h
[src/emu/cpu/powerpc]ppc.c ppc.h ppccom.c ppccom.h ppcdrc.c
[src/emu/cpu/rsp]rsp.c rsp.h
[src/emu/cpu/s2650]s2650.c s2650.h
[src/emu/cpu/saturn]saturn.c saturn.h
[src/emu/cpu/sc61860]sc61860.c sc61860.h
[src/emu/cpu/se3208]se3208.c se3208.h se3208dis.c
[src/emu/cpu/sh2]sh2.c sh2.h sh2comn.c sh2comn.h sh2drc.c
[src/emu/cpu/sh4]sh4.c sh4.h
[src/emu/cpu/sharc]sharc.c sharc.h
[src/emu/cpu/sm8500]sm8500.c sm8500.h sm85ops.h
[src/emu/cpu/spc700]spc700.c spc700.h
[src/emu/cpu/ssp1601]ssp1601.c ssp1601.h
[src/emu/cpu/t11]t11.c t11.h
[src/emu/cpu/tlcs90]tlcs90.c tlcs90.h
[src/emu/cpu/tms32010]tms32010.c tms32010.h
[src/emu/cpu/tms32025]tms32025.c tms32025.h
[src/emu/cpu/tms32031]tms32031.c tms32031.h
[src/emu/cpu/tms32051]tms32051.c tms32051.h
[src/emu/cpu/tms34010]34010ops.c tms34010.c tms34010.h
[src/emu/cpu/tms7000]tms7000.c tms7000.h
[src/emu/cpu/tms9900]99xxcore.h tms9900.h
[src/emu/cpu/upd7810]upd7810.c upd7810.h
[src/emu/cpu/v30mz]nec.h* v30mz.c
[src/emu/cpu/v60]v60.c v60.h
[src/emu/cpu/v810]v810.c v810.h
[src/emu/cpu/z180]z180.c z180.h
[src/emu/cpu/z80]z80.c z80.h z80daisy.c
[src/emu/cpu/z8000]z8000.c z8000.h
[src/emu/debug]debugcmd.c debugcpu.c debughlp.c debugvw.c express.c
[src/emu/machine]53c810.c 53c810.h 6522via.c 6522via.h 6526cia.c 6526cia.h 6532riot.c 6532riot.h 6821pia.c 6850acia.c 6850acia.h 68681.c 68681.h 74123.c 74123.h 74148.c 74148.h 74153.c 74153.h 7474.c 7474.h 8042kbdc.c 8237dma.c 8237dma.h 8255ppi.c 8255ppi.h 8257dma.c 8257dma.h adc083x.c adc083x.h adc1213x.c adc1213x.h am53cf96.c at28c16.c at28c16.h cdp1852.c cdp1852.h cr589.c ds2401.c ds2401.h generic.c generic.h i2cmem.c i2cmem.h idectrl.c idectrl.h laserdsc.h latch8.c latch8.h ldcore.c ldpr8210.c ldv1000.c ldvp931.c mb87078.c mb87078.h microtch.c microtch.h msm6242.c msm6242.h pci.c pci.h pcshare.h pic8259.c pic8259.h pit8253.c pit8253.h rtc65271.c rtc65271.h scsi.c scsi.h scsicd.c scsidev.c scsihd.c smc91c9x.c smc91c9x.h timekpr.c timekpr.h wd33c93.c x2212.c x2212.h x76f041.c x76f041.h x76f100.c x76f100.h z80ctc.c z80ctc.h z80dma.c z80dma.h z80pio.c z80pio.h z80sio.c z80sio.h
[src/emu/sound]2151intf.c 2203intf.c 2413intf.c 2608intf.c 2610intf.c 2612intf.c 262intf.c 3812intf.c 5110intf.c 5110intf.h 5220intf.c aica.c astrocde.c ay8910.c beep.c bsmt2000.c c140.c c352.c c6280.c cdda.c cdp1869.c cem3394.c custom.c custom.h dac.c discrete.c dmadac.c es5503.c es5506.c es8712.c flt_rc.c flt_vol.c gaelco.c hc55516.c ics2115.c iremga20.c k005289.c k007232.c k051649.c k053260.c k054539.c msm5205.c msm5232.c multipcm.c n63701x.c namco.c namco52.c nes_apu.c nile.c okim6258.c okim6295.c pokey.c psx.c psx.h qsound.c rf5c400.c rf5c68.c s14001a.c saa1099.c samples.c scsp.c segapcm.c sid6581.c sn76477.c sn76496.c snkwave.c sp0250.c sp0256.c sp0256.h speaker.c st0016.c tiaintf.c tms3615.c tms36xx.c tms5110.c tms5110.h upd7759.c upd7759.h vlm5030.c votrax.c vrender0.c wave.c x1_010.c ymf271.c ymf278b.c ymz280b.c
[src/emu/video]cdp1869.c cdp1869.h generic.c generic.h mc6845.c mc6845.h poly.c poly.h v9938.c v9938.h vector.c vector.h voodoo.c voodoo.h
[src/lib/util]corefile.c
[src/mame]mame.mak mamedriv.c
[src/mame/audio]amiga.c attckufo.c bzone.c cage.c carnival.c cchasm.c cinemat.c cps3.c dcs.c dcs.h exidy.c exidy440.c flower.c galaxian.c geebee.c gomoku.c gottlieb.c gridlee.c jaguar.c leland.c mario.c mcr.c mcr.h n8080.c namco54.c namco54.h namcoc7x.c phoenix.c pleiads.c polepos.c qix.c redalert.c redbaron.c rockola.c scramble.c segag80r.c segasnd.c segasnd.h seibu.c seibu.h senjyo.c snes.c taito_en.c taito_en.h taitosnd.c tiamc1.c timeplt.c tx1.c warpwarp.c williams.c williams.h wiping.c
[src/mame/drivers]1942.c 1945kiii.c 20pacgal.c 2mindril.c 40love.c 4roses.c 8080bw.c ace.c acommand.c adp.c aeroboto.c aerofgt.c airbustr.c ajax.c aleck64.c alg.c aliens.c alpha68k.c ambush.c ampoker2.c amspdwy.c angelkds.c appoooh.c aquarium.c arabian.c arcadecl.c arcadia.c argus.c arkanoid.c armedf.c artmagic.c ashnojoe.c asterix.c asteroid.c astinvad.c astrocde.c astrocorp.c astrof.c asuka.c atarifb.c atarig1.c atarig42.c atarigx2.c atarisy1.c atarisy2.c ataxx.c attckufo.c avalnche.c aztarac.c backfire.c badlands.c bagman.c balsente.c bankp.c baraduke.c batman.c battlane.c battlex.c bbusters.c beaminv.c berzerk.c bestleag.c bfcobra.c bfm_sc2.c bigevglf.c bigfghtr.c bigstrkb.c bionicc.c bking.c blackt96.c bladestl.c blmbycar.c blockade.c blockhl.c blockout.c bloodbro.c blstroid.c bnstars.c bogeyman.c bombjack.c bottom9.c boxer.c brasil.c brkthru.c bsktball.c btoads.c bublbobl.c bwidow.c bwing.c bzone.c cabal.c calomega.c calorie.c canyon.c carjmbre.c carpolo.c carrera.c caswin.c* cave.c cball.c cbasebal.c cbuster.c ccastles.c cchasm.c cclimber.c centiped.c chaknpop.c cham24.c champbas.c champbwl.c chanbara.c cheekyms.c cherrym2.c chinagat.c chinsan.c chqflag.c cidelsa.c circus.c circusc.c cischeat.c citycon.c clayshoo.c cliffhgr.c cloak.c cloud9.c clshroad.c cninja.c cntsteer.c coinmstr.c cojag.c combatsc.c comebaby.c commando.c compgolf.c contra.c coolpool.c coolridr.c cop01.c copsnrob.c cosmic.c cowrace.c cps1.c cps2.c cps3.c crbaloon.c crgolf.c crimfght.c crospang.c crshrace.c cshooter.c cubeqst.c cubocd32.c cultures.c cvs.c cyberbal.c cybertnk.c dacholer.c darius.c darkhors.c darkmist.c darkseal.c dassault.c dblewing.c dcheese.c dcon.c dday.c ddayjlc.c ddenlovr.c ddragon.c ddragon3.c ddrible.c deadang.c dec0.c dec8.c deco156.c deco32.c deco_mlc.c decocass.c deniam.c destroyr.c dgpix.c dietgo.c discoboy.c diverboy.c djboy.c dkong.c dlair.c dmndrby.c docastle.c dogfgt.c dominob.c dooyong.c dorachan.c dragrace.c dreamwld.c drgnmst.c dribling.c drmicro.c drtomy.c dunhuang.c dwarfd.c dynadice.c dynax.c dynduke.c egghunt.c enigma2.c eolith.c eolith16.c epos.c eprom.c equites.c esd16.c esh.c espial.c ettrivia.c exedexes.c exerion.c exidy.c exidy440.c expro02.c exprraid.c exterm.c exzisus.c f-32.c f1gp.c fantland.c fastfred.c fcombat.c fcrash.c fgoal.c filetto.c finalizr.c findout.c firebeat.c firefox.c firetrap.c firetrk.c fitfight.c flkatck.c flower.c flstory.c flyball.c foodf.c forte2.c fortecar.c freekick.c funkybee.c funkyjet.c funworld.c funybubl.c fuukifg2.c fuukifg3.c gaelco.c gaelco3d.c gal3.c galaga.c galaxi.c galivan.c galpani2.c galpani3.c galpanic.c galspnbl.c gamecstl.c gameplan.c gaplus.c gatron.c gauntlet.c gberet.c gbusters.c genesis.c getrivia.c ghosteo.c gijoe.c ginganin.c gladiatr.c gng.c go2000.c goal92.c goindol.c goldnpkr.c goldstar.c good.c goodejan.c gotcha.c gottlieb.c gotya.c gpworld.c gradius3.c grchamp.c gstream.c gstriker.c gsword.c gticlub.c gtipoker.c guab.c gumbo.c gundealr.c gunpey.c gunsmoke.c gyruss.c halleys.c hanaawas.c hanaroku.c harddriv.c hexa.c hexion.c higemaru.c hitme.c hnayayoi.c hng64.c holeland.c homedata.c homerun.c hornet.c hotblock.c hshavoc.c hyhoo.c hyperspt.c hyprduel.c igs009.c igs_180.c igs_blit.c igs_m027.c igs_m68.c ikki.c imolagp.c intrscti.c iqblock.c ironhors.c istellar.c itech32.c itech8.c jack.c jackal.c jackpool.c jailbrek.c jalmah.c jangou.c janshi.c* jantotsu.c* jchan.c jedi.c jokrwild.c jollyjgr.c jongkyo.c jpmimpct.c jrpacman.c kaneko16.c kangaroo.c karnov.c kickgoal.c kingobox.c kingpin.c kinst.c klax.c kncljoe.c koikoi.c konamigq.c konamigv.c konamigx.c kopunch.c ksayakyu.c ksys573.c kyugo.c ladybug.c ladyfrog.c laserbas.c laserbat.c lasso.c lastduel.c leland.c lemmings.c lethal.c lgp.c liberate.c liberatr.c limenko.c littlerb.c lockon.c looping.c lordgun.c lsasquad.c ltcasino.c lucky74.c lvcards.c lwings.c m10.c m107.c m57.c m58.c m62.c m63.c m72.c m79amb.c m90.c m92.c macrossp.c madalien.c madmotor.c magic10.c magicfly.c magmax.c mainevt.c mainsnk.c mappy.c marineb.c marinedt.c mario.c markham.c mastboy.c matmania.c mayumi.c mazerbla.c mcatadv.c mcr.c mcr3.c mcr68.c meadows.c mediagx.c megadriv.c megadriv.h megaplay.c megasys1.c megatech.c megazone.c meijinsn.c merit.c meritm.c mermaid.c metlclsh.c metro.c mexico86.c mgolf.c mhavoc.c micro3d.c midas.c midvunit.c midyunit.c midzeus.c mikie.c miniboy7.c mirage.c mirax.c missb2.c missile.c mitchell.c mjkjidai.c mjsister.c mjsiyoub.c mlanding.c model1.c model2.c model3.c mogura.c mole.c momoko.c mouser.c mpu4.c mpu4drvr.c mquake.c mrflea.c mrjong.c ms32.c msisaac.c mugsmash.c multigam.c murogem.c mustache.c mw8080bw.c mwarr.c mystston.c mystwarr.c n8080.c namcona1.c namconb1.c namcond1.c namcos1.c namcos11.c namcos12.c namcos2.c namcos21.c namcos22.c namcos23.c namcos86.c naomi.c naughtyb.c nbmj8688.c nbmj8891.c nbmj8991.c nbmj9195.c nemesis.c neodrvr.c neogeo.c news.c ninjakd2.c ninjaw.c nitedrvr.c niyanpai.c nmg5.c nmk16.c nova2001.c nss.c nwk-tr.c nycaptor.c nyny.c offtwall.c ohmygod.c olibochu.c omegrace.c oneshot.c onetwo.c opwolf.c orbit.c othldrby.c othunder.c overdriv.c pacland.c pacman.c pandoras.c pangofun.c panicr.c paradise.c paranoia.c parentj.c* parodius.c pasha2.c pass.c pastelg.c pbaction.c pengo.c peplus.c pgm.c phoenix.c pingpong.c pipeline.c pirates.c pitnrun.c pkscram.c pktgaldx.c playch10.c playmark.c plygonet.c pntnpuzl.c polepos.c poolshrk.c pooyan.c popeye.c popper.c portrait.c powerbal.c powerins.c ppmast93.c prehisle.c psikyo.c psikyosh.c psychic5.c pturn.c puckpkmn.c punchout.c pushman.c qix.c quantum.c quasar.c queen.c quizdna.c quizpani.c quizpun2.c r2dtank.c rabbit.c raiden.c raiden2.c rainbow.c rallyx.c rampart.c rastan.c rbmk.c rcasino.c realbrk.c redclash.c relief.c renegade.c retofinv.c rmhaihai.c rockola.c rohga.c rollerg.c rotaryf.c route16.c royalmah.c rpunch.c runaway.c rungun.c safarir.c sandscrp.c sangho.c sauro.c sbasketb.c sbowling.c sbrkout.c sbugger.c scobra.c scotrsht.c scramble.c scregg.c sderby.c seattle.c segae.c segag80r.c segag80v.c segahang.c segald.c segaorun.c segas16a.c segas16b.c segas18.c segas24.c segas32.c segaxbd.c segaybd.c seibuspi.c seicross.c sengokmj.c senjyo.c seta.c seta2.c sfkick.c sg1000a.c shadfrce.c shangha3.c shanghai.c shangkid.c shaolins.c shisen.c shootout.c shougi.c shuuz.c sidearms.c silkroad.c skullxbo.c skyarmy.c skydiver.c skyfox.c skykid.c skylncr.c skyraid.c slapfght.c slapshot.c sliver.c smstrv.c snesb.c snk.c snk68.c snookr10.c snowbros.c spacefb.c spbactn.c spcforce.c spdodgeb.c speedatk.c speedbal.c speedspn.c speglsht.c spiders.c spool99.c sprcros2.c sprint2.c sprint4.c sprint8.c spy.c srmp2.c srmp5.c srmp6.c srumbler.c ssfindo.c sshangha.c ssingles.c sslam.c sspeedr.c ssrj.c sstrangr.c ssv.c st0016.c stactics.c stadhero.c starfire.c starshp1.c starwars.c statriv2.c steaser.c stepstag.c stfight.c stlforce.c strnskil.c stv.c stvinit.c subs.c suna16.c suna8.c supbtime.c supdrapo.c superchs.c superdq.c superqix.c supertnk.c suprgolf.c suprnova.c suprridr.c suprslam.c system16.c system18.c tail2nos.c taito_b.c taito_f2.c taito_f3.c taito_h.c taito_l.c taito_x.c taito_z.c taitoair.c taitojc.c taitosj.c taitowlf.c tank8.c tankbust.c taotaido.c tarzan.c tatsumi.c tattack.c taxidrvr.c tbowl.c tceptor.c tcl.c tecmo16.c tecmosys.c tehkanwc.c tempest.c terracre.c tetrisp2.c tetriunk.c thayers.c thedeep.c thepit.c thunderj.c thunderx.c tiamc1.c tigeroad.c timelimt.c timeplt.c tmaster.c tnzs.c toaplan1.c toaplan2.c toki.c toobin.c topshoot.c topspeed.c toratora.c toypop.c tp84.c trackfld.c travrusa.c triplhnt.c trucocl.c trvmadns.c trvquest.c tryout.c tsamurai.c ttchamp.c tubep.c tugboat.c tumbleb.c tumblep.c tunhunt.c turbo.c turbosub.c twin16.c twincobr.c twins.c tx1.c uapce.c ultraman.c ultratnk.c ultrsprt.c undrfire.c unico.c upscope.c usgames.c vamphalf.c vaportra.c vastar.c vball.c vcombat.c vegaeo.c vegas.c vendetta.c vertigo.c vicdual.c victory.c videopin.c vigilant.c vindictr.c viper.c vmetal.c volfied.c vroulet.c vsnes.c vulgus.c wallc.c wardner.c warpwarp.c warriorb.c wecleman.c welltris.c wgp.c wheelfir.c williams.c wink.c witch.c wiz.c wldarrow.c wolfpack.c wrally.c wwfsstar.c wwfwfest.c xain.c xexex.c xmen.c xorworld.c xxmissio.c xybots.c yumefuda.c yunsun16.c zaccaria.c zaxxon.c zerozone.c zn.c zodiack.c zr107.c
[src/mame/includes]amiga.h carpolo.h gaelco3d.h galaxold.h harddriv.h jaguar.h n64.h naomibd.h psx.h snes.h system16.h
[src/mame/machine]amiga.c atari.c atarigen.c atarigen.h balsente.c bublbobl.c carpolo.c cubocd32.c dc.c fddebug.c fddebug.h* galaxold.c harddriv.c konppc.c konppc.h leland.c mcr.c mexico86.c midtunit.c midwayic.c midwayic.h midwunit.c midyunit.c model1.c n64.c namcoio.c namcos1.c naomibd.c pcecommn.c pcecommn.h pcshare.c playch10.c psx.c s16fd.c s24fd.c scramble.c segaic16.c seicop.c slapstic.c system16.c taitosj.c tnzs.c toaplan1.c tx1.c vertigo.c vsnes.c williams.c wrally.c zs01.c zs01.h
[src/mame/video]1942.c 1943.c 40love.c aeroboto.c ambush.c amspdwy.c appoooh.c arkanoid.c armedf.c ashnojoe.c atari.c avgdvg.c aztarac.c bagman.c bankp.c baraduke.c battlane.c battlex.c bionicc.c bking.c blktiger.c blockout.c blueprnt.c bogeyman.c bombjack.c boogwing.c bosco.c btime.c bublbobl.c buggychl.c cabal.c carpolo.c cbuster.c cchasm.c champbas.c cidelsa.c cinemat.c circusc.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 deco32.c decocass.c dietgo.c digdug.c docastle.c dogfgt.c dooyong.c drmicro.c dynduke.c equites.c esd16.c exprraid.c exzisus.c fastfred.c finalizr.c firetrap.c flower.c flstory.c freekick.c funkybee.c funkyjet.c funworld.c fuukifg2.c fuukifg3.c gaelco3d.c gaiden.c galaga.c galastrm.c galaxold.c gaplus.c gberet.c gladiatr.c gng.c goindol.c goldstar.c gottlieb.c gotya.c gtia.c gtia.h gticlub.c gunsmoke.c hanaawas.c hexa.c higemaru.c holeland.c hyperspt.c hyprduel.c ironhors.c jack.c jackal.c jagblit.c jagobj.c jaguar.c jailbrek.c kan_panb.c kan_pand.c kchamp.c kingobox.c ladybug.c lasso.c lastduel.c liberate.c lkage.c lockon.c lsasquad.c lwings.c m52.c m58.c m72.c m92.c madalien.c mainsnk.c mappy.c markham.c mermaid.c metlclsh.c metro.c midvunit.c midzeus.c midzeus2.c mikie.c mjkjidai.c model1.c model2.c model3.c mole.c mouser.c mrjong.c mustache.c n64.c n8080.c namcos1.c namcos22.c namcos86.c ninjakd2.c nmk16.c nova2001.c othldrby.c pacland.c paradise.c pastelg.c pbaction.c pcktgal.c pitnrun.c pktgaldx.c playch10.c pokechmp.c pooyan.c popeye.c powerins.c prehisle.c psikyo.c psx.c psychic5.c pushman.c qix.c quizdna.c rallyx.c realbrk.c redclash.c renegade.c retofinv.c rockola.c rocnrope.c rohga.c sauro.c sbasketb.c scotrsht.c segag80v.c senjyo.c seta2.c sf.c shangha3.c shaolins.c shisen.c shootout.c sidearms.c simpl156.c skykid.c snk.c solomon.c sonson.c spcforce.c spdodgeb.c speedatk.c speedbal.c srumbler.c sshangha.c ssozumo.c stfight.c strnskil.c stvvdp1.c suna16.c suna8.c supbtime.c superqix.c suprloco.c system1.c tagteam.c taitoic.c taitojc.c tecmo.c tecmo16.c tehkanwc.c terracre.c thedeep.c tigeroad.c timeplt.c toki.c trackfld.c travrusa.c tryout.c tsamurai.c tumblep.c twin16.c tx1.c vaportra.c vastar.c vball.c vertigo.c vsnes.c vulgus.c welltris.c wrally.c wwfsstar.c wwfwfest.c xain.c xevious.c ygv608.c yiear.c yunsun16.c zaccaria.c zaxxon.c zodiack.c
[src/mess]device.c device.h mess.mak messdriv.c uimess.c uimess.h
[src/mess/audio]arcadia.c cdp1863.c channelf.c dai.c dave.c gb.c gmaster.c kaypro.c lmc1992.c lmc1992.h lynx.c mac.c mea8000.c mea8000.h special.c svision.c ted7360.c vc4000.c vic6560.c wswan.c
[src/mess/devices]bitbngr.c bitbngr.h cassette.c cassette.h chd_cd.c chd_cd.h coco_vhd.c coco_vhd.h harddriv.c harddriv.h kermit.c kermit.h microdrv.c printer.c printer.h snapquik.c snapquik.h thomflop.c xmodem.c xmodem.h z80bin.c z80bin.h
[src/mess/drivers]3do.c a7800.c abc80.c abc80x.c adam.c amiga.c amstrad.c apogee.c apple1.c apple2.c apple3.c arcadia.c at.c atarist.c avigo.c bbc.c bbcbc.c bebox.c bw2.c c128.c c16.c c64.c c65.c cbmb.c cgenie.c channelf.c coco.c compis.c concept.c cpschngr.c dai.c einstein.c enterp.c exelv.c exidy.c gamecom.c gb.c intv.c jaguar.c jupiter.c kaypro.c kc.c kim1.c lisa.c lviv.c lynx.c mac.c mbee.c mekd2.c mephisto.c mikrosha.c mk1.c mk2.c mpf1.c msx.c mtx.c n64.c nc.c newbrain.c odyssey2.c oric.c osborne1.c osi.c p2000t.c partner.c pasogo.c pc.c pc8801.c pce.c pcw.c pcw16.c pentagon.c pet.c pmd85.c pocketc.c pokemini.c psx.c ql.c radio86.c samcoupe.c saturn.c scorpion.c sg1000.c sms.c snes.c sord.c specpls3.c spectrum.c ssystem3.c studio2.c svi318.c thomson.c ti85.c tmc2000e.c trs80.c tutor.c vc20.c vc4000.c vip.c votrpss.c vtech1.c vtech2.c wswan.c x68k.c z88.c
[src/mess/includes]gamecom.h gamepock.h gmaster.h hp48.h odyssey2.h pc.h
[src/mess/machine]6530miot.c 6530miot.h 6551.c 6551.h 6883sam.c 6883sam.h 68901mfp.c 68901mfp.h 74145.c 74145.h 8530scc.c 8530scc.h 990_dk.c 990_hd.c 99_dsk.c 99_ide.c abc77.c abc77.h abc99.c adam.c adc080x.c adc080x.h amigacd.c amigacrt.c amigacrt.h amigakbd.c amstrad.c ap2_lang.c ap2_lang.h ap2_slot.c ap2_slot.h apple2.c apple2gs.c apple3.c applefdc.c applefdc.h at.c atom.c ay31015.c ay31015.h b2m.c bebox.c c128.c c16.c c64.c c65.c cbmb.c cdp1871.c cdp1871.h coco.c concept.c conkort.c dai.c e0516.c e0516.h gamecom.c gamepock.c gb.c genesis.c geneve.c hd63450.c hd63450.h hp48.c i82439tx.c i8271.c i8271.h ins8154.c ins8154.h ins8250.c ins8250.h kc.c kramermc.c lisa.c lviv.c mc6843.c mc6843.h mc6846.c mc6846.h mc6854.c mc6854.h mm58274c.c mm58274c.h mockngbd.c mockngbd.h msm8251.c msm8251.h msx.c mtx.c ncr5380.c nec765.c nec765.h nes.c odyssey2.c oric.c osborne1.c partner.c pc.c pc8801.c pc_fdc.c pc_fdc.h pc_hdc.c pcf8593.c pcf8593.h pet.c pokemini.c radio86.c smc92x4.c sms.c snescart.c spectrum.c svi318.c sym1.c tc8521.c tc8521.h ti99_4x.c tms5501.c tms5501.h tms9901.c tms9901.h tms9902.c tms9902.h upd7002.c upd7002.h vector06.c vtech1.c vtech2.c wd17xx.c wd17xx.h wswan.c x68k_hdc.c x68k_hdc.h z80dart.c z80dart.h zx8302.c zx8302.h
[src/mess/osd/windows]dialog.c menu.c
[src/mess/tools/messtest]main.c testmess.c
[src/mess/video]abc800.c abc802.c abc806.c cdp1861.c cdp1861.h cdp1862.c cdp1862.h cdp1864.c cdp1864.h comx35.c crtc_ega.c crtc_ega.h dl1416.c dl1416.h i8275.c i8275.h msm6255.c msm6255.h odyssey2.c pc_aga.c pc_cga.c pc_ega.c pc_mda.c pc_t1t.c pecom.c saa5050.c tmc1800.c tmc600.c vectrex.c zx8301.c zx8301.h
[src/osd/windows]debugwin.c input.c output.c winmain.c
[src/osd/winui]properties.c treeview.c

src/mame/audio/cchasm.c
r3957r3958
159159
160160z80ctc_interface cchasm_ctc_intf =
161161{
162   "audio",         /* clock from the audio CPU */
163   0,               /* clock (filled in from the CPU 0 clock */
164162   0,               /* timer disables */
165163   ctc_interrupt,   /* interrupt handler */
166164   0,               /* ZC/TO0 callback */
src/mame/audio/qix.c
r3957r3958
44
55*************************************************************************/
66#include "driver.h"
7#include "cpu/m6800/m6800.h"
78#include "qix.h"
89#include "machine/6821pia.h"
910#include "sound/sn76496.h"
src/mame/audio/warpwarp.c
r3957r3958
119119
120120}
121121
122static void warpwarp_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
122static STREAM_UPDATE( warpwarp_sound_update )
123123{
124124    static int vcarry = 0;
125125    static int vcount = 0;
r3957r3958
127127   static int mcount = 0;
128128   stream_sample_t *buffer = outputs[0];
129129
130    while (length--)
130    while (samples--)
131131    {
132132      *buffer++ = (sound_signal + music_signal) / 2;
133133
src/mame/audio/cps3.c
r3957r3958
44
55***************************************************************************/
66#include "driver.h"
7#include "deprecat.h"
87#include "streams.h"
98#include "includes/cps3.h"
109
r3957r3958
2524   UINT16     key;
2625} chip;
2726
28static void cps3_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
27static STREAM_UPDATE( cps3_stream_update )
2928{
3029   int i;
31   INT8 *base = (INT8*)memory_region(Machine, "user5");
30   INT8 *base = (INT8*)memory_region(device->machine, "user5");
3231
3332   /* Clear the buffers */
34   memset(buffer[0], 0, length*sizeof(*buffer[0]));
35   memset(buffer[1], 0, length*sizeof(*buffer[1]));
33   memset(outputs[0], 0, samples*sizeof(*outputs[0]));
34   memset(outputs[1], 0, samples*sizeof(*outputs[1]));
3635
3736   for (i = 0; i < CPS3_VOICES; i ++)
3837   {
r3957r3958
6261         loop -= 0x400000;
6362
6463         /* Go through the buffer and add voice contributions */
65         for (j = 0; j < length; j ++)
64         for (j = 0; j < samples; j ++)
6665         {
6766            INT32 sample;
6867
r3957r3958
8685            sample = base[BYTE4_XOR_LE(start + pos)];
8786            frac += step;
8887
89            buffer[0][j] += (sample * (vol_l >> 8));
90            buffer[1][j] += (sample * (vol_r >> 8));
88            outputs[0][j] += (sample * (vol_l >> 8));
89            outputs[1][j] += (sample * (vol_r >> 8));
9190         }
9291
9392         vptr->pos = pos;
src/mame/audio/snes.c
r3957r3958
11701170   return auto_malloc(1);
11711171}
11721172
1173void snes_sh_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length )
1173STREAM_UPDATE( snes_sh_update )
11741174{
11751175   int i;
11761176   short mix[2];
11771177
1178   for (i = 0; i < length; i++)
1178   for (i = 0; i < samples; i++)
11791179   {
11801180      mix[0] = mix[1] = 0;
11811181      DSP_Update(mix);
src/mame/audio/jaguar.c
r3957r3958
143143****************************************************************************/
144144
145145#include "driver.h"
146#include "deprecat.h"
147146#include "memconv.h"
148147#include "includes/jaguar.h"
149148#include "cpu/jaguar/jaguar.h"
r3957r3958
209208 *
210209 *************************************/
211210
212static void update_gpu_irq(void)
211static void update_gpu_irq(running_machine *machine)
213212{
214213   if (gpu_irq_state & dsp_regs[JINTCTRL] & 0x1f)
215214   {
216      cpu_set_input_line(Machine->cpu[1], 1, ASSERT_LINE);
217      jaguar_gpu_resume(Machine);
215      cpu_set_input_line(machine->cpu[1], 1, ASSERT_LINE);
216      jaguar_gpu_resume(machine);
218217   }
219218   else
220      cpu_set_input_line(Machine->cpu[1], 1, CLEAR_LINE);
219      cpu_set_input_line(machine->cpu[1], 1, CLEAR_LINE);
221220}
222221
223222
r3957r3958
227226      gpu_irq_state |= 1;
228227   else
229228      gpu_irq_state &= ~1;
230   update_gpu_irq();
229   update_gpu_irq(device->machine);
231230}
232231
233232
r3957r3958
283282 *
284283 *************************************/
285284
286void cojag_sound_reset(void)
285void cojag_sound_reset(running_machine *machine)
287286{
288287#if ENABLE_SPEEDUP_HACKS
289   serial_timer = timer_alloc(Machine, serial_chunky_callback, NULL);
288   serial_timer = timer_alloc(machine, serial_chunky_callback, NULL);
290289#else
291   serial_timer = timer_alloc(Machine, serial_callback, NULL);
290   serial_timer = timer_alloc(machine, serial_callback, NULL);
292291#endif
293292}
294293
r3957r3958
323322   {
324323      case JINTCTRL:
325324         gpu_irq_state &= ~(dsp_regs[JINTCTRL] >> 8);
326         update_gpu_irq();
325         update_gpu_irq(space->machine);
327326         break;
328327   }
329328
src/mame/audio/phoenix.c
r3957r3958
1010
1111#include "driver.h"
1212#include "streams.h"
13#include "deprecat.h"
1413#include "sound/custom.h"
1514#include "sound/tms36xx.h"
1615#include "phoenix.h"
r3957r3958
205204   return sum;
206205}
207206
208static void phoenix_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
207static STREAM_UPDATE( phoenix_sound_update )
209208{
210   int samplerate = Machine->sample_rate;
209   int samplerate = device->machine->sample_rate;
211210   stream_sample_t *buffer = outputs[0];
212211
213   while( length-- > 0 )
212   while( samples-- > 0 )
214213   {
215214      int sum = 0;
216215      sum = noise(samplerate) / 2;
src/mame/audio/n8080.c
r3957r3958
322322
323323   if (n8080_hardware == 1)
324324   {
325      flip_screen_set_no_update(data & 0x20);
325      flip_screen_set_no_update(machine, data & 0x20);
326326   }
327327   if (n8080_hardware == 3)
328328   {
src/mame/audio/amiga.c
r3957r3958
1010
1111#include "driver.h"
1212#include "streams.h"
13#include "deprecat.h"
1413#include "includes/amiga.h"
1514#include "cpu/m68000/m68000.h"
1615
r3957r3958
123122
124123
125124
126static void amiga_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
125static STREAM_UPDATE( amiga_stream_update )
127126{
128127   amiga_audio *audio = param;
129128   int channum, sampoffs = 0;
r3957r3958
138137
139138      /* clear the sample data to 0 */
140139      for (channum = 0; channum < 4; channum++)
141         memset(outputs[channum], 0, sizeof(stream_sample_t) * length);
140         memset(outputs[channum], 0, sizeof(stream_sample_t) * samples);
142141      return;
143142   }
144143
145   length *= CLOCK_DIVIDER;
144   samples *= CLOCK_DIVIDER;
146145
147146   /* update the DMA states on each channel and reload if fresh */
148147   for (channum = 0; channum < 4; channum++)
r3957r3958
154153   }
155154
156155   /* loop until done */
157   while (length > 0)
156   while (samples > 0)
158157   {
159158      int nextper, nextvol;
160      int ticks = length;
159      int ticks = samples;
161160
162161      /* determine the number of ticks we can do in this chunk */
163162      if (ticks > audio->channel[0].curticks)
r3957r3958
242241            /* if we're in manual mode, signal an interrupt once we latch the low byte */
243242            if (!chan->dmaenabled && chan->manualmode && (chan->curlocation & 1))
244243            {
245               signal_irq(Machine, NULL, channum);
244               signal_irq(device->machine, NULL, channum);
246245               chan->manualmode = FALSE;
247246            }
248247         }
r3957r3958
250249
251250      /* bump ourselves forward by the number of ticks */
252251      sampoffs += ticks;
253      length -= ticks;
252      samples -= ticks;
254253   }
255254}
256255
src/mame/audio/timeplt.c
r3957r3958
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "sound/ay8910.h"
1516#include "sound/flt_rc.h"
1617#include "timeplt.h"
src/mame/audio/cinemat.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "deprecat.h"
20#include "cpu/z80/z80.h"
2121#include "cpu/ccpu/ccpu.h"
2222#include "cpu/z80/z80daisy.h"
2323#include "machine/z80ctc.h"
r3957r3958
5252 *
5353 *************************************/
5454
55static void (*sound_handler)(UINT8 sound_val, UINT8 bits_changed);
55static void (*sound_handler)(running_machine *,UINT8 sound_val, UINT8 bits_changed);
5656static UINT8 sound_control;
5757
5858/* general shift register variables */
r3957r3958
8585
8686   /* if something changed, call the sound subroutine */
8787   if ((sound_control != oldval) && sound_handler)
88      (*sound_handler)(sound_control, sound_control ^ oldval);
88      (*sound_handler)(space->machine, sound_control, sound_control ^ oldval);
8989}
9090
9191
r3957r3958
9696 *
9797 *************************************/
9898
99static void generic_init(running_machine *machine, void (*callback)(UINT8, UINT8))
99static void generic_init(running_machine *machine, void (*callback)(running_machine *,UINT8, UINT8))
100100{
101101   /* call the standard init */
102102   MACHINE_RESET_CALL(cinemat);
r3957r3958
159159   spacewar_sample_names
160160};
161161
162static void spacewar_sound_w(UINT8 sound_val, UINT8 bits_changed)
162static void spacewar_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
163163{
164   running_machine *machine = Machine;
165
166164   /* Explosion - rising edge */
167165   if (SOUNDVAL_RISING_EDGE(0x01))
168166      sample_start(0, (mame_rand(machine) & 1) ? 0 : 6, 0);
r3957r3958
238236   barrier_sample_names
239237};
240238
241static void barrier_sound_w(UINT8 sound_val, UINT8 bits_changed)
239static void barrier_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
242240{
243241   /* Player die - rising edge */
244242   if (SOUNDVAL_RISING_EDGE(0x01))
r3957r3958
289287   speedfrk_sample_names
290288};
291289
292static void speedfrk_sound_w(UINT8 sound_val, UINT8 bits_changed)
290static void speedfrk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
293291{
294292   /* on the falling edge of bit 0x08, clock the inverse of bit 0x04 into the top of the shiftreg */
295293   if (SOUNDVAL_FALLING_EDGE(0x08))
r3957r3958
352350   starhawk_sample_names
353351};
354352
355static void starhawk_sound_w(UINT8 sound_val, UINT8 bits_changed)
353static void starhawk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
356354{
357355   /* explosion - falling edge */
358356   if (SOUNDVAL_FALLING_EDGE(0x01))
r3957r3958
426424   sundance_sample_names
427425};
428426
429static void sundance_sound_w(UINT8 sound_val, UINT8 bits_changed)
427static void sundance_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
430428{
431429   /* bong - falling edge */
432430   if (SOUNDVAL_FALLING_EDGE(0x01))
r3957r3958
494492   tailg_sample_names
495493};
496494
497static void tailg_sound_w(UINT8 sound_val, UINT8 bits_changed)
495static void tailg_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
498496{
499497   /* the falling edge of bit 0x10 clocks bit 0x08 into the mux selected by bits 0x07 */
500498   if (SOUNDVAL_FALLING_EDGE(0x10))
r3957r3958
580578   warrior_sample_names
581579};
582580
583static void warrior_sound_w(UINT8 sound_val, UINT8 bits_changed)
581static void warrior_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
584582{
585583   /* normal level - 0=on, 1=off */
586584   if (SOUNDVAL_FALLING_EDGE(0x01))
r3957r3958
649647   armora_sample_names
650648};
651649
652static void armora_sound_w(UINT8 sound_val, UINT8 bits_changed)
650static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
653651{
654652   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
655653   if (SOUNDVAL_RISING_EDGE(0x10))
r3957r3958
748746   ripoff_sample_names
749747};
750748
751static void ripoff_sound_w(UINT8 sound_val, UINT8 bits_changed)
749static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
752750{
753751   /* on the rising edge of bit 0x02, clock bit 0x01 into the shift register */
754752   if (SOUNDVAL_RISING_EDGE(0x02))
r3957r3958
833831   starcas_sample_names
834832};
835833
836static void starcas_sound_w(UINT8 sound_val, UINT8 bits_changed)
834static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
837835{
838   running_machine *machine = Machine;
839836   UINT32 target_pitch;
840837
841838   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r3957r3958
946943   solarq_sample_names
947944};
948945
949static void solarq_sound_w(UINT8 sound_val, UINT8 bits_changed)
946static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
950947{
951   running_machine *machine = Machine;
952948   static float target_volume, current_volume;
953949
954950   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r3957r3958
10861082   boxingb_sample_names
10871083};
10881084
1089static void boxingb_sound_w(UINT8 sound_val, UINT8 bits_changed)
1085static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
10901086{
10911087   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
10921088   if (SOUNDVAL_RISING_EDGE(0x10))
r3957r3958
12151211   wotw_sample_names
12161212};
12171213
1218static void wotw_sound_w(UINT8 sound_val, UINT8 bits_changed)
1214static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
12191215{
1220   running_machine *machine = Machine;
12211216   UINT32 target_pitch;
12221217
12231218   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r3957r3958
13281323   wotwc_sample_names
13291324};
13301325
1331static void wotwc_sound_w(UINT8 sound_val, UINT8 bits_changed)
1326static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
13321327{
1333   running_machine *machine = Machine;
13341328   UINT32 target_pitch;
13351329
13361330   /* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
r3957r3958
14281422}
14291423
14301424
1431static void demon_sound_w(UINT8 sound_val, UINT8 bits_changed)
1425static void demon_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
14321426{
1433   running_machine *machine = Machine;
1434
14351427   /* all inputs are inverted */
14361428   sound_val = ~sound_val;
14371429
r3957r3958
15081500
15091501static z80ctc_interface demon_z80ctc_interface =
15101502{
1511   "audio",       /* clocked from the audio CPU */
1512   0,               /* clock (filled in from the CPU clock) */
15131503   0,               /* timer disables */
15141504   ctc_interrupt,   /* interrupt handler */
15151505   0,               /* ZC/TO0 callback */
r3957r3958
15701560   MDRV_CPU_PROGRAM_MAP(demon_sound_map,0)
15711561   MDRV_CPU_IO_MAP(demon_sound_ports,0)
15721562
1573   MDRV_Z80CTC_ADD("ctc", demon_z80ctc_interface)
1563   MDRV_Z80CTC_ADD("ctc", 3579545 /* same as "audio" */, demon_z80ctc_interface)
15741564
15751565   MDRV_MACHINE_RESET(demon_sound)
15761566
r3957r3958
16001590static WRITE8_HANDLER( qb3_sound_w )
16011591{
16021592   UINT16 rega = cpu_get_reg(space->machine->cpu[0], CCPU_A);
1603   demon_sound_w(0x00 | (~rega & 0x0f), 0x10);
1593   demon_sound_w(space->machine, 0x00 | (~rega & 0x0f), 0x10);
16041594}
16051595
16061596
src/mame/audio/galaxian.c
r3957r3958
7070static TIMER_CALLBACK( lfo_timer_cb );
7171static TIMER_CALLBACK( galaxian_sh_update );
7272
73static void tone_update(void *param, stream_sample_t **input, stream_sample_t **output, int length)
73static STREAM_UPDATE( tone_update )
7474{
75   stream_sample_t *buffer = output[0];
75   stream_sample_t *buffer = outputs[0];
7676   int i,j;
7777   INT16 *w = tonewave[vol];
7878
7979   /* only update if we have non-zero volume and frequency */
8080   if( pitch != 0xff )
8181   {
82      for (i = 0; i < length; i++)
82      for (i = 0; i < samples; i++)
8383      {
8484         int mix = 0;
8585
r3957r3958
9999   }
100100   else
101101   {
102      for( i = 0; i < length; i++ )
102      for( i = 0; i < samples; i++ )
103103         *buffer++ = 0;
104104   }
105105}
src/mame/audio/redbaron.c
r3957r3958
6262        pokey1_w(space, offset, data);
6363}
6464
65static void redbaron_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
65static STREAM_UPDATE( redbaron_sound_update )
6666{
6767   stream_sample_t *buffer = outputs[0];
68   while( length-- )
68   while( samples-- )
6969   {
7070      int sum = 0;
7171
src/mame/audio/cage.c
r3957r3958
1010
1111
1212#include "driver.h"
13#include "deprecat.h"
1413#include "cpu/tms32031/tms32031.h"
1514#include "sound/dmadac.h"
1615#include "cage.h"
r3957r3958
193192void cage_reset_w(int state)
194193{
195194   if (state)
196      cage_control_w(Machine, 0);
195      cage_control_w(cage_cpu->machine, 0);
197196   cpu_set_input_line(cage_cpu, INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
198197}
199198
r3957r3958
529528
530529void main_to_cage_w(UINT16 data)
531530{
531   running_machine *machine = cage_cpu->machine;
532532   if (LOG_COMM)
533      logerror("%s:Command to CAGE = %04X\n", cpuexec_describe_context(Machine), data);
534   timer_call_after_resynch(Machine, NULL, data, deferred_cage_w);
533      logerror("%s:Command to CAGE = %04X\n", cpuexec_describe_context(machine), data);
534   timer_call_after_resynch(machine, NULL, data, deferred_cage_w);
535535}
536536
537537
src/mame/audio/namco54.c
r3957r3958
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "deprecat.h"
5352#include "namco54.h"
5453#include "cpu/mb88xx/mb88xx.h"
5554
r3957r3958
114113   cpu_set_input_line(device, 0, CLEAR_LINE);
115114}
116115
117void namco_54xx_write(UINT8 data)
116void namco_54xx_write(running_machine *machine, UINT8 data)
118117{
119   const device_config *device = cputag_get_cpu(Machine, CPUTAG_54XX);
118   const device_config *device = cputag_get_cpu(machine, CPUTAG_54XX);
120119
121120   if (device == NULL)
122121      return;
123122
124   timer_call_after_resynch(Machine, NULL, data, namco_54xx_latch_callback);
123   timer_call_after_resynch(machine, NULL, data, namco_54xx_latch_callback);
125124
126125   cpu_set_input_line(device, 0, ASSERT_LINE);
127126
r3957r3958
130129   // The input clock to the 06XX interface chip is 64H, that is
131130   // 18432000/6/64 = 48kHz, so it makes sense for the irq line to be
132131   // asserted for one clock cycle ~= 21us.
133   timer_set(Machine, ATTOTIME_IN_USEC(21), (void *)device, 0, namco_54xx_irq_clear);
132   timer_set(machine, ATTOTIME_IN_USEC(21), (void *)device, 0, namco_54xx_irq_clear);
134133}
src/mame/audio/senjyo.c
r3957r3958
4040/* z80 ctc */
4141const z80ctc_interface senjyo_ctc_intf =
4242{
43   "sub",          /* clock from sub CPU */
44   0,               /* clock (filled in from the CPU 0 clock */
4543   NOTIMER_2,       /* timer disables */
4644   daisy_interrupt, /* interrupt handler */
4745   z80ctc_trg1_w,     /* ZC/TO0 callback */
src/mame/audio/exidy440.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/m6809/m6809.h"
1112#include "streams.h"
1213#include "exidy440.h"
1314
r3957r3958
110111
111112
112113/* function prototypes */
113static void channel_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length);
114static STREAM_UPDATE( channel_update );
114115static void m6844_finished(int ch);
115116static void play_cvsd(running_machine *machine, int ch);
116117static void stop_cvsd(int ch);
r3957r3958
276277 *
277278 *************************************/
278279
279static void channel_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
280static STREAM_UPDATE( channel_update )
280281{
281282   int ch;
282283
283284   /* reset the mixer buffers */
284   memset(mixer_buffer_left, 0, length * sizeof(INT32));
285   memset(mixer_buffer_right, 0, length * sizeof(INT32));
285   memset(mixer_buffer_left, 0, samples * sizeof(INT32));
286   memset(mixer_buffer_right, 0, samples * sizeof(INT32));
286287
287288   /* loop over channels */
288289   for (ch = 0; ch < 4; ch++)
289290   {
290291      sound_channel_data *channel = &sound_channel[ch];
291      int samples, volume, left = length;
292      int length, volume, left = samples;
292293      int effective_offset;
293294
294295      /* if we're not active, bail */
r3957r3958
296297         continue;
297298
298299      /* see how many samples to copy */
299      samples = (left > channel->remaining) ? channel->remaining : left;
300      length = (left > channel->remaining) ? channel->remaining : left;
300301
301302      /* get a pointer to the sample data and copy to the left */
302303      volume = sound_volume[2 * ch + 0];
303304      if (volume)
304         add_and_scale_samples(ch, mixer_buffer_left, samples, volume);
305         add_and_scale_samples(ch, mixer_buffer_left, length, volume);
305306
306307      /* get a pointer to the sample data and copy to the left */
307308      volume = sound_volume[2 * ch + 1];
308309      if (volume)
309         add_and_scale_samples(ch, mixer_buffer_right, samples, volume);
310         add_and_scale_samples(ch, mixer_buffer_right, length, volume);
310311
311312      /* update our counters */
312      channel->offset += samples;
313      channel->remaining -= samples;
314      left -= samples;
313      channel->offset += length;
314      channel->remaining -= length;
315      left -= length;
315316
316317      /* update the MC6844 */
317318      effective_offset = (ch & 2) ? channel->offset / 2 : channel->offset;
r3957r3958
326327   }
327328
328329   /* all done, time to mix it */
329   mix_to_16(length, outputs[0], outputs[1]);
330   mix_to_16(samples, outputs[0], outputs[1]);
330331}
331332
332333
src/mame/audio/namco54.h
r3957r3958
99ADDRESS_MAP_EXTERN( namco_54xx_map_data, 8 );
1010ADDRESS_MAP_EXTERN( namco_54xx_map_io, 8 );
1111
12void namco_54xx_write(UINT8 data);
12void namco_54xx_write(running_machine *machine, UINT8 data);
1313
1414/* discrete nodes */
1515#define NAMCO_54XX_0_DATA      NODE_01
src/mame/audio/tx1.c
r3957r3958
66
77#include "driver.h"
88#include "streams.h"
9#include "deprecat.h"
109#include "includes/tx1.h"
1110#include "video/resnet.h"
1211#include "sound/custom.h"
r3957r3958
211210}
212211
213212
214static void tx1_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
213static STREAM_UPDATE( tx1_stream_update )
215214{
216215   UINT32 step_0, step_1, step_2;
217216   double gain_0, gain_1, gain_2, gain_3;
218217
219   stream_sample_t *fl = &buffer[0][0];
220   stream_sample_t *fr = &buffer[1][0];
218   stream_sample_t *fl = &outputs[0][0];
219   stream_sample_t *fr = &outputs[1][0];
221220
222221   static stream_sample_t pit0 = 0;
223222   static stream_sample_t pit1 = 0;
224223   static stream_sample_t pit2 = 0;
225224
226225   /* Clear the buffers */
227   memset(buffer[0], 0, length * sizeof(*buffer[0]));
228   memset(buffer[1], 0, length * sizeof(*buffer[1]));
226   memset(outputs[0], 0, samples * sizeof(*outputs[0]));
227   memset(outputs[1], 0, samples * sizeof(*outputs[1]));
229228
230229   /* 8253 outputs for the player/opponent engine sounds. */
231230   step_0 = pit8253.counts[0].val ? (TX1_PIT_CLOCK / pit8253.counts[0].val) * freq_to_step : 0;
r3957r3958
237236   gain_2 = tx1_engine_gains[ay_outputb & 0xf];
238237   gain_3 = BIT(ay_outputb, 5) ? 1.0f : 1.5f;
239238
240   while (length--)
239   while (samples--)
241240   {
242241      if (step0 & ((1 << TX1_FRAC)))
243242      {
r3957r3958
417416}
418417
419418/* This is admittedly a bit of a hack job... */
420static void buggyboy_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
419static STREAM_UPDATE( buggyboy_stream_update )
421420{
422421   UINT32 step_0, step_1;
423422   int n1_en, n2_en;
424423   double gain0, gain1_l, gain1_r;
425424
426   stream_sample_t *fl = &buffer[0][0];
427   stream_sample_t *fr = &buffer[1][0];
425   stream_sample_t *fl = &outputs[0][0];
426   stream_sample_t *fr = &outputs[1][0];
428427
429428   /* Clear the buffers */
430   memset(buffer[0], 0, length * sizeof(*buffer[0]));
431   memset(buffer[1], 0, length * sizeof(*buffer[1]));
429   memset(outputs[0], 0, samples * sizeof(*outputs[0]));
430   memset(outputs[1], 0, samples * sizeof(*outputs[1]));
432431
433432   /* 8253 outputs for the player/opponent buggy engine sounds. */
434433   step_0 = pit8253.counts[0].val ? (BUGGYBOY_PIT_CLOCK / pit8253.counts[0].val) * freq_to_step : 0;
r3957r3958
441440   gain1_l = bb_engine_gains[ym_outputa >> 4] * 5;
442441   gain1_r = bb_engine_gains[ym_outputa & 0xf] * 5;
443442
444   while (length--)
443   while (samples--)
445444   {
446445      int i;
447446      stream_sample_t pit0, pit1, n1, n2;
r3957r3958
449448      pit1 = buggyboy_eng_voltages[(step1 >> 24) & 0xf];
450449
451450      /* Calculate the tyre screech noise source */
452      for (i = 0; i < BUGGYBOY_NOISE_CLOCK / Machine->sample_rate; ++i)
451      for (i = 0; i < BUGGYBOY_NOISE_CLOCK / device->machine->sample_rate; ++i)
453452      {
454453         /* CD4006 is a 4-4-1-4-4-1 shift register */
455454         int p13 = BIT(noise_lfsra, 3);
src/mame/audio/bzone.c
r3957r3958
6767    sound_global_enable(latch & 0x20);
6868}
6969
70static void bzone_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
70static STREAM_UPDATE( bzone_sound_update )
7171{
7272   stream_sample_t *buffer = outputs[0];
73   while( length-- )
73   while( samples-- )
7474   {
7575      static int last_val = 0;
7676      int sum = 0;
src/mame/audio/mcr.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
11#include "audio/mcr.h"
12#include "audio/williams.h"
10#include "cpu/z80/z80.h"
11#include "cpu/m68000/m68000.h"
1312#include "cpu/m6800/m6800.h"
1413#include "cpu/m6809/m6809.h"
1514#include "sound/5220intf.h"
1615#include "sound/ay8910.h"
1716#include "sound/dac.h"
17#include "audio/williams.h"
1818#include "includes/mcr.h"
1919#include "audio/mcr.h"
2020
r3957r3958
9999 *
100100 *************************************/
101101
102static void ssio_compute_ay8910_modulation(void);
102static void ssio_compute_ay8910_modulation(running_machine *machine);
103103
104104
105105
r3957r3958
120120   if (mcr_sound_config & MCR_SSIO)
121121   {
122122      ssio_sound_cpu = sound_cpu++;
123      ssio_compute_ay8910_modulation();
123      ssio_compute_ay8910_modulation(machine);
124124      state_save_register_global_array(machine, ssio_data);
125125      state_save_register_global(machine, ssio_status);
126126      state_save_register_global(machine, ssio_14024_count);
r3957r3958
170170   /* Advanced Audio */
171171   if (mcr_sound_config & MCR_WILLIAMS_SOUND)
172172   {
173      williams_cvsd_init(0);
173      williams_cvsd_init(machine, 0);
174174      sound_cpu++;
175175      dac_index++;
176176   }
177177}
178178
179179
180void mcr_sound_reset(void)
180void mcr_sound_reset(running_machine *machine)
181181{
182182   /* SSIO */
183183   if (mcr_sound_config & MCR_SSIO)
184184   {
185      ssio_reset_w(1);
186      ssio_reset_w(0);
185      ssio_reset_w(machine, 1);
186      ssio_reset_w(machine, 0);
187187   }
188188
189189   /* Turbo Chip Squeak */
190190   if (mcr_sound_config & MCR_TURBO_CHIP_SQUEAK)
191191   {
192      turbocs_reset_w(1);
193      turbocs_reset_w(0);
192      turbocs_reset_w(machine, 1);
193      turbocs_reset_w(machine, 0);
194194   }
195195
196196   /* Chip Squeak Deluxe */
197197   if (mcr_sound_config & MCR_CHIP_SQUEAK_DELUXE)
198198   {
199      csdeluxe_reset_w(1);
200      csdeluxe_reset_w(0);
199      csdeluxe_reset_w(machine, 1);
200      csdeluxe_reset_w(machine, 0);
201201   }
202202
203203   /* Sounds Good */
204204   if (mcr_sound_config & MCR_SOUNDS_GOOD)
205205   {
206      soundsgood_reset_w(1);
207      soundsgood_reset_w(0);
206      soundsgood_reset_w(machine, 1);
207      soundsgood_reset_w(machine, 0);
208208   }
209209
210210   /* Squawk n Talk */
211211   if (mcr_sound_config & MCR_SQUAWK_N_TALK)
212212   {
213      squawkntalk_reset_w(1);
214      squawkntalk_reset_w(0);
213      squawkntalk_reset_w(machine, 1);
214      squawkntalk_reset_w(machine, 0);
215215   }
216216
217217   /* Advanced Audio */
r3957r3958
267267        frequency of sound output. So we simply apply a volume
268268        adjustment to each voice according to the duty cycle.
269269*/
270static void ssio_compute_ay8910_modulation(void)
270static void ssio_compute_ay8910_modulation(running_machine *machine)
271271{
272   UINT8 *prom = memory_region(Machine, "proms");
272   UINT8 *prom = memory_region(machine, "proms");
273273   int volval;
274274
275275   /* loop over all possible values of the duty cycle */
r3957r3958
391391   return ssio_status;
392392}
393393
394void ssio_reset_w(int state)
394void ssio_reset_w(running_machine *machine, int state)
395395{
396396   /* going high halts the CPU */
397397   if (state)
398398   {
399399      int i;
400400
401      cpu_set_input_line(Machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, ASSERT_LINE);
401      cpu_set_input_line(machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, ASSERT_LINE);
402402
403403      /* latches also get reset */
404404      for (i = 0; i < 4; i++)
r3957r3958
408408   }
409409   /* going low resets and reactivates the CPU */
410410   else
411      cpu_set_input_line(Machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, CLEAR_LINE);
411      cpu_set_input_line(machine->cpu[ssio_sound_cpu], INPUT_LINE_RESET, CLEAR_LINE);
412412}
413413
414414READ8_HANDLER( ssio_input_port_r )
r3957r3958
581581   return csdeluxe_status;
582582}
583583
584void csdeluxe_reset_w(int state)
584void csdeluxe_reset_w(running_machine *machine, int state)
585585{
586   cpu_set_input_line(Machine->cpu[csdeluxe_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
586   cpu_set_input_line(machine->cpu[csdeluxe_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
587587}
588588
589589
r3957r3958
686686   return soundsgood_status;
687687}
688688
689void soundsgood_reset_w(int state)
689void soundsgood_reset_w(running_machine *machine, int state)
690690{
691691//if (state) mame_printf_debug("SG Reset\n");
692   cpu_set_input_line(Machine->cpu[soundsgood_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
692   cpu_set_input_line(machine->cpu[soundsgood_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
693693}
694694
695695
r3957r3958
782782   return turbocs_status;
783783}
784784
785void turbocs_reset_w(int state)
785void turbocs_reset_w(running_machine *machine, int state)
786786{
787   cpu_set_input_line(Machine->cpu[turbocs_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
787   cpu_set_input_line(machine->cpu[turbocs_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
788788}
789789
790790
r3957r3958
908908   timer_call_after_resynch(space->machine, NULL, data, squawkntalk_delayed_data_w);
909909}
910910
911void squawkntalk_reset_w(int state)
911void squawkntalk_reset_w(running_machine *machine, int state)
912912{
913   cpu_set_input_line(Machine->cpu[squawkntalk_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
913   cpu_set_input_line(machine->cpu[squawkntalk_sound_cpu], INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
914914}
915915
916916
src/mame/audio/segasnd.c
r3957r3958
1111
1212#include "driver.h"
1313#include "streams.h"
14#include "deprecat.h"
1514#include "segag80v.h"
1615#include "cpu/mcs48/mcs48.h"
1716#include "sound/sp0250.h"
r3957r3958
311310}
312311
313312
314void sega_usb_reset(UINT8 t1_clock_mask)
313void sega_usb_reset(running_machine *machine, UINT8 t1_clock_mask)
315314{
316315   /* halt the USB CPU at reset time */
317316   cpu_set_input_line(usb.cpu, INPUT_LINE_RESET, ASSERT_LINE);
318317
319318   /* start the clock timer */
320   timer_pulse(Machine, attotime_mul(ATTOTIME_IN_HZ(USB_2MHZ_CLOCK), 256), NULL, 0, increment_t1_clock);
319   timer_pulse(machine, attotime_mul(ATTOTIME_IN_HZ(USB_2MHZ_CLOCK), 256), NULL, 0, increment_t1_clock);
321320   usb.t1_clock_mask = t1_clock_mask;
322321}
323322
r3957r3958
484483}
485484
486485
487static void usb_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
486static STREAM_UPDATE( usb_stream_update )
488487{
489488   stream_sample_t *dest = outputs[0];
490489
491490   /* iterate over samples */
492   while (length--)
491   while (samples--)
493492   {
494493      double noiseval;
495494      double sample = 0;
src/mame/audio/taitosnd.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "cpu/z80/z80.h"
43#include "taitosnd.h"
54
r3957r3958
4140static struct TC0140SYT tc0140syt;
4241
4342
44static void Interrupt_Controller(void)
43static void Interrupt_Controller(running_machine *machine)
4544{
4645   if ( tc0140syt.nmi_req && tc0140syt.nmi_enabled )
4746   {
48      cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE );
47      cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE );
4948      tc0140syt.nmi_req = 0;
5049   }
5150}
r3957r3958
208207         logerror("tc0140syt: Slave cpu written in mode [%02x] data[%02x]\n",tc0140syt.submode, data & 0xff);
209208   }
210209
211   Interrupt_Controller();
210   Interrupt_Controller(space->machine);
212211
213212}
214213
r3957r3958
250249         res = 0;
251250   }
252251
253   Interrupt_Controller();
252   Interrupt_Controller(space->machine);
254253
255254    return res;
256255}
src/mame/audio/mcr.h
r3957r3958
1313/************ Generic MCR routines ***************/
1414
1515void mcr_sound_init(running_machine *machine, UINT8 config);
16void mcr_sound_reset(void);
16void mcr_sound_reset(running_machine *machine);
1717
1818WRITE8_HANDLER( ssio_data_w );
1919READ8_HANDLER( ssio_status_r );
2020READ8_HANDLER( ssio_input_port_r );
2121WRITE8_HANDLER( ssio_output_port_w );
22void ssio_reset_w(int state);
22void ssio_reset_w(running_machine *machine, int state);
2323void ssio_set_custom_input(int which, int mask, read8_space_func handler);
2424void ssio_set_custom_output(int which, int mask, write8_space_func handler);
2525
2626WRITE8_HANDLER( csdeluxe_data_w );
2727READ8_HANDLER( csdeluxe_status_r );
28void csdeluxe_reset_w(int state);
28void csdeluxe_reset_w(running_machine *machine, int state);
2929
3030WRITE8_HANDLER( turbocs_data_w );
3131READ8_HANDLER( turbocs_status_r );
32void turbocs_reset_w(int state);
32void turbocs_reset_w(running_machine *machine, int state);
3333
3434WRITE8_HANDLER( soundsgood_data_w );
3535READ8_HANDLER( soundsgood_status_r );
36void soundsgood_reset_w(int state);
36void soundsgood_reset_w(running_machine *machine, int state);
3737
3838WRITE8_HANDLER( squawkntalk_data_w );
39void squawkntalk_reset_w(int state);
39void squawkntalk_reset_w(running_machine *machine, int state);
4040
4141
4242
src/mame/audio/segasnd.h
r3957r3958
1414MACHINE_DRIVER_EXTERN( sega_universal_sound_board );
1515MACHINE_DRIVER_EXTERN( sega_universal_sound_board_rom );
1616
17void sega_usb_reset(UINT8 t1_clock_mask);
17void sega_usb_reset(running_machine *machine, UINT8 t1_clock_mask);
1818
1919READ8_HANDLER( sega_usb_status_r );
2020WRITE8_HANDLER( sega_usb_data_w );
src/mame/audio/rockola.c
r3957r3958
1111
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "streams.h"
1615#include "sound/custom.h"
1716#include "sound/sn76477.h"
r3957r3958
394393   }
395394}
396395
397static void rockola_tone_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int len)
396static STREAM_UPDATE( rockola_tone_update )
398397{
399398   stream_sample_t *buffer = outputs[0];
400399   int i;
401400
402401   for (i = 0; i < CHANNELS; i++)
403      validate_tone_channel(Machine, i);
402      validate_tone_channel(device->machine, i);
404403
405   while (len-- > 0)
404   while (samples-- > 0)
406405   {
407406      INT32 data = 0;
408407
r3957r3958
435434            tone_channels[i].offset++;
436435            tone_channels[i].offset &= tone_channels[i].mask;
437436
438            validate_tone_channel(Machine, i);
437            validate_tone_channel(device->machine, i);
439438         }
440439
441440         if (tone_channels[0].offset == 0 && Sound0StopOnRollover)
src/mame/audio/wiping.c
r3957r3958
7878
7979
8080/* generate sound to the mix buffer in mono */
81static void wiping_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
81static STREAM_UPDATE( wiping_update_mono )
8282{
8383   stream_sample_t *buffer = outputs[0];
8484   sound_channel *voice;
r3957r3958
8888   /* if no sound, we're done */
8989   if (sound_enable == 0)
9090   {
91      memset(buffer, 0, length * sizeof(*buffer));
91      memset(buffer, 0, samples * sizeof(*buffer));
9292      return;
9393   }
9494
9595   /* zap the contents of the mixer buffer */
96   memset(mixer_buffer, 0, length * sizeof(short));
96   memset(mixer_buffer, 0, samples * sizeof(short));
9797
9898   /* loop over each voice and add its contribution */
9999   for (voice = channel_list; voice < last_channel; voice++)
r3957r3958
110110         mix = mixer_buffer;
111111
112112         /* add our contribution */
113         for (i = 0; i < length; i++)
113         for (i = 0; i < samples; i++)
114114         {
115115            int offs;
116116
r3957r3958
155155
156156   /* mix it down */
157157   mix = mixer_buffer;
158   for (i = 0; i < length; i++)
158   for (i = 0; i < samples; i++)
159159      *buffer++ = mixer_lookup[*mix++];
160160}
161161
src/mame/audio/leland.c
r3957r3958
7979
8080#include "driver.h"
8181#include "streams.h"
82#include "cpu/i86/i186intf.h"
82#include "cpu/i86/i86.h"
8383#include "cpu/z80/z80.h"
8484#include "leland.h"
8585#include "sound/custom.h"
r3957r3958
104104
105105static sound_stream * dac_stream;
106106
107static void leland_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
107static STREAM_UPDATE( leland_update )
108108{
109109   stream_sample_t *buffer = outputs[0];
110110   int dacnum;
111111
112112   /* reset the buffer */
113   memset(buffer, 0, length * sizeof(*buffer));
113   memset(buffer, 0, samples * sizeof(*buffer));
114114   for (dacnum = 0; dacnum < 2; dacnum++)
115115   {
116116      int bufout = dac_bufout[dacnum];
r3957r3958
121121         UINT8 *base = dac_buffer[dacnum];
122122         int i;
123123
124         for (i = 0; i < length && count > 0; i++, count--)
124         for (i = 0; i < samples && count > 0; i++, count--)
125125         {
126126            buffer[i] += ((INT16)base[bufout] - 0x80) * 0x40;
127127            bufout = (bufout + 1) & DAC_BUFFER_MASK;
r3957r3958
304304 *
305305 *************************************/
306306
307static void leland_80186_dac_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
307static STREAM_UPDATE( leland_80186_dac_update )
308308{
309309   stream_sample_t *buffer = outputs[0];
310310   int i, j, start, stop;
r3957r3958
312312   if (LOG_SHORTAGES) logerror("----\n");
313313
314314   /* reset the buffer */
315   memset(buffer, 0, length * sizeof(*buffer));
315   memset(buffer, 0, samples * sizeof(*buffer));
316316
317317   /* if we're redline racer, we have more DACs */
318318   if (!is_redline)
r3957r3958
335335         int step = d->step;
336336
337337         /* sample-rate convert to the output frequency */
338         for (j = 0; j < length && count > 0; j++)
338         for (j = 0; j < samples && count > 0; j++)
339339         {
340340            buffer[j] += base[source];
341341            frac += step;
r3957r3958
345345            source &= DAC_BUFFER_SIZE_MASK;
346346         }
347347
348         if (LOG_SHORTAGES && j < length)
349            logerror("DAC #%d short by %d/%d samples\n", i, length - j, length);
348         if (LOG_SHORTAGES && j < samples)
349            logerror("DAC #%d short by %d/%d samples\n", i, samples - j, samples);
350350
351351         /* update the DAC state */
352352         d->fraction = frac;
r3957r3958
367367 *
368368 *************************************/
369369
370static void leland_80186_dma_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
370static STREAM_UPDATE( leland_80186_dma_update )
371371{
372372   const address_space *dmaspace = param;
373373   stream_sample_t *buffer = outputs[0];
374374   int i, j;
375375
376376   /* reset the buffer */
377   memset(buffer, 0, length * sizeof(*buffer));
377   memset(buffer, 0, samples * sizeof(*buffer));
378378
379379   /* loop over DMA buffers */
380380   for (i = 0; i < 2; i++)
r3957r3958
416416            volume = dac[which].volume;
417417
418418            /* sample-rate convert to the output frequency */
419            for (j = 0; j < length && count > 0; j++)
419            for (j = 0; j < samples && count > 0; j++)
420420            {
421421               buffer[j] += ((int)memory_read_byte(dmaspace, source) - 0x80) * volume;
422422               frac += step;
r3957r3958
456456 *
457457 *************************************/
458458
459static void leland_80186_extern_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
459static STREAM_UPDATE( leland_80186_extern_update )
460460{
461461   stream_sample_t *buffer = outputs[0];
462462   struct dac_state *d = &dac[7];
r3957r3958
464464   int j;
465465
466466   /* reset the buffer */
467   memset(buffer, 0, length * sizeof(*buffer));
467   memset(buffer, 0, samples * sizeof(*buffer));
468468
469469   /* if we have data, process it */
470470   if (count > 0 && ext_active)
r3957r3958
474474      int step = d->step;
475475
476476      /* sample-rate convert to the output frequency */
477      for (j = 0; j < length && count > 0; j++)
477      for (j = 0; j < samples && count > 0; j++)
478478      {
479479         buffer[j] += ((INT16)ext_base[source] - 0x80) * d->volume;
480480         frac += step;
r3957r3958
617617   if (LOG_INTERRUPTS) logerror("(%f) **** Acknowledged interrupt vector %02X\n", attotime_to_double(timer_get_time(device->machine)), i80186.intr.poll_status & 0x1f);
618618
619619   /* clear the interrupt */
620   cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE);
620   device_set_info_int(device, CPUINFO_INT_INPUT_STATE + 0, CLEAR_LINE);
621621   i80186.intr.pending = 0;
622622
623623   /* clear the request and set the in-service bit */
src/mame/audio/carnival.c
r3957r3958
300300   MDRV_CPU_PROGRAM_MAP(carnival_audio_map,0)
301301   MDRV_CPU_IO_MAP(carnival_audio_io_map,0)
302302
303   MDRV_INTERLEAVE(10)
303   MDRV_QUANTUM_TIME(HZ(600))
304304
305305   MDRV_SOUND_ADD("psg", AY8910, PSG_CLOCK)
306306   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
src/mame/audio/gomoku.c
r3957r3958
7878
7979
8080/* generate sound to the mix buffer in mono */
81static void gomoku_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
81static STREAM_UPDATE( gomoku_update_mono )
8282{
8383   stream_sample_t *buffer = outputs[0];
8484   sound_channel *voice;
r3957r3958
8888   /* if no sound, we're done */
8989   if (sound_enable == 0)
9090   {
91      memset(buffer, 0, length * sizeof(*buffer));
91      memset(buffer, 0, samples * sizeof(*buffer));
9292      return;
9393   }
9494
9595   /* zap the contents of the mixer buffer */
96   memset(mixer_buffer, 0, length * sizeof(short));
96   memset(mixer_buffer, 0, samples * sizeof(short));
9797
9898   /* loop over each voice and add its contribution */
9999   for (ch = 0, voice = channel_list; voice < last_channel; ch++, voice++)
r3957r3958
115115         mix = mixer_buffer;
116116
117117         /* add our contribution */
118         for (i = 0; i < length; i++)
118         for (i = 0; i < samples; i++)
119119         {
120120            c += f;
121121
r3957r3958
156156
157157   /* mix it down */
158158   mix = mixer_buffer;
159   for (i = 0; i < length; i++)
159   for (i = 0; i < samples; i++)
160160      *buffer++ = mixer_lookup[*mix++];
161161}
162162
src/mame/audio/taito_en.c
r3957r3958
258258   sound_ram[3]=ROM[0x80003];
259259
260260   /* reset CPU to catch any banking of startup vectors */
261   cpu_reset(cputag_get_cpu(machine, "audio"));
261   device_reset(cputag_get_cpu(machine, "audio"));
262262   //cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
263263}
264264
src/mame/audio/seibu.c
r3957r3958
141141   UINT8 *base;
142142} seibu_adpcm[2];
143143
144static void seibu_adpcm_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
144static STREAM_UPDATE( seibu_adpcm_callback )
145145{
146146   struct seibu_adpcm_state *state = param;
147147   stream_sample_t *dest = outputs[0];
src/mame/audio/taito_en.h
r3957r3958
1#include "cpu/m68000/m68000.h"
12#include "sound/es5506.h"
23
34READ16_HANDLER(f3_68000_share_r);
src/mame/audio/gridlee.c
r3957r3958
4242 *
4343 *************************************/
4444
45static void gridlee_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
45static STREAM_UPDATE( gridlee_stream_update )
4646{
4747   stream_sample_t *buffer = outputs[0];
4848
4949   /* loop over samples */
50   while (length--)
50   while (samples--)
5151   {
5252      /* tone channel */
5353      tone_fraction += tone_step;
src/mame/audio/geebee.c
r3957r3958
6262    }
6363}
6464
65static void geebee_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
65static STREAM_UPDATE( geebee_sound_update )
6666{
6767    stream_sample_t *buffer = outputs[0];
6868
69    while (length--)
69    while (samples--)
7070    {
7171      *buffer++ = sound_signal;
7272      /* 1V = HSYNC = 18.432MHz / 3 / 2 / 384 = 8000Hz */
src/mame/audio/seibu.h
r3957r3958
2323
2424***************************************************************************/
2525
26#include "cpu/z80/z80.h"
2627#include "sound/3812intf.h"
2728#include "sound/2151intf.h"
2829#include "sound/2203intf.h"
src/mame/audio/tiamc1.c
r3957r3958
244244}
245245
246246
247static void tiamc1_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
247static STREAM_UPDATE( tiamc1_sound_update )
248248{
249249   int count, o0, o1, o2, len, or = 0;
250250
251   len = length * CLOCK_DIVIDER;
251   len = samples * CLOCK_DIVIDER;
252252
253253   for (count = 0; count < len; count++) {
254254      timer1_divider++;
src/mame/audio/namcoc7x.c
r3957r3958
2727*/
2828
2929#include "driver.h"
30#include "cpu/m37710/m37710.h"
3031#include "deprecat.h"
3132#include "audio/namcoc7x.h"
3233
r3957r3958
7980void namcoc7x_on_driver_init(running_machine *machine)
8081{
8182   UINT8 *pROM = (UINT8 *)memory_region(machine, "c7x");
82   int cpunum;
83   const device_config *cpu;
8384
8485   // clear the two 16-bits magic values at the start of the rom
8586   // (prevents external init routines from getting called - they assume a
r3957r3958
8788   memset(pROM, 0, 4);
8889
8990   // install speedup cheat
90   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
91      if (machine->config->cpu[cpunum].type == CPU_M37702)
92         memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w);
91   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
92      if (cpu_get_type(cpu) == CPU_M37702)
93         memory_install_readwrite16_handler(cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM), 0x82, 0x83, 0, 0, speedup_r, speedup_w);
9394}
9495
9596void namcoc7x_set_host_ram(UINT32 *hostram)
src/mame/audio/segag80r.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "streams.h"
1312#include "cpu/mcs48/mcs48.h"
1413#include "segag80r.h"
r3957r3958
340339
341340static SOUND_START( 005 );
342341static CUSTOM_START( sega005_custom_start );
343static void sega005_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
342static STREAM_UPDATE( sega005_stream_update );
344343static TIMER_CALLBACK( sega005_auto_timer );
345344static WRITE8_DEVICE_HANDLER( sega005_sound_a_w );
346345static WRITE8_DEVICE_HANDLER( sega005_sound_b_w );
r3957r3958
595594}
596595
597596
598static void sega005_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
597static STREAM_UPDATE( sega005_stream_update )
599598{
600   const UINT8 *sound_prom = memory_region(Machine, "proms");
599   const UINT8 *sound_prom = memory_region(device->machine, "proms");
601600   int i;
602601
603602   /* no implementation yet */
src/mame/audio/pleiads.c
r3957r3958
88 ****************************************************************************/
99#include "driver.h"
1010#include "streams.h"
11#include "deprecat.h"
1211#include "sound/custom.h"
1312#include "sound/tms36xx.h"
1413#include "includes/phoenix.h"
r3957r3958
397396   return sum / 2;
398397}
399398
400static void pleiads_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
399static STREAM_UPDATE( pleiads_sound_update )
401400{
402   int rate = Machine->sample_rate;
401   int rate = device->machine->sample_rate;
403402   stream_sample_t *buffer = outputs[0];
404403
405   while( length-- > 0 )
404   while( samples-- > 0 )
406405   {
407406      int sum = tone1(rate)/2 + tone23(rate)/2 + tone4(rate) + noise(rate);
408407      *buffer++ = sum < 32768 ? sum > -32768 ? sum : -32768 : 32767;
src/mame/audio/williams.c
r3957r3958
2323****************************************************************************/
2424
2525#include "driver.h"
26#include "deprecat.h"
2726#include "machine/6821pia.h"
2827#include "cpu/m6809/m6809.h"
2928#include "williams.h"
r3957r3958
259258    INITIALIZATION
260259****************************************************************************/
261260
262void williams_cvsd_init(int pianum)
261void williams_cvsd_init(running_machine *machine, int pianum)
263262{
264   running_machine *machine = Machine;
265263   UINT8 *ROM;
266264   int bank;
267265
r3957r3958
296294}
297295
298296
299void williams_narc_init(void)
297void williams_narc_init(running_machine *machine)
300298{
301299   UINT8 *ROM;
302300   int bank;
303301
304302   /* configure the CPU */
305   sound_cpu = cputag_get_cpu(Machine, "narc1");
306   soundalt_cpu = cputag_get_cpu(Machine, "narc2");
303   sound_cpu = cputag_get_cpu(machine, "narc1");
304   soundalt_cpu = cputag_get_cpu(machine, "narc2");
307305
308306   /* configure master CPU banks */
309   ROM = memory_region(Machine, "narc1");
307   ROM = memory_region(machine, "narc1");
310308   for (bank = 0; bank < 16; bank++)
311309   {
312310      /*
r3957r3958
315313            D3 -> A16
316314         */
317315      offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
318      memory_configure_bank(Machine, 5, bank, 1, &ROM[0x10000 + offset], 0);
316      memory_configure_bank(machine, 5, bank, 1, &ROM[0x10000 + offset], 0);
319317   }
320   memory_set_bankptr(sound_cpu->machine, 6, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
318   memory_set_bankptr(machine, 6, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
321319
322320   /* configure slave CPU banks */
323   ROM = memory_region(Machine, "narc2");
321   ROM = memory_region(machine, "narc2");
324322   for (bank = 0; bank < 16; bank++)
325323   {
326324      /*
r3957r3958
329327            D3 -> A16
330328        */
331329      offs_t offset = 0x8000 * (bank & 1) + 0x10000 * ((bank >> 3) & 1) + 0x20000 * ((bank >> 1) & 3);
332      memory_configure_bank(Machine, 7, bank, 1, &ROM[0x10000 + offset], 0);
330      memory_configure_bank(machine, 7, bank, 1, &ROM[0x10000 + offset], 0);
333331   }
334   memory_set_bankptr(sound_cpu->machine, 8, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
332   memory_set_bankptr(machine, 8, &ROM[0x10000 + 0x4000 + 0x8000 + 0x10000 + 0x20000 * 3]);
335333
336334   /* register for save states */
337   state_save_register_global(sound_cpu->machine, williams_sound_int_state);
338   state_save_register_global(sound_cpu->machine, audio_talkback);
339   state_save_register_global(sound_cpu->machine, audio_sync);
335   state_save_register_global(machine, williams_sound_int_state);
336   state_save_register_global(machine, audio_talkback);
337   state_save_register_global(machine, audio_sync);
340338}
341339
342340
343void williams_adpcm_init(void)
341void williams_adpcm_init(running_machine *machine)
344342{
345343   UINT8 *ROM;
346344
347345   /* configure the CPU */
348   sound_cpu = cputag_get_cpu(Machine, "adpcm");
346   sound_cpu = cputag_get_cpu(machine, "adpcm");
349347   soundalt_cpu = NULL;
350348
351349   /* configure banks */
352   ROM = memory_region(Machine, "adpcm");
353   memory_configure_bank(Machine, 5, 0, 8, &ROM[0x10000], 0x8000);
354   memory_set_bankptr(sound_cpu->machine, 6, &ROM[0x10000 + 0x4000 + 7 * 0x8000]);
350   ROM = memory_region(machine, "adpcm");
351   memory_configure_bank(machine, 5, 0, 8, &ROM[0x10000], 0x8000);
352   memory_set_bankptr(machine, 6, &ROM[0x10000 + 0x4000 + 7 * 0x8000]);
355353
356354   /* expand ADPCM data */
357355   /* it is assumed that U12 is loaded @ 0x00000 and U13 is loaded @ 0x40000 */
358   ROM = memory_region(Machine, "oki");
356   ROM = memory_region(machine, "oki");
359357   memcpy(ROM + 0x1c0000, ROM + 0x080000, 0x20000);   /* expand individual banks */
360358   memcpy(ROM + 0x180000, ROM + 0x0a0000, 0x20000);
361359   memcpy(ROM + 0x140000, ROM + 0x0c0000, 0x20000);
r3957r3958
373371   memcpy(ROM + 0x020000, ROM + 0x060000, 0x20000);
374372
375373   /* register for save states */
376   state_save_register_global(sound_cpu->machine, williams_sound_int_state);
377   state_save_register_global(sound_cpu->machine, audio_talkback);
374   state_save_register_global(machine, williams_sound_int_state);
375   state_save_register_global(machine, audio_talkback);
378376}
379377
380378
r3957r3958
477475}
478476
479477
480void williams_cvsd_data_w(int data)
478void williams_cvsd_data_w(running_machine *machine, int data)
481479{
482   timer_call_after_resynch(Machine, NULL, data, williams_cvsd_delayed_data_w);
480   timer_call_after_resynch(machine, NULL, data, williams_cvsd_delayed_data_w);
483481}
484482
485483
src/mame/audio/williams.h
r3957r3958
88MACHINE_DRIVER_EXTERN( williams_adpcm_sound );
99MACHINE_DRIVER_EXTERN( williams_narc_sound );
1010
11void williams_cvsd_init(int pianum);
12void williams_cvsd_data_w(int data);
11void williams_cvsd_init(running_machine *machine, int pianum);
12void williams_cvsd_data_w(running_machine *machine, int data);
1313void williams_cvsd_reset_w(int state);
1414
15void williams_adpcm_init(void);
15void williams_adpcm_init(running_machine *machine);
1616void williams_adpcm_data_w(int data);
1717void williams_adpcm_reset_w(int state);
1818int williams_adpcm_sound_irq_r(void);
1919
20void williams_narc_init(void);
20void williams_narc_init(running_machine *machine);
2121void williams_narc_data_w(int data);
2222void williams_narc_reset_w(int state);
2323int williams_narc_talkback_r(void);
src/mame/audio/scramble.c
r3957r3958
1212***************************************************************************/
1313
1414#include "driver.h"
15#include "deprecat.h"
1615#include "cpu/z80/z80.h"
1716#include "machine/7474.h"
1817#include "sound/flt_rc.h"
r3957r3958
8483{
8584   /* the complement of bit 3 is connected to the flip-flop's clock */
8685   TTL7474_clock_w(2, ~data & 0x08);
87   TTL7474_update(2);
86   TTL7474_update(device->machine, 2);
8887
8988   /* bit 4 is sound disable */
9089   sound_global_enable(~data & 0x10);
r3957r3958
9493{
9594   /* bit 1 is connected to the flip-flop's clock */
9695   TTL7474_clock_w(3, data & 0x01);
97   TTL7474_update(3);
96   TTL7474_update(space->machine, 3);
9897}
9998
10099WRITE8_DEVICE_HANDLER( mrkougar_sh_irqtrigger_w )
101100{
102101   /* the complement of bit 3 is connected to the flip-flop's clock */
103102   TTL7474_clock_w(2, ~data & 0x08);
104   TTL7474_update(2);
103   TTL7474_update(device->machine, 2);
105104}
106105
107106WRITE8_HANDLER( froggrmc_sh_irqtrigger_w )
108107{
109108   /* the complement of bit 0 is connected to the flip-flop's clock */
110109   TTL7474_clock_w(2, ~data & 0x01);
111   TTL7474_update(2);
110   TTL7474_update(space->machine, 2);
112111}
113112
114113
r3957r3958
118117       we need to pulse the CLR line because MAME's core never clears this
119118       line, only asserts it */
120119   TTL7474_clear_w(2, 0);
121   TTL7474_update(2);
120   TTL7474_update(device->machine, 2);
122121
123122   TTL7474_clear_w(2, 1);
124   TTL7474_update(2);
123   TTL7474_update(device->machine, 2);
125124
126125   return 0xff;
127126}
r3957r3958
132131       we need to pulse the CLR line because MAME's core never clears this
133132       line, only asserts it */
134133   TTL7474_clear_w(3, 0);
135   TTL7474_update(3);
134   TTL7474_update(device->machine, 3);
136135
137136   TTL7474_clear_w(3, 1);
138   TTL7474_update(3);
137   TTL7474_update(device->machine, 3);
139138
140139   return 0xff;
141140}
142141
143142
144static void scramble_sh_7474_callback(void)
143static void scramble_sh_7474_callback(running_machine *machine)
145144{
146145   /* the Q bar is connected to the Z80's INT line.  But since INT is complemented, */
147146   /* we need to complement Q bar */
148   cpu_set_input_line(Machine->cpu[1], 0, !TTL7474_output_comp_r(2) ? ASSERT_LINE : CLEAR_LINE);
147   cpu_set_input_line(machine->cpu[1], 0, !TTL7474_output_comp_r(2) ? ASSERT_LINE : CLEAR_LINE);
149148}
150149
151static void sfx_sh_7474_callback(void)
150static void sfx_sh_7474_callback(running_machine *machine)
152151{
153152   /* the Q bar is connected to the Z80's INT line.  But since INT is complemented, */
154153   /* we need to complement Q bar */
155   cpu_set_input_line(Machine->cpu[2], 0, !TTL7474_output_comp_r(3) ? ASSERT_LINE : CLEAR_LINE);
154   cpu_set_input_line(machine->cpu[2], 0, !TTL7474_output_comp_r(3) ? ASSERT_LINE : CLEAR_LINE);
156155}
157156
158157WRITE8_HANDLER( hotshock_sh_irqtrigger_w )
r3957r3958
209208};
210209
211210
212void scramble_sh_init(void)
211void scramble_sh_init(running_machine *machine)
213212{
214   running_machine *machine = Machine;
215213   cpu_set_irq_callback(machine->cpu[1], scramble_sh_irq_callback);
216214
217215   TTL7474_config(machine, 2, &scramble_sh_7474_intf);
r3957r3958
220218   TTL7474_d_w(2, 1);
221219}
222220
223void sfx_sh_init(void)
221void sfx_sh_init(running_machine *machine)
224222{
225   running_machine *machine = Machine;
226223   cpu_set_irq_callback(machine->cpu[2], sfx_sh_irq_callback);
227224
228225   TTL7474_config(machine, 3, &sfx_sh_7474_intf);
r3957r3958
338335      timer_set(machine, ATTOTIME_IN_HZ(AD2083_TMS5110_CLOCK / 2),NULL,1,ad2083_step);
339336}
340337
341static int ad2083_speech_rom_read_bit(void)
338static int ad2083_speech_rom_read_bit(const device_config *device)
342339{
343   UINT8 *ROM = memory_region(Machine, "tms5110");
340   UINT8 *ROM = memory_region(device->machine, "tms5110");
344341   int bit;
345342
346343   speech_rom_address %= 4096;
src/mame/audio/flower.c
r3957r3958
7777
7878
7979/* generate sound to the mix buffer in mono */
80static void flower_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
80static STREAM_UPDATE( flower_update_mono )
8181{
8282   stream_sample_t *buffer = outputs[0];
8383   sound_channel *voice;
r3957r3958
8787   /* if no sound, we're done */
8888   if (sound_enable == 0)
8989   {
90      memset(buffer, 0, length * sizeof(*buffer));
90      memset(buffer, 0, samples * sizeof(*buffer));
9191      return;
9292   }
9393
9494   /* zap the contents of the mixer buffer */
95   memset(mixer_buffer, 0, length * sizeof(short));
95   memset(mixer_buffer, 0, samples * sizeof(short));
9696
9797   /* loop over each voice and add its contribution */
9898   for (voice = channel_list; voice < last_channel; voice++)
r3957r3958
109109         mix = mixer_buffer;
110110
111111         /* add our contribution */
112         for (i = 0; i < length; i++)
112         for (i = 0; i < samples; i++)
113113         {
114114            int offs;
115115
r3957r3958
148148
149149   /* mix it down */
150150   mix = mixer_buffer;
151   for (i = 0; i < length; i++)
151   for (i = 0; i < samples; i++)
152152      *buffer++ = mixer_lookup[*mix++];
153153}
154154
src/mame/audio/redalert.c
r3957r3958
88****************************************************************************/
99
1010#include "driver.h"
11#include "cpu/m6800/m6800.h"
12#include "cpu/m6502/m6502.h"
1113#include "machine/rescap.h"
1214#include "cpu/i8085/i8085.h"
1315#include "machine/6821pia.h"
r3957r3958
181183}
182184
183185
184static SOUND_START( redalert_voice )
186static const i8085_config redalert_voice_i8085_config =
185187{
186   i8085_set_sod_callback(machine->cpu[2], sod_callback);
187   i8085_set_sid_callback(machine->cpu[2], sid_callback);
188}
188   NULL,            /* INTE changed callback */
189   NULL,            /* STATUS changed callback */
190   sod_callback,      /* SOD changed callback (8085A only) */
191   sid_callback      /* SID changed callback (8085A only) */
192};
189193
190194
191195static ADDRESS_MAP_START( redalert_voice_map, ADDRESS_SPACE_PROGRAM, 8 )
r3957r3958
206210static SOUND_START( redalert )
207211{
208212   SOUND_START_CALL(redalert_audio);
209   SOUND_START_CALL(redalert_voice);
210213}
211214
212215
r3957r3958
240243static MACHINE_DRIVER_START( redalert_audio_voice )
241244
242245   MDRV_CPU_ADD("voice", 8085A, REDALERT_VOICE_CPU_CLOCK)
246   MDRV_CPU_CONFIG(redalert_voice_i8085_config)
243247   MDRV_CPU_PROGRAM_MAP(redalert_voice_map,0)
244248
245249   MDRV_SOUND_ADD("cvsd", HC55516, REDALERT_HC55516_CLOCK)
src/mame/audio/mario.c
r3957r3958
11#include "driver.h"
2#include "cpu/z80/z80.h"
23#include "cpu/mcs48/mcs48.h"
34#include "sound/dac.h"
45#include "sound/ay8910.h"
r3957r3958
264265#endif
265266
266267   state->eabank = 0;
267   if (audiocpu != NULL && ((const cpu_class_header *)audiocpu->classtoken)->cputype != CPU_Z80)
268   if (audiocpu != NULL && cpu_get_type(audiocpu) != CPU_Z80)
268269   {
269270      state->eabank = 1;
270271      memory_install_read8_handler(cpu_get_address_space(audiocpu, ADDRESS_SPACE_PROGRAM), 0x000, 0x7ff, 0, 0, SMH_BANK1);
src/mame/audio/gottlieb.c
r3957r3958
66***************************************************************************/
77
88#include "driver.h"
9#include "deprecat.h"
109#include "cpu/m6502/m6502.h"
1110#include "machine/6532riot.h"
1211#include "sound/samples.h"
r3957r3958
200199
201200
202201#ifdef UNUSED_FUNCTION
203void gottlieb_knocker(void)
202void gottlieb_knocker(running_machine *machine)
204203{
205   if (!strcmp(Machine->gamedrv->name,"reactor"))   /* reactor */
204   if (!strcmp(machine->gamedrv->name,"reactor"))   /* reactor */
206205   {
207206   }
208207   else if (sndti_exists(SOUND_SAMPLES, 0))   /* qbert */
src/mame/audio/dcs.c
r3957r3958
150150****************************************************************************/
151151
152152#include "driver.h"
153#include "deprecat.h"
154153#include "cpu/adsp2100/adsp2100.h"
155154#include "dcs.h"
156155#include "sound/dmadac.h"
r3957r3958
319318   UINT8      last_output_full;
320319   UINT8      last_input_empty;
321320   UINT16       progflags;
322   void      (*output_full_cb)(int);
323   void      (*input_empty_cb)(int);
321   void      (*output_full_cb)(running_machine *, int);
322   void      (*input_empty_cb)(running_machine *, int);
324323   UINT16      (*fifo_data_r)(const device_config *device);
325324   UINT16      (*fifo_status_r)(const device_config *device);
326325
r3957r3958
373372
374373
375374
376
377375/*************************************
378376 *
379377 *  Prototypes
r3957r3958
586584
587585/*************************************
588586 *
587 *  CPU configuration
588 *
589 *************************************/
590
591static const adsp21xx_config adsp_config =
592{
593   NULL,               /* callback for serial receive */
594   sound_tx_callback,      /* callback for serial transmit */
595   timer_enable_callback   /* callback for timer fired */
596};
597
598
599
600/*************************************
601 *
589602 *  Original DCS Machine Drivers
590603 *
591604 *************************************/
r3957r3958
593606/* Basic DCS system with ADSP-2105 and 2k of SRAM (T-unit, V-unit, Killer Instinct) */
594607MACHINE_DRIVER_START( dcs_audio_2k )
595608   MDRV_CPU_ADD("dcs", ADSP2105, XTAL_10MHz)
609   MDRV_CPU_CONFIG(adsp_config)
596610   MDRV_CPU_PROGRAM_MAP(dcs_2k_program_map,0)
597611   MDRV_CPU_DATA_MAP(dcs_2k_data_map,0)
598612
r3957r3958
631645
632646MACHINE_DRIVER_START( dcs2_audio_2115 )
633647   MDRV_CPU_ADD("dcs2", ADSP2115, XTAL_16MHz)
648   MDRV_CPU_CONFIG(adsp_config)
634649   MDRV_CPU_PROGRAM_MAP(dcs2_2115_program_map,0)
635650   MDRV_CPU_DATA_MAP(dcs2_2115_data_map,0)
636651
r3957r3958
661676
662677MACHINE_DRIVER_START( dcs2_audio_dsio )
663678   MDRV_CPU_ADD("dsio", ADSP2181, XTAL_32MHz)
679   MDRV_CPU_CONFIG(adsp_config)
664680   MDRV_CPU_PROGRAM_MAP(dsio_program_map,0)
665681   MDRV_CPU_DATA_MAP(dsio_data_map,0)
666682   MDRV_CPU_IO_MAP(dsio_io_map,0)
r3957r3958
684700
685701MACHINE_DRIVER_START( dcs2_audio_denver )
686702   MDRV_CPU_ADD("denver", ADSP2181, XTAL_33_333MHz)
703   MDRV_CPU_CONFIG(adsp_config)
687704   MDRV_CPU_PROGRAM_MAP(denver_program_map,0)
688705   MDRV_CPU_DATA_MAP(denver_data_map,0)
689706   MDRV_CPU_IO_MAP(denver_io_map,0)
r3957r3958
824841   SET_INPUT_EMPTY();
825842   SET_OUTPUT_EMPTY();
826843   if (!dcs.last_input_empty && dcs.input_empty_cb)
827      (*dcs.input_empty_cb)(dcs.last_input_empty = 1);
844      (*dcs.input_empty_cb)(machine, dcs.last_input_empty = 1);
828845   if (dcs.last_output_full && dcs.output_full_cb)
829      (*dcs.output_full_cb)(dcs.last_output_full = 0);
846      (*dcs.output_full_cb)(machine, dcs.last_output_full = 0);
830847
831848   /* boot */
832849   dcs_boot();
r3957r3958
905922      state_save_register_postload(machine, sdrc_postload, NULL);
906923}
907924
908
909925void dcs_init(running_machine *machine)
910926{
911927   memset(&dcs, 0, sizeof(dcs));
r3957r3958
918934   dcs.rev = 1;
919935   dcs.channels = 1;
920936
921   /* initialize the ADSP Tx and timer callbacks */
922   adsp21xx_set_tx_handler(dcs.cpu, sound_tx_callback);
923   adsp21xx_set_timer_handler(dcs.cpu, timer_enable_callback);
924
925937   /* configure boot and sound ROMs */
926938   dcs.bootrom = (UINT16 *)memory_region(machine, "dcs");
927939   dcs.bootrom_words = memory_region_length(machine, "dcs") / 2;
r3957r3958
971983   dcs.data = cpu_get_address_space(dcs.cpu, ADDRESS_SPACE_DATA);
972984   dcs.channels = 2;
973985
974   /* initialize the ADSP Tx and timer callbacks */
975   adsp21xx_set_tx_handler(dcs.cpu, sound_tx_callback);
976   adsp21xx_set_timer_handler(dcs.cpu, timer_enable_callback);
977
978986   /* always boot from the base of "dcs" */
979987   dcs.bootrom = (UINT16 *)memory_region(machine, "dcs");
980988   dcs.bootrom_words = memory_region_length(machine, "dcs") / 2;
r3957r3958
10681076 *
10691077 *************************************/
10701078
1071INLINE void sdrc_update_bank_pointers(void)
1079INLINE void sdrc_update_bank_pointers(running_machine *machine)
10721080{
10731081   if (SDRC_SM_EN != 0)
10741082   {
r3957r3958
10791087      {
10801088         /* ROM-based; use the memory page to select from ROM */
10811089         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1082            memory_set_bankptr(Machine, 25, &dcs.sounddata[(SDRC_EPM_PG * pagesize) % dcs.sounddata_words]);
1090            memory_set_bankptr(machine, 25, &dcs.sounddata[(SDRC_EPM_PG * pagesize) % dcs.sounddata_words]);
10831091      }
10841092      else
10851093      {
10861094         /* RAM-based; use the ROM page to select from ROM, and the memory page to select from RAM */
10871095         if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
1088            memory_set_bankptr(Machine, 25, &dcs.bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % dcs.bootrom_words]);
1096            memory_set_bankptr(machine, 25, &dcs.bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % dcs.bootrom_words]);
10891097         if (SDRC_DM_ST != 0)
1090            memory_set_bankptr(Machine, 26, &dcs.sounddata[(SDRC_DM_PG * 1024) % dcs.sounddata_words]);
1098            memory_set_bankptr(machine, 26, &dcs.sounddata[(SDRC_DM_PG * 1024) % dcs.sounddata_words]);
10911099      }
10921100   }
10931101}
r3957r3958
11481156   }
11491157
11501158   /* update the bank pointers */
1151   sdrc_update_bank_pointers();
1159   sdrc_update_bank_pointers(machine);
11521160}
11531161
11541162
r3957r3958
12321240         if (diff & 0x1833)
12331241            sdrc_remap_memory(space->machine);
12341242         if (diff & 0x0380)
1235            sdrc_update_bank_pointers();
1243            sdrc_update_bank_pointers(space->machine);
12361244         break;
12371245
12381246      /* offset 1 controls RAM mapping */
r3957r3958
12471255      case 2:
12481256         sdrc.reg[2] = data;
12491257         if (diff & 0x1fff)
1250            sdrc_update_bank_pointers();
1258            sdrc_update_bank_pointers(space->machine);
12511259         break;
12521260
12531261      /* offset 3 controls security */
r3957r3958
14581466    DCS COMMUNICATIONS
14591467****************************************************************************/
14601468
1461void dcs_set_io_callbacks(void (*output_full_cb)(int), void (*input_empty_cb)(int))
1469void dcs_set_io_callbacks(void (*output_full_cb)(running_machine *, int), void (*input_empty_cb)(running_machine *, int))
14621470{
14631471   dcs.input_empty_cb = input_empty_cb;
14641472   dcs.output_full_cb = output_full_cb;
r3957r3958
14761484{
14771485   /* only boost for DCS2 boards */
14781486   if (!dcs.auto_ack && !transfer.hle_enabled)
1479      cpuexec_boost_interleave(Machine, ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
1487      cpuexec_boost_interleave(dcs.cpu->machine, ATTOTIME_IN_NSEC(500), ATTOTIME_IN_USEC(5));
14801488   return dcs.latch_control;
14811489}
14821490
r3957r3958
14861494   /* going high halts the CPU */
14871495   if (state)
14881496   {
1489      logerror("%s: DCS reset = %d\n", cpuexec_describe_context(Machine), state);
1497      logerror("%s: DCS reset = %d\n", cpuexec_describe_context(dcs.cpu->machine), state);
14901498
14911499      /* just run through the init code again */
1492      timer_call_after_resynch(Machine, NULL, 0, dcs_reset);
1500      timer_call_after_resynch(dcs.cpu->machine, NULL, 0, dcs_reset);
14931501      cpu_set_input_line(dcs.cpu, INPUT_LINE_RESET, ASSERT_LINE);
14941502   }
14951503
r3957r3958
15411549
15421550   /* indicate we are no longer empty */
15431551   if (dcs.last_input_empty && dcs.input_empty_cb)
1544      (*dcs.input_empty_cb)(dcs.last_input_empty = 0);
1552      (*dcs.input_empty_cb)(machine, dcs.last_input_empty = 0);
15451553   SET_INPUT_FULL();
15461554
15471555   /* set the data */
r3957r3958
15581566void dcs_data_w(int data)
15591567{
15601568   /* preprocess the write */
1561   if (preprocess_write(Machine, data))
1569   if (preprocess_write(dcs.cpu->machine, data))
15621570      return;
15631571
15641572   /* if we are DCS1, set a timer to latch the data */
15651573   if (!dcs.sport_timer)
1566      timer_call_after_resynch(Machine, NULL, data, dcs_delayed_data_w_callback);
1574      timer_call_after_resynch(dcs.cpu->machine, NULL, data, dcs_delayed_data_w_callback);
15671575   else
1568       dcs_delayed_data_w(Machine, data);
1576       dcs_delayed_data_w(dcs.cpu->machine, data);
15691577}
15701578
15711579
15721580static WRITE16_HANDLER( input_latch_ack_w )
15731581{
15741582   if (!dcs.last_input_empty && dcs.input_empty_cb)
1575      (*dcs.input_empty_cb)(dcs.last_input_empty = 1);
1583      (*dcs.input_empty_cb)(space->machine, dcs.last_input_empty = 1);
15761584   SET_INPUT_EMPTY();
15771585   cpu_set_input_line(dcs.cpu, ADSP2105_IRQ2, CLEAR_LINE);
15781586}
r3957r3958
15961604static TIMER_CALLBACK( latch_delayed_w )
15971605{
15981606   if (!dcs.last_output_full && dcs.output_full_cb)
1599      (*dcs.output_full_cb)(dcs.last_output_full = 1);
1607      (*dcs.output_full_cb)(machine, dcs.last_output_full = 1);
16001608   SET_OUTPUT_FULL();
16011609   dcs.output_data = param;
16021610}
r3957r3958
16241632
16251633void dcs_ack_w(void)
16261634{
1627   timer_call_after_resynch(Machine, NULL, 0, delayed_ack_w_callback);
1635   timer_call_after_resynch(dcs.cpu->machine, NULL, 0, delayed_ack_w_callback);
16281636}
16291637
16301638
r3957r3958
16321640{
16331641   /* data is actually only 8 bit (read from d8-d15) */
16341642   if (dcs.last_output_full && dcs.output_full_cb)
1635      (*dcs.output_full_cb)(dcs.last_output_full = 0);
1643      (*dcs.output_full_cb)(dcs.cpu->machine, dcs.last_output_full = 0);
16361644   if (dcs.auto_ack)
16371645      delayed_ack_w();
16381646
16391647   if (LOG_DCS_IO)
1640      logerror("%s:dcs_data_r(%04X)\n", cpuexec_describe_context(Machine), dcs.output_data);
1648      logerror("%s:dcs_data_r(%04X)\n", cpuexec_describe_context(dcs.cpu->machine), dcs.output_data);
16411649   return dcs.output_data;
16421650}
16431651
r3957r3958
20642072   if (transfer.state != 5 || transfer.fifo_entries == transfer.writes_left || transfer.fifo_entries >= 256)
20652073   {
20662074      for ( ; transfer.fifo_entries; transfer.fifo_entries--)
2067         preprocess_write(Machine, (*dcs.fifo_data_r)(dcs.cpu));
2075         preprocess_write(dcs.cpu->machine, (*dcs.fifo_data_r)(dcs.cpu));
20682076   }
20692077}
20702078
r3957r3958
23632371   if (result && dcs.input_empty_cb)
23642372   {
23652373      if (dcs.last_input_empty)
2366         (*dcs.input_empty_cb)(dcs.last_input_empty = 0);
2374         (*dcs.input_empty_cb)(machine, dcs.last_input_empty = 0);
23672375      if (!dcs.last_input_empty)
2368         (*dcs.input_empty_cb)(dcs.last_input_empty = 1);
2376         (*dcs.input_empty_cb)(machine, dcs.last_input_empty = 1);
23692377   }
23702378   return result;
23712379}
src/mame/audio/dcs.h
r3957r3958
1717void dcs_set_auto_ack(int state);
1818
1919void dcs_set_fifo_callbacks(UINT16 (*fifo_data_r)(const device_config *device), UINT16 (*fifo_status_r)(const device_config *device));
20void dcs_set_io_callbacks(void (*output_full_cb)(int), void (*input_empty_cb)(int));
20void dcs_set_io_callbacks(void (*output_full_cb)(running_machine *, int), void (*input_empty_cb)(running_machine *, int));
2121
2222int dcs_data_r(void);
2323void dcs_ack_w(void);
src/mame/audio/attckufo.c
r3957r3958
132132/************************************/
133133/* Sound handler update             */
134134/************************************/
135static void attckufo_update (void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
135static STREAM_UPDATE( attckufo_update )
136136{
137137   int i, v;
138   stream_sample_t *buffer = _buffer[0];
138   stream_sample_t *buffer = outputs[0];
139139
140   for (i = 0; i < length; i++)
140   for (i = 0; i < samples; i++)
141141   {
142142      v = 0;
143143      if (TONE1_ON /*||(tone1pos!=0) */ )
src/mame/audio/polepos.c
r3957r3958
33    Sound handler
44****************************************************************************/
55#include "driver.h"
6#include "deprecat.h"
76#include "streams.h"
87#include "sound/filter.h"
98#include "machine/rescap.h"
r3957r3958
4746/************************************/
4847/* Stream updater                   */
4948/************************************/
50static void engine_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
49static STREAM_UPDATE( engine_sound_update )
5150{
5251   static UINT32 current_position;
5352   UINT32 step, clock, slot;
r3957r3958
5958   /* if we're not enabled, just fill with 0 */
6059   if (!sample_enable)
6160   {
62      memset(buffer, 0, length * sizeof(*buffer));
61      memset(buffer, 0, samples * sizeof(*buffer));
6362      return;
6463   }
6564
6665   /* determine the effective clock rate */
67   clock = (cpu_get_clock(Machine->cpu[0]) / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
66   clock = (cpu_get_clock(device->machine->cpu[0]) / 16) * ((sample_msb + 1) * 64 + sample_lsb + 1) / (64*64);
6867   step = (clock << 12) / OUTPUT_RATE;
6968
7069   /* determine the volume */
7170   slot = (sample_msb >> 3) & 7;
7271   volume = volume_table[slot];
73   base = &memory_region(Machine, "engine")[slot * 0x800];
72   base = &memory_region(device->machine, "engine")[slot * 0x800];
7473
7574   /* fill in the sample */
76   while (length--)
75   while (samples--)
7776   {
7877      filter_engine[0].x0 = (3.4 / 255 * base[(current_position >> 12) & 0x7ff] - 2) * volume;
7978      filter_engine[1].x0 = filter_engine[0].x0;
src/mame/audio/exidy.c
r3957r3958
55*************************************************************************/
66
77#include "driver.h"
8#include "cpu/z80/z80.h"
89#include "machine/rescap.h"
910#include "streams.h"
1011#include "cpu/m6502/m6502.h"
r3957r3958
221222 *
222223 *************************************/
223224
224static void exidy_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
225static STREAM_UPDATE( exidy_stream_update )
225226{
226227   int noisy = ((sh6840_timer[0].cr & sh6840_timer[1].cr & sh6840_timer[2].cr & 0x02) == 0);
227228   stream_sample_t *buffer = outputs[0];
228229
229230   /* loop over samples */
230   while (length--)
231   while (samples--)
231232   {
232233      struct sh6840_timer_channel *t;
233234      struct sh8253_timer_channel *c;
src/mame/machine/cubocd32.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "includes/amiga.h"
43#include "cdrom.h"
54#include "coreutil.h"
r3957r3958
160159   }
161160}
162161
163static void akiko_nvram_write(UINT32 data)
162static void akiko_nvram_write(running_machine *machine, UINT32 data)
164163{
165164   akiko.i2c_scl_out = BIT(data,31);
166165   akiko.i2c_sda_out = BIT(data,30);
167166   akiko.i2c_scl_dir = BIT(data,15);
168167   akiko.i2c_sda_dir = BIT(data,14);
169168
170   i2cmem_write( 0, I2CMEM_SCL, akiko.i2c_scl_out );
171   i2cmem_write( 0, I2CMEM_SDA, akiko.i2c_sda_out );
169   i2cmem_write( machine, 0, I2CMEM_SCL, akiko.i2c_scl_out );
170   i2cmem_write( machine, 0, I2CMEM_SDA, akiko.i2c_sda_out );
172171}
173172
174static UINT32 akiko_nvram_read(void)
173static UINT32 akiko_nvram_read(running_machine *machine)
175174{
176175   UINT32   v = 0;
177176
r3957r3958
190189   }
191190   else
192191   {
193      v |= i2cmem_read( 0, I2CMEM_SDA ) << 30;
192      v |= i2cmem_read( machine, 0, I2CMEM_SDA ) << 30;
194193   }
195194
196195   v |= akiko.i2c_scl_dir << 15;
r3957r3958
350349   return 0x15;   /* no audio status */
351350}
352351
353static void akiko_set_cd_status( UINT32 status )
352static void akiko_set_cd_status( running_machine *machine, UINT32 status )
354353{
355354   akiko.cdrom_status[0] |= status;
356355
357356   if ( akiko.cdrom_status[0] & akiko.cdrom_status[1] )
358357   {
359358      if (LOG_AKIKO_CD) logerror( "Akiko CD IRQ\n" );
360      amiga_custom_w(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
359      amiga_custom_w(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
361360   }
362361}
363362
r3957r3958
373372
374373      if ( s == 0x11 )
375374      {
376         akiko_set_cd_status( 0x80000000 );   /* subcode ready */
375         akiko_set_cd_status( machine, 0x80000000 );   /* subcode ready */
377376      }
378377
379378      timer_adjust_oneshot( akiko.frame_timer, ATTOTIME_IN_HZ( 75 ), 0 );
r3957r3958
477476   }
478477
479478   if ( akiko.cdrom_readreqmask == 0 )
480      akiko_set_cd_status(0x04000000);
479      akiko_set_cd_status(machine, 0x04000000);
481480   else
482481      timer_adjust_oneshot( akiko.dma_timer, ATTOTIME_IN_USEC( CD_SECTOR_TIME / akiko.cdrom_speed ), 0 );
483482}
r3957r3958
522521
523522   akiko.cdrom_cmd_resp = (akiko.cdrom_cmd_resp+len) & 0xff;
524523
525   akiko_set_cd_status( 0x10000000 ); /* new data available */
524   akiko_set_cd_status( space->machine, 0x10000000 ); /* new data available */
526525}
527526
528527static TIMER_CALLBACK( akiko_cd_delayed_cmd )
r3957r3958
796795         return retval;
797796
798797      case 0x30/4:   /* NVRAM */
799         return akiko_nvram_read();
798         return akiko_nvram_read(space->machine);
800799
801800      case 0x38/4:   /* C2P */
802801         return akiko_c2p_read();
r3957r3958
871870         break;
872871
873872      case 0x30/4:
874         akiko_nvram_write(data);
873         akiko_nvram_write(space->machine, data);
875874         break;
876875
877876      case 0x38/4:
src/mame/machine/playch10.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "video/ppu2c0x.h"
43#include "machine/rp5h01.h"
54#include "includes/playch10.h"
r3957r3958
668667static int gboard_last_bank;
669668static int gboard_command;
670669
671static void gboard_scanline_cb( int num, int scanline, int vblank, int blanked )
670static void gboard_scanline_cb( running_machine *machine, int num, int scanline, int vblank, int blanked )
672671{
673672   if ( !vblank && !blanked )
674673   {
675674      if ( --gboard_scanline_counter == -1 )
676675      {
677676         gboard_scanline_counter = gboard_scanline_latch;
678         generic_pulse_irq_line(Machine->cpu[1], 0);
677         generic_pulse_irq_line(machine->cpu[1], 0);
679678      }
680679   }
681680}
src/mame/machine/bublbobl.c
r3957r3958
2727   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
2828
2929   /* bit 5 resets mcu */
30   if (space->machine->config->cpu[3].type != CPU_DUMMY)   // only if we have a MCU
30   if (space->machine->cpu[3] != NULL) // only if we have a MCU
3131      cpu_set_input_line(space->machine->cpu[3], INPUT_LINE_RESET, (data & 0x20) ? CLEAR_LINE : ASSERT_LINE);
3232
3333   /* bit 6 enables display */
3434   bublbobl_video_enable = data & 0x40;
3535
3636   /* bit 7 flips screen */
37   flip_screen_set(data & 0x80);
37   flip_screen_set(space->machine, data & 0x80);
3838}
3939
4040WRITE8_HANDLER( tokio_bankswitch_w )
r3957r3958
4848WRITE8_HANDLER( tokio_videoctrl_w )
4949{
5050   /* bit 7 flips screen */
51   flip_screen_set(data & 0x80);
51   flip_screen_set(space->machine, data & 0x80);
5252
5353   /* other bits unknown */
5454}
src/mame/machine/s16fd.c
r3957r3958
99*/
1010
1111#include "driver.h"
12#include "deprecat.h"
1312#include "cpu/m68000/m68000.h"
1413#include "machine/fd1094.h"
14#include "machine/fddebug.h"
1515#include "includes/system16.h"
1616
1717
r3957r3958
3838   return fd1094_userregion;
3939}
4040
41static void set_decrypted_region(void)
41static void set_decrypted_region(running_machine *machine)
4242{
4343   if (fd1094_set_decrypted != NULL)
44      (*fd1094_set_decrypted)(Machine, (UINT8 *)fd1094_userregion);
44      (*fd1094_set_decrypted)(machine, (UINT8 *)fd1094_userregion);
4545   else
46      memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, fd1094_cpuregionsize - 1, fd1094_userregion);
46      memory_set_decrypted_region(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, fd1094_cpuregionsize - 1, fd1094_userregion);
4747}
4848
4949/* this function checks the cache to see if the current state is cached,
5050   if it is then it copies the cached data to the user region where code is
5151   executed from, if its not cached then it gets decrypted to the current
5252   cache position using the functions in fd1094.c */
53static void fd1094_setstate_and_decrypt(int state)
53static void fd1094_setstate_and_decrypt(running_machine *machine, int state)
5454{
5555   int i;
5656   UINT32 addr;
r3957r3958
6565
6666   fd1094_state = state;
6767
68   cpu_set_reg(Machine->cpu[0], M68K_PREF_ADDR, 0x0010);   // force a flush of the prefetch cache
68   cpu_set_reg(machine->cpu[0], M68K_PREF_ADDR, 0x0010);   // force a flush of the prefetch cache
6969
7070   /* set the FD1094 state ready to decrypt.. */
7171   state = fd1094_set_state(fd1094_key,state) & 0xff;
r3957r3958
7777      {
7878         /* copy cached state */
7979         fd1094_userregion=fd1094_cacheregion[i];
80         set_decrypted_region();
81         m68k_set_encrypted_opcode_range(Machine->cpu[0],0,fd1094_cpuregionsize);
80         set_decrypted_region(machine);
81         m68k_set_encrypted_opcode_range(machine->cpu[0],0,fd1094_cpuregionsize);
8282
8383         return;
8484      }
r3957r3958
9696
9797   /* copy newly decrypted data to user region */
9898   fd1094_userregion=fd1094_cacheregion[fd1094_current_cacheposition];
99   set_decrypted_region();
100   m68k_set_encrypted_opcode_range(Machine->cpu[0],0,fd1094_cpuregionsize);
99   set_decrypted_region(machine);
100   m68k_set_encrypted_opcode_range(machine->cpu[0],0,fd1094_cpuregionsize);
101101
102102   fd1094_current_cacheposition++;
103103
r3957r3958
113113{
114114   if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ?
115115   {
116      fd1094_setstate_and_decrypt((val & 0xffff0000) >> 16);
116      fd1094_setstate_and_decrypt(device->machine, (val & 0xffff0000) >> 16);
117117   }
118118}
119119
120120/* Callback when the FD1094 enters interrupt code */
121121static IRQ_CALLBACK(fd1094_int_callback)
122122{
123   fd1094_setstate_and_decrypt(FD1094_STATE_IRQ);
123   fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_IRQ);
124124   return (0x60+irqline*4)/4; // vector address
125125}
126126
127127static void fd1094_rte_callback (const device_config *device)
128128{
129   fd1094_setstate_and_decrypt(FD1094_STATE_RTE);
129   fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_RTE);
130130}
131131
132132
r3957r3958
147147   if (!fd1094_key)
148148      return;
149149
150   fd1094_setstate_and_decrypt(FD1094_STATE_RESET);
150   fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_RESET);
151151   fd1094_kludge_reset_values();
152152
153   cpu_set_info_fct(device, CPUINFO_PTR_M68K_CMPILD_CALLBACK, (genf *)fd1094_cmp_callback);
154   cpu_set_info_fct(device, CPUINFO_PTR_M68K_RTE_CALLBACK, (genf *)fd1094_rte_callback);
153   device_set_info_fct(device, CPUINFO_FCT_M68K_CMPILD_CALLBACK, (genf *)fd1094_cmp_callback);
154   device_set_info_fct(device, CPUINFO_FCT_M68K_RTE_CALLBACK, (genf *)fd1094_rte_callback);
155155   cpu_set_irq_callback(device, fd1094_int_callback);
156156
157   cpu_reset(device);
157   device_reset(device);
158158}
159159
160160static STATE_POSTLOAD( fd1094_postload )
r3957r3958
166166
167167      fd1094_machine_init(machine->cpu[0]);
168168
169      fd1094_setstate_and_decrypt(selected_state);
170      fd1094_setstate_and_decrypt(state);
169      fd1094_setstate_and_decrypt(machine, selected_state);
170      fd1094_setstate_and_decrypt(machine, state);
171171   }
172172}
173173
174174
175static void key_changed(void)
175static void key_changed(running_machine *machine)
176176{
177177   int addr;
178178
r3957r3958
186186
187187   /* set cache entry 0 to be the active one, and reset the cache position to 1 */
188188   fd1094_userregion = fd1094_cacheregion[0];
189   set_decrypted_region();
189   set_decrypted_region(machine);
190190   fd1094_current_cacheposition = 1;
191191
192192   /* flush the prefetch queue */
193   cpu_set_reg(Machine->cpu[0], M68K_PREF_ADDR, 0x0010);
193   cpu_set_reg(machine->cpu[0], M68K_PREF_ADDR, 0x0010);
194194}
195195
196196
r3957r3958
219219   /* key debugging */
220220   if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0 && memory_region(machine, "user2") != NULL)
221221   {
222      void fd1094_init_debugging(running_machine *machine, const char *cpureg, const char *keyreg, const char *statreg, void (*changed)(void));
223222      fd1094_init_debugging(machine, "main", "user1", "user2", key_changed);
224223   }
225224
src/mame/machine/tnzs.c
r3957r3958
713713            /* bit 2 resets the mcu */
714714            if (data & 0x04)
715715            {
716               if (space->machine->config->cpu[2].type == CPU_I8742)
716               if (space->machine->cpu[2] != NULL && cpu_get_type(space->machine->cpu[2]) == CPU_I8742)
717717                  cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, PULSE_LINE);
718718            }
719719            /* Coin count and lockout is handled by the i8742 */
src/mame/machine/atari.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1312#include "cpu/m6502/m6502.h"
1413#include "includes/atari.h"
1514#include "sound/pokey.h"
r3957r3958
708707
709708
710709
711static UINT8 console_read(void)
710static UINT8 console_read(const address_space *space)
712711{
713   return input_port_read(Machine, "console");
712   return input_port_read(space->machine, "console");
714713}
715714
716715
717716
718static void console_write(UINT8 data)
717static void console_write(const address_space *space, UINT8 data)
719718{
720719   if (data & 0x08)
721720      dac_data_w(0, -120);
src/mame/machine/midyunit.c
r3957r3958
292292   switch (sound)
293293   {
294294      case SOUND_CVSD_SMALL:
295         williams_cvsd_init(0);
295         williams_cvsd_init(machine, 0);
296296         memory_install_write8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, cvsd_protection_w);
297297         cvsd_protection_base = memory_region(machine, "cvsd") + 0x10000 + (prot_start - 0x8000);
298298         break;
299299
300300      case SOUND_CVSD:
301         williams_cvsd_init(0);
301         williams_cvsd_init(machine, 0);
302302         memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
303303         memory_set_bankptr(machine, 9, auto_malloc(0x80));
304304         break;
305305
306306      case SOUND_ADPCM:
307         williams_adpcm_init();
307         williams_adpcm_init(machine);
308308         memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
309309         memory_set_bankptr(machine, 9, auto_malloc(0x80));
310310         break;
311311
312312      case SOUND_NARC:
313         williams_narc_init();
313         williams_narc_init(machine);
314314         memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), prot_start, prot_end, 0, 0, SMH_BANK9, SMH_BANK9);
315315         memory_set_bankptr(machine, 9, auto_malloc(0x80));
316316         break;
r3957r3958
573573         case SOUND_CVSD_SMALL:
574574         case SOUND_CVSD:
575575            williams_cvsd_reset_w((~data & 0x100) >> 8);
576            williams_cvsd_data_w((data & 0xff) | ((data & 0x200) >> 1));
576            williams_cvsd_data_w(space->machine, (data & 0xff) | ((data & 0x200) >> 1));
577577            break;
578578
579579         case SOUND_ADPCM:
src/mame/machine/konppc.c
r3957r3958
11/* Konami PowerPC-based 3D games common functions */
22
33#include "driver.h"
4#include "deprecat.h"
54#include "cpu/sharc/sharc.h"
65#include "video/voodoo.h"
76#include "konppc.h"
r3957r3958
4039
4140/*****************************************************************************/
4241
43void init_konami_cgboard(int num_boards, int type)
42void init_konami_cgboard(running_machine *machine, int num_boards, int type)
4443{
45   running_machine *machine = Machine;
4644   int i;
4745   num_cgboards = num_boards;
4846
r3957r3958
119117   }
120118}
121119
122void set_cgboard_texture_bank(int board, int bank, UINT8 *rom)
120void set_cgboard_texture_bank(running_machine *machine, int board, int bank, UINT8 *rom)
123121{
124122   texture_bank[board] = bank;
125123
126   memory_configure_bank(Machine, bank, 0, 2, rom, 0x800000);
124   memory_configure_bank(machine, bank, 0, 2, rom, 0x800000);
127125}
128126
129127/*****************************************************************************/
r3957r3958
349347
350348/*****************************************************************************/
351349
352static UINT32 nwk_fifo_r(int board)
350static UINT32 nwk_fifo_r(const address_space *space, int board)
353351{
354352   int cpu = (board == 0) ? 2 : 3;
353   const device_config *device = space->machine->cpu[cpu];
355354   UINT32 data;
356355
357356   if (nwk_fifo_read_ptr[board] < nwk_fifo_half_full_r)
358357   {
359      sharc_set_flag_input(Machine->cpu[cpu], 1, CLEAR_LINE);
358      sharc_set_flag_input(device, 1, CLEAR_LINE);
360359   }
361360   else
362361   {
363      sharc_set_flag_input(Machine->cpu[cpu], 1, ASSERT_LINE);
362      sharc_set_flag_input(device, 1, ASSERT_LINE);
364363   }
365364
366365   if (nwk_fifo_read_ptr[board] < nwk_fifo_full)
367366   {
368      sharc_set_flag_input(Machine->cpu[cpu], 2, ASSERT_LINE);
367      sharc_set_flag_input(device, 2, ASSERT_LINE);
369368   }
370369   else
371370   {
372      sharc_set_flag_input(Machine->cpu[cpu], 2, CLEAR_LINE);
371      sharc_set_flag_input(device, 2, CLEAR_LINE);
373372   }
374373
375374   data = nwk_fifo[board][nwk_fifo_read_ptr[board]];
r3957r3958
379378   return data;
380379}
381380
382static void nwk_fifo_w(int board, UINT32 data)
381static void nwk_fifo_w(running_machine *machine, int board, UINT32 data)
383382{
384383   int cpu = (board == 0) ? 2 : 3;
384   const device_config *device = machine->cpu[cpu];
385385
386386   if (nwk_fifo_write_ptr[board] < nwk_fifo_half_full_w)
387387   {
388      sharc_set_flag_input(Machine->cpu[cpu], 1, ASSERT_LINE);
388      sharc_set_flag_input(device, 1, ASSERT_LINE);
389389   }
390390   else
391391   {
392      sharc_set_flag_input(Machine->cpu[cpu], 1, CLEAR_LINE);
392      sharc_set_flag_input(device, 1, CLEAR_LINE);
393393   }
394394
395   sharc_set_flag_input(Machine->cpu[cpu], 2, ASSERT_LINE);
395   sharc_set_flag_input(device, 2, ASSERT_LINE);
396396
397397   nwk_fifo[board][nwk_fifo_write_ptr[board]] = data;
398398   nwk_fifo_write_ptr[board]++;
r3957r3958
420420   }
421421}
422422
423static UINT32 K033906_r(int chip, int reg)
423static UINT32 K033906_r(const address_space *space, int chip, int reg)
424424{
425425   switch(reg)
426426   {
r3957r3958
430430      case 0x0f:      return K033906_reg[chip][0x0f];      // interrupt_line, interrupt_pin, min_gnt, max_lat
431431
432432      default:
433         fatalerror("%s:K033906_r: %d, %08X", cpuexec_describe_context(Machine), chip, reg);
433         fatalerror("%s:K033906_r: %d, %08X", cpuexec_describe_context(space->machine), chip, reg);
434434   }
435435   return 0;
436436}
437437
438static void K033906_w(running_machine *machine, int chip, int reg, UINT32 data)
438static void K033906_w(const address_space *space, int chip, int reg, UINT32 data)
439439{
440440   switch(reg)
441441   {
r3957r3958
466466
467467      case 0x10:      // initEnable
468468      {
469         const device_config *device = device_list_find_by_index(machine->config->devicelist, VOODOO_GRAPHICS, chip);
469         const device_config *device = device_list_find_by_index(space->machine->config->devicelist, VOODOO_GRAPHICS, chip);
470470         voodoo_set_init_enable(device, data);
471471         break;
472472      }
r3957r3958
479479         break;
480480
481481      default:
482         fatalerror("%s:K033906_w: %d, %08X, %08X", cpuexec_describe_context(machine), chip, data, reg);
482         fatalerror("%s:K033906_w: %d, %08X, %08X", cpuexec_describe_context(space->machine), chip, data, reg);
483483   }
484484}
485485
r3957r3958
487487{
488488   if (nwk_device_sel[0] & 0x01)
489489   {
490      return nwk_fifo_r(0);
490      return nwk_fifo_r(space, 0);
491491   }
492492   else
493493   {
494494      if (pci_bridge_enable[0])
495495      {
496         return K033906_r(0, offset);
496         return K033906_r(space, 0, offset);
497497      }
498498      else
499499      {
r3957r3958
506506{
507507   if (pci_bridge_enable[0])
508508   {
509      K033906_w(space->machine, 0, offset, data);
509      K033906_w(space, 0, offset, data);
510510   }
511511   else
512512   {
r3957r3958
518518{
519519   if (nwk_device_sel[1] & 0x01)
520520   {
521      return nwk_fifo_r(1);
521      return nwk_fifo_r(space, 1);
522522   }
523523   else
524524   {
525525      if (pci_bridge_enable[1])
526526      {
527         return K033906_r(1, offset);
527         return K033906_r(space, 1, offset);
528528      }
529529      else
530530      {
r3957r3958
537537{
538538   if (pci_bridge_enable[1])
539539   {
540      K033906_w(space->machine, 1, offset, data);
540      K033906_w(space, 1, offset, data);
541541   }
542542   else
543543   {
r3957r3958
551551{
552552   if (nwk_device_sel[0] & 0x01)
553553   {
554      nwk_fifo_w(0, data);
554      nwk_fifo_w(device->machine, 0, data);
555555   }
556556   else if (nwk_device_sel[0] & 0x02)
557557   {
r3957r3958
568568{
569569   if (nwk_device_sel[1] & 0x01)
570570   {
571      nwk_fifo_w(1, data);
571      nwk_fifo_w(device->machine, 1, data);
572572   }
573573   else if (nwk_device_sel[1] & 0x02)
574574   {
r3957r3958
609609{
610610   if (nwk_device_sel[0] & 0x01)
611611   {
612      nwk_fifo_w(0, data);
612      nwk_fifo_w(device->machine, 0, data);
613613   }
614614   else if (nwk_device_sel[0] & 0x02)
615615   {
r3957r3958
626626{
627627   if (nwk_device_sel[1] & 0x01)
628628   {
629      nwk_fifo_w(1, data);
629      nwk_fifo_w(device->machine, 1, data);
630630   }
631631   else if (nwk_device_sel[1] & 0x02)
632632   {
src/mame/machine/leland.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/i86/i86.h"
1011#include "machine/eeprom.h"
1112#include "cpu/z80/z80.h"
1213#include "leland.h"
r3957r3958
409410      memory_set_bankptr(machine, 3, &slave_base[0x10000]);
410411
411412   /* if we have an I80186 CPU, reset it */
412   if (machine->config->cpu[2].type == CPU_I80186)
413   if (cpu_get_type(machine->cpu[2]) == CPU_I80186)
413414      leland_80186_sound_init();
414415}
415416
src/mame/machine/konppc.h
r3957r3958
77#define CGBOARD_TYPE_HORNET      3
88#define CGBOARD_TYPE_HANGPLT   4
99
10void init_konami_cgboard(int board_id, int type);
10void init_konami_cgboard(running_machine *machine, int board_id, int type);
1111void set_cgboard_id(int board_id);
1212int get_cgboard_id(void);
13void set_cgboard_texture_bank(int board, int bank, UINT8 *rom);
13void set_cgboard_texture_bank(running_machine *machine, int board, int bank, UINT8 *rom);
1414
1515READ32_HANDLER( cgboard_dsp_comm_r_ppc );
1616WRITE32_HANDLER( cgboard_dsp_comm_w_ppc );
src/mame/machine/midwayic.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "debugger.h"
109#include "midwayic.h"
1110#include "machine/idectrl.h"
r3957r3958
206205}
207206
208207
209UINT8 midway_serial_pic_r(void)
208UINT8 midway_serial_pic_r(const address_space *space)
210209{
211   logerror("%s:security R = %04X\n", cpuexec_describe_context(Machine), serial.buffer);
210   logerror("%s:security R = %04X\n", cpuexec_describe_context(space->machine), serial.buffer);
212211   serial.status = 1;
213212   return serial.buffer;
214213}
215214
216215
217void midway_serial_pic_w(UINT8 data)
216void midway_serial_pic_w(const address_space *space, UINT8 data)
218217{
219   logerror("%s:security W = %04X\n", cpuexec_describe_context(Machine), data);
218   logerror("%s:security W = %04X\n", cpuexec_describe_context(space->machine), data);
220219
221220   /* status seems to reflect the clock bit */
222221   serial.status = (data >> 4) & 1;
r3957r3958
294293}
295294
296295
297UINT8 midway_serial_pic2_status_r(void)
296UINT8 midway_serial_pic2_status_r(const address_space *space)
298297{
299298   UINT8 result = 0;
300299
301300   /* if we're still holding the data ready bit high, do it */
302301   if (pic.latch & 0xf00)
303302   {
304      if (attotime_compare(timer_get_time(Machine), pic.latch_expire_time) > 0)
303      if (attotime_compare(timer_get_time(space->machine), pic.latch_expire_time) > 0)
305304         pic.latch &= 0xff;
306305      else
307306         pic.latch -= 0x100;
308307      result = 1;
309308   }
310309
311   logerror("%s:PIC status %d\n", cpuexec_describe_context(Machine), result);
310   logerror("%s:PIC status %d\n", cpuexec_describe_context(space->machine), result);
312311   return result;
313312}
314313
315314
316UINT8 midway_serial_pic2_r(void)
315UINT8 midway_serial_pic2_r(const address_space *space)
317316{
318317   UINT8 result = 0;
319318
320319   /* PIC data register */
321   logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", cpuexec_describe_context(Machine), pic.index, pic.total, pic.latch);
320   logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", cpuexec_describe_context(space->machine), pic.index, pic.total, pic.latch);
322321
323322   /* return the current result */
324323   if (pic.latch & 0xf00)
r3957r3958
333332}
334333
335334
336void midway_serial_pic2_w(running_machine *machine, UINT8 data)
335void midway_serial_pic2_w(const address_space *space, UINT8 data)
337336{
337   running_machine *machine = space->machine;
338338   static FILE *nvramlog;
339339   if (LOG_NVRAM && !nvramlog)
340340      nvramlog = fopen("nvram.log", "w");
r3957r3958
560560
561561static UINT16 ioasic_fifo_r(const device_config *device);
562562static UINT16 ioasic_fifo_status_r(const device_config *device);
563static void ioasic_input_empty(int state);
564static void ioasic_output_full(int state);
563static void ioasic_input_empty(running_machine *machine, int state);
564static void ioasic_output_full(running_machine *machine, int state);
565565static void update_ioasic_irq(running_machine *machine);
566566static void cage_irq_handler(running_machine *machine, int state);
567567
r3957r3958
695695}
696696
697697
698static void ioasic_input_empty(int state)
698static void ioasic_input_empty(running_machine *machine, int state)
699699{
700700//  logerror("ioasic_input_empty(%d)\n", state);
701701   if (state)
702702      ioasic.sound_irq_state |= 0x0080;
703703   else
704704      ioasic.sound_irq_state &= ~0x0080;
705   update_ioasic_irq(Machine);
705   update_ioasic_irq(machine);
706706}
707707
708708
709static void ioasic_output_full(int state)
709static void ioasic_output_full(running_machine *machine, int state)
710710{
711711//  logerror("ioasic_output_full(%d)\n", state);
712712   if (state)
713713      ioasic.sound_irq_state |= 0x0040;
714714   else
715715      ioasic.sound_irq_state &= ~0x0040;
716   update_ioasic_irq(Machine);
716   update_ioasic_irq(machine);
717717}
718718
719719
r3957r3958
925925         break;
926926
927927      case IOASIC_PICIN:
928         result = midway_serial_pic2_r() | (midway_serial_pic2_status_r() << 8);
928         result = midway_serial_pic2_r(space) | (midway_serial_pic2_status_r(space) << 8);
929929         break;
930930
931931      default:
r3957r3958
10251025
10261026      case IOASIC_PICOUT:
10271027         if (ioasic.shuffle_type == MIDWAY_IOASIC_VAPORTRX)
1028            midway_serial_pic2_w(space->machine, newreg ^ 0x0a);
1028            midway_serial_pic2_w(space, newreg ^ 0x0a);
10291029         else if (ioasic.shuffle_type == MIDWAY_IOASIC_SFRUSHRK)
1030            midway_serial_pic2_w(space->machine, newreg ^ 0x05);
1030            midway_serial_pic2_w(space, newreg ^ 0x05);
10311031         else
1032            midway_serial_pic2_w(space->machine, newreg);
1032            midway_serial_pic2_w(space, newreg);
10331033         break;
10341034
10351035      case IOASIC_INTCTL:
src/mame/machine/midwayic.h
r3957r3958
99void midway_serial_pic_init(running_machine *machine, int upper);
1010void midway_serial_pic_reset_w(int state);
1111UINT8 midway_serial_pic_status_r(void);
12UINT8 midway_serial_pic_r(void);
13void midway_serial_pic_w(UINT8 data);
12UINT8 midway_serial_pic_r(const address_space *space);
13void midway_serial_pic_w(const address_space *space, UINT8 data);
1414
1515
1616/* 2nd generation Midway serial/NVRAM/RTC PIC */
1717void midway_serial_pic2_init(running_machine *machine, int upper, int yearoffs);
1818void midway_serial_pic2_set_default_nvram(const UINT8 *nvram);
19UINT8 midway_serial_pic2_status_r(void);
20UINT8 midway_serial_pic2_r(void);
21void midway_serial_pic2_w(running_machine *machine, UINT8 data);
19UINT8 midway_serial_pic2_status_r(const address_space *space);
20UINT8 midway_serial_pic2_r(const address_space *space);
21void midway_serial_pic2_w(const address_space *space, UINT8 data);
2222NVRAM_HANDLER( midway_serial_pic2 );
2323
2424
src/mame/machine/toaplan1.c
r3957r3958
44 ***************************************************************************/
55
66#include "driver.h"
7#include "cpu/z80/z80.h"
78#include "cpu/m68000/m68000.h"
89#include "cpu/tms32010/tms32010.h"
910#include "includes/toaplan1.h"
r3957r3958
232233      logerror("PC:%04x  Resetting Sound CPU and Sound chip (%08x)\n",cpu_get_previouspc(space->cpu),data);
233234      if (space->machine->config->sound[0].type == SOUND_YM3812)
234235         sndti_reset(SOUND_YM3812, 0);
235      if (space->machine->config->cpu[1].type == CPU_Z80)
236      if (space->machine->cpu[1] != NULL && cpu_get_type(space->machine->cpu[1]) == CPU_Z80)
236237         cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
237238   }
238239}
src/mame/machine/namcoio.c
r3957r3958
932932      case NAMCOIO_50XX_2: namco_50xx_2_write(machine, data); break;
933933      case NAMCOIO_51XX:   namcoio_51XX_write(machine,chipnum,data); break;
934934      case NAMCOIO_52XX:   namcoio_52xx_write(data); break;
935      case NAMCOIO_54XX:   namco_54xx_write(data); break;
935      case NAMCOIO_54XX:   namco_54xx_write(machine, data); break;
936936      default:
937937         logerror("%s: custom IO type %d unsupported write\n",cpuexec_describe_context(machine),io[chipnum].type);
938938         break;
src/mame/machine/dc.c
r3957r3958
237237   }
238238
239239   level=dc_compute_interrupt_level(machine);
240   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH4_IRLn_INPUT, 15-level);
240   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH4_IRLn_INPUT, 15-level);
241241}
242242
243243READ64_HANDLER( dc_sysctrl_r )
r3957r3958
279279         ddtdata.direction=0;
280280         ddtdata.channel=2;
281281         ddtdata.mode=25; //011001
282         cpu_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
282         device_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
283283         #if DEBUG_SYSCTRL
284284         if ((address >= 0x11000000) && (address <= 0x11FFFFFF))
285285            if (dc_sysctrl_regs[SB_LMMODE0])
r3957r3958
386386               ddtdata.direction=0;   // 0 source to buffer, 1 buffer to source
387387               ddtdata.channel= -1;   // not used
388388               ddtdata.mode= -1;      // copy from/to buffer
389               cpu_set_info_ptr(space->machine->cpu[0], CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA, &ddtdata);
389               device_set_info_ptr(space->machine->cpu[0], CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA, &ddtdata);
390390
391391               maple_regs[reg] = 0;
392392               endflag=buff[0] & 0x80000000;
r3957r3958
418418                        ddtdata.direction=0;
419419                        ddtdata.channel= -1;
420420                        ddtdata.mode=-1;
421                        cpu_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
421                        device_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
422422                        chk=0;
423423                        for (a=1;a < length;a++)
424424                        {
r3957r3958
446446                        ddtdata.direction=0;
447447                        ddtdata.channel= -1;
448448                        ddtdata.mode=-1;
449                        cpu_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
449                        device_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
450450
451451                        subcommand = buff[0] & 0xff;
452452                        #if DEBUG_MAPLE
r3957r3958
656656               ddtdata.destination=destination;
657657               ddtdata.buffer=buff;
658658               ddtdata.direction=1;
659               cpu_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
659               device_set_info_ptr(space->machine->cpu[0],CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA,&ddtdata);
660660
661661               if (endflag)
662662               {
r3957r3958
773773         ddtdata.channel= -1;   // not used
774774         ddtdata.mode= -1;      // copy from/to buffer
775775          mame_printf_verbose("G1CTRL: transfer %x from ROM %08x to sdram %08x\n", g1bus_regs[SB_GDLEN], dmaoffset, g1bus_regs[SB_GDSTAR]);
776         cpu_set_info_ptr(space->machine->cpu[0], CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA, &ddtdata);
776         device_set_info_ptr(space->machine->cpu[0], CPUINFO_PTR_SH4_EXTERNAL_DDT_DMA, &ddtdata);
777777         g1bus_regs[SB_GDST]=0;
778778         dc_sysctrl_regs[SB_ISTNRM] |= IST_DMA_GDROM;
779779      }
src/mame/machine/scramble.c
r3957r3958
2121   MACHINE_RESET_CALL(galaxold);
2222
2323   if (machine->cpu[1] != NULL)
24      scramble_sh_init();
24      scramble_sh_init(machine);
2525
2626  security_2B_counter = 0;
2727}
r3957r3958
3030{
3131   MACHINE_RESET_CALL(scramble);
3232
33   sfx_sh_init();
33   sfx_sh_init(machine);
3434}
3535
3636static int monsterz_count = 0;
r3957r3958
4747*/
4848   MACHINE_RESET_CALL(scramble);
4949
50   sfx_sh_init();
50   sfx_sh_init(machine);
5151
5252   monsterz_count = 0;
5353}
src/mame/machine/midtunit.c
r3957r3958
419419   {
420420      case SOUND_ADPCM:
421421      case SOUND_ADPCM_LARGE:
422         williams_adpcm_init();
422         williams_adpcm_init(machine);
423423         break;
424424
425425      case SOUND_DCS:
src/mame/machine/carpolo.c
r3957r3958
77****************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "cpu/m6502/m6502.h"
1211#include "machine/6821pia.h"
1312#include "machine/7474.h"
r3957r3958
8887static UINT8 last_wheel_value[4];
8988
9089
91static void TTL74148_3S_cb(void)
90static void TTL74148_3S_cb(running_machine *machine)
9291{
93   cpu_set_input_line(Machine->cpu[0], M6502_IRQ_LINE, TTL74148_output_valid_r(TTL74148_3S) ? CLEAR_LINE : ASSERT_LINE);
92   cpu_set_input_line(machine->cpu[0], M6502_IRQ_LINE, TTL74148_output_valid_r(TTL74148_3S) ? CLEAR_LINE : ASSERT_LINE);
9493}
9594
9695
9796/* the outputs of the flip-flops are connected to the priority encoder */
98static void TTL7474_2S_1_cb(void)
97static void TTL7474_2S_1_cb(running_machine *machine)
9998{
10099   TTL74148_input_line_w(TTL74148_3S, COIN1_PRIORITY_LINE, TTL7474_output_comp_r(TTL7474_2S_1));
101   TTL74148_update(TTL74148_3S);
100   TTL74148_update(machine, TTL74148_3S);
102101}
103102
104static void TTL7474_2S_2_cb(void)
103static void TTL7474_2S_2_cb(running_machine *machine)
105104{
106105   TTL74148_input_line_w(TTL74148_3S, COIN2_PRIORITY_LINE, TTL7474_output_comp_r(TTL7474_2S_2));
107   TTL74148_update(TTL74148_3S);
106   TTL74148_update(machine, TTL74148_3S);
108107}
109108
110static void TTL7474_2U_1_cb(void)
109static void TTL7474_2U_1_cb(running_machine *machine)
111110{
112111   TTL74148_input_line_w(TTL74148_3S, COIN3_PRIORITY_LINE, TTL7474_output_comp_r(TTL7474_2U_1));
113   TTL74148_update(TTL74148_3S);
112   TTL74148_update(machine, TTL74148_3S);
114113}
115114
116static void TTL7474_2U_2_cb(void)
115static void TTL7474_2U_2_cb(running_machine *machine)
117116{
118117   TTL74148_input_line_w(TTL74148_3S, COIN4_PRIORITY_LINE, TTL7474_output_comp_r(TTL7474_2U_2));
119   TTL74148_update(TTL74148_3S);
118   TTL74148_update(machine, TTL74148_3S);
120119}
121120
122121
123void carpolo_generate_ball_screen_interrupt(UINT8 cause)
122void carpolo_generate_ball_screen_interrupt(running_machine *machine, UINT8 cause)
124123{
125124   ball_screen_collision_cause = cause;
126125
127126   TTL74148_input_line_w(TTL74148_3S, BALL_SCREEN_PRIORITY_LINE, 0);
128   TTL74148_update(TTL74148_3S);
127   TTL74148_update(machine, TTL74148_3S);
129128}
130129
131void carpolo_generate_car_car_interrupt(int car1, int car2)
130void carpolo_generate_car_car_interrupt(running_machine *machine, int car1, int car2)
132131{
133132   car_car_collision_cause = ~((1 << (3 - car1)) | (1 << (3 - car2)));
134133
135134   TTL74148_input_line_w(TTL74148_3S, CAR_CAR_PRIORITY_LINE, 0);
136   TTL74148_update(TTL74148_3S);
135   TTL74148_update(machine, TTL74148_3S);
137136}
138137
139void carpolo_generate_car_goal_interrupt(int car, int right_goal)
138void carpolo_generate_car_goal_interrupt(running_machine *machine, int car, int right_goal)
140139{
141140   car_goal_collision_cause = car | (right_goal ? 0x08 : 0x00);
142141
143142   TTL74148_input_line_w(TTL74148_3S, CAR_GOAL_PRIORITY_LINE, 0);
144   TTL74148_update(TTL74148_3S);
143   TTL74148_update(machine, TTL74148_3S);
145144}
146145
147void carpolo_generate_car_ball_interrupt(int car, int car_x, int car_y)
146void carpolo_generate_car_ball_interrupt(running_machine *machine, int car, int car_x, int car_y)
148147{
149148   car_ball_collision_cause = car;
150149   car_ball_collision_x = car_x;
r3957r3958
153152   priority_0_extension = CAR_BALL_EXTRA_BITS;
154153
155154   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 0);
156   TTL74148_update(TTL74148_3S);
155   TTL74148_update(machine, TTL74148_3S);
157156}
158157
159void carpolo_generate_car_border_interrupt(int car, int horizontal_border)
158void carpolo_generate_car_border_interrupt(running_machine *machine, int car, int horizontal_border)
160159{
161160   car_border_collision_cause = car | (horizontal_border ? 0x04 : 0x00);
162161
163162   priority_0_extension = CAR_BORDER_EXTRA_BITS;
164163
165164   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 0);
166   TTL74148_update(TTL74148_3S);
165   TTL74148_update(machine, TTL74148_3S);
167166}
168167
169168
r3957r3958
237236   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 0);
238237   priority_0_extension = TIMER_EXTRA_BITS;
239238
240   TTL74148_update(TTL74148_3S);
239   TTL74148_update(device->machine, TTL74148_3S);
241240
242241
243242   /* check the coins here as well - they drive the clock of the flip-flops */
r3957r3958
248247   TTL7474_clock_w(TTL7474_2U_1, port_value & 0x04);
249248   TTL7474_clock_w(TTL7474_2U_2, port_value & 0x08);
250249
251   TTL7474_update(TTL7474_2S_1);
252   TTL7474_update(TTL7474_2S_2);
253   TTL7474_update(TTL7474_2U_1);
254   TTL7474_update(TTL7474_2U_2);
250   TTL7474_update(device->machine, TTL7474_2S_1);
251   TTL7474_update(device->machine, TTL7474_2S_2);
252   TTL7474_update(device->machine, TTL7474_2U_1);
253   TTL7474_update(device->machine, TTL7474_2U_2);
255254
256255
257256   /* read the steering controls */
r3957r3958
275274      TTL7474_clock_w(movement_flip_flop, port_value & 0x01);
276275      TTL7474_clock_w(dir_flip_flop,      port_value & 0x01);
277276
278      TTL7474_update(movement_flip_flop);
279      TTL7474_update(dir_flip_flop);
277      TTL7474_update(device->machine, movement_flip_flop);
278      TTL7474_update(device->machine, dir_flip_flop);
280279   }
281280
282281
r3957r3958
314313static WRITE8_HANDLER( coin1_interrupt_clear_w )
315314{
316315   TTL7474_clear_w(TTL7474_2S_1, data);
317   TTL7474_update(TTL7474_2S_1);
316   TTL7474_update(space->machine, TTL7474_2S_1);
318317}
319318
320319static WRITE8_HANDLER( coin2_interrupt_clear_w )
321320{
322321   TTL7474_clear_w(TTL7474_2S_2, data);
323   TTL7474_update(TTL7474_2S_2);
322   TTL7474_update(space->machine, TTL7474_2S_2);
324323}
325324
326325static WRITE8_HANDLER( coin3_interrupt_clear_w )
327326{
328327   TTL7474_clear_w(TTL7474_2U_1, data);
329   TTL7474_update(TTL7474_2U_1);
328   TTL7474_update(space->machine, TTL7474_2U_1);
330329}
331330
332331static WRITE8_HANDLER( coin4_interrupt_clear_w )
333332{
334333   TTL7474_clear_w(TTL7474_2U_2, data);
335   TTL7474_update(TTL7474_2U_2);
334   TTL7474_update(space->machine, TTL7474_2U_2);
336335}
337336
338337WRITE8_HANDLER( carpolo_ball_screen_interrupt_clear_w )
339338{
340339   TTL74148_input_line_w(TTL74148_3S, BALL_SCREEN_PRIORITY_LINE, 1);
341   TTL74148_update(TTL74148_3S);
340   TTL74148_update(space->machine, TTL74148_3S);
342341}
343342
344343WRITE8_HANDLER( carpolo_car_car_interrupt_clear_w )
345344{
346345   TTL74148_input_line_w(TTL74148_3S, CAR_CAR_PRIORITY_LINE, 1);
347   TTL74148_update(TTL74148_3S);
346   TTL74148_update(space->machine, TTL74148_3S);
348347}
349348
350349WRITE8_HANDLER( carpolo_car_goal_interrupt_clear_w )
351350{
352351   TTL74148_input_line_w(TTL74148_3S, CAR_GOAL_PRIORITY_LINE, 1);
353   TTL74148_update(TTL74148_3S);
352   TTL74148_update(space->machine, TTL74148_3S);
354353}
355354
356355WRITE8_HANDLER( carpolo_car_ball_interrupt_clear_w )
357356{
358357   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 1);
359   TTL74148_update(TTL74148_3S);
358   TTL74148_update(space->machine, TTL74148_3S);
360359}
361360
362361WRITE8_HANDLER( carpolo_car_border_interrupt_clear_w )
363362{
364363   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 1);
365   TTL74148_update(TTL74148_3S);
364   TTL74148_update(space->machine, TTL74148_3S);
366365}
367366
368367WRITE8_HANDLER( carpolo_timer_interrupt_clear_w )
369368{
370369   TTL74148_input_line_w(TTL74148_3S, PRI0_PRIORTITY_LINE, 1);
371   TTL74148_update(TTL74148_3S);
370   TTL74148_update(space->machine, TTL74148_3S);
372371}
373372
374373
r3957r3958
397396   TTL7474_clear_w(TTL7474_1C_1, data & 0x08);
398397   TTL7474_clear_w(TTL7474_1A_1, data & 0x08);
399398
400   TTL7474_update(TTL7474_1F_1);
401   TTL7474_update(TTL7474_1D_1);
402   TTL7474_update(TTL7474_1C_1);
403   TTL7474_update(TTL7474_1A_1);
399   TTL7474_update(space->machine, TTL7474_1F_1);
400   TTL7474_update(space->machine, TTL7474_1D_1);
401   TTL7474_update(space->machine, TTL7474_1C_1);
402   TTL7474_update(space->machine, TTL7474_1A_1);
404403}
405404
406405
r3957r3958
579578
580579
581580   /* set up the pedal handling chips */
582   TTL74153_config(TTL74153_1K, 0);
581   TTL74153_config(machine, TTL74153_1K, 0);
583582
584583   TTL74153_enable_w(TTL74153_1K, 0, 0);
585584   TTL74153_enable_w(TTL74153_1K, 1, 0);
src/mame/machine/fddebug.c
r3957r3958
106106***************************************************************************/
107107
108108#include "driver.h"
109#include "deprecat.h"
110109#include "machine/fd1094.h"
111110#include "cpu/m68000/m68kcpu.h"
112#undef REG_PC
113111
114112#include "debug/debugcmd.h"
115113#include "debug/debugcon.h"
116114#include "debug/debugcpu.h"
117115#include "debug/debugvw.h"
116#include "machine/fddebug.h"
118117
119118
120119
r3957r3958
247246static UINT32            keystatus_words;
248247
249248/* key changed callback */
250static void               (*key_changed)(void);
249static void               (*key_changed)(running_machine *);
251250
252251
253252
r3957r3958
258257static void set_default_key_params(running_machine *machine);
259258static void load_overlay_file(running_machine *machine);
260259static void save_overlay_file(running_machine *machine);
261static void fd1094_regenerate_key(void);
262260
263261static int instruction_hook(const device_config *device, offs_t curpc);
264262
r3957r3958
478476    fd1094_init_debugging - set up debugging
479477-----------------------------------------------*/
480478
481void fd1094_init_debugging(running_machine *machine, const char *cpureg, const char *keyreg, const char *statreg, void (*changed)(void))
479void fd1094_init_debugging(running_machine *machine, const char *cpureg, const char *keyreg, const char *statreg, void (*changed)(running_machine *))
482480{
483481   /* set the key changed callback */
484482   key_changed = changed;
r3957r3958
542540
543541   /* regenerate the key */
544542   if (keydirty)
545      fd1094_regenerate_key();
543      fd1094_regenerate_key(machine);
546544}
547545
548546
r3957r3958
645643    data
646644-----------------------------------------------*/
647645
648void fd1094_regenerate_key(void)
646void fd1094_regenerate_key(running_machine *machine)
649647{
650648   int reps = keystatus_words / KEY_SIZE;
651649   int keyaddr, repnum;
r3957r3958
676674
677675   /* update the key with the current fd1094 manager */
678676   if (key_changed != NULL)
679      (*key_changed)();
677      (*key_changed)(machine);
680678
681679   /* force all memory and disassembly views to update */
682   debug_view_update_type(Machine, DVT_MEMORY);
683   debug_view_update_type(Machine, DVT_DISASSEMBLY);
680   debug_view_update_type(machine, DVT_MEMORY);
681   debug_view_update_type(machine, DVT_DISASSEMBLY);
684682
685683   /* reset keydirty */
686684   keydirty = FALSE;
r3957r3958
725723   /* try all possible decodings at the current pc */
726724   posscount = try_all_possibilities(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), curpc, 0, 0, instrbuffer, keybuffer, posslist) - posslist;
727725   if (keydirty)
728      fd1094_regenerate_key();
726      fd1094_regenerate_key(device->machine);
729727
730728   /* if we only ended up with one possibility, mark that one as good */
731729   if (posscount == 1)
732730   {
733731      tag_possibility(device->machine, &posslist[0], STATUS_LOCKED);
734      fd1094_regenerate_key();
732      fd1094_regenerate_key(device->machine);
735733      return 0;
736734   }
737735
r3957r3958
764762
765763   /* make sure we're up-to-date */
766764   if (keydirty)
767      fd1094_regenerate_key();
765      fd1094_regenerate_key(machine);
768766
769767   /* determin the filename and open the file */
770768   filerr = mame_fopen(SEARCHPATH_RAW, param[0], OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
r3957r3958
799797   memset(keystatus, 0, keystatus_words * sizeof(keystatus[0]));
800798
801799   /* regenerate the key and reset the 68000 */
802   fd1094_regenerate_key();
800   fd1094_regenerate_key(machine);
803801}
804802
805803
r3957r3958
828826
829827   /* tag this possibility as indicated by the ref parameter, and then regenerate the key */
830828   tag_possibility(machine, &posslist[num1], ref);
831   fd1094_regenerate_key();
829   fd1094_regenerate_key(machine);
832830}
833831
834832
r3957r3958
964962{
965963   /* copy the undobuffer back and regenerate the key */
966964   memcpy(keystatus, undobuff, keystatus_words * 2);
967   fd1094_regenerate_key();
965   fd1094_regenerate_key(machine);
968966   debug_console_printf(machine, "Undid last change\n");
969967}
970968
r3957r3958
10161014      if (!debug_command_parameter_number(machine, param[0], &newstate))
10171015         return;
10181016      fd1094_set_state(keyregion, newstate);
1019      fd1094_regenerate_key();
1017      fd1094_regenerate_key(machine);
10201018      debug_view_update_type(machine, DVT_MEMORY);
10211019      debug_view_update_type(machine, DVT_DISASSEMBLY);
10221020   }
r3957r3958
10411039       newpc = cpu_get_pc(cpu);
10421040
10431041    /* set the new PC */
1044    cpu_set_reg(cpu, REG_PC, newpc);
1042    cpu_set_reg(cpu, REG_GENPC, newpc);
10451043
10461044    /* recompute around that */
10471045    instruction_hook(cpu, newpc);
r3957r3958
10941092         }
10951093
10961094         /* set this as our current PC and run the instruction hook */
1097         cpu_set_reg(space->cpu, REG_PC, pc);
1095         cpu_set_reg(space->cpu, REG_GENPC, pc);
10981096         if (instruction_hook(space->cpu, pc))
10991097            break;
11001098      }
src/mame/machine/namcos1.c
r3957r3958
681681/* Main bankswitching routine */
682682static void set_bank(running_machine *machine, int banknum, const bankhandler *handler)
683683{
684   const address_space *space = cpu_get_address_space(machine->cpu[(banknum >> 3) & 1], ADDRESS_SPACE_PROGRAM);
684685   int bankstart = (banknum & 7) * 0x2000;
685   int cpunum = (banknum >> 3) & 1;
686686
687687   /* for BANK handlers , memory direct and OP-code base */
688688   if (handler->bank_pointer)
r3957r3958
692692   if (!handler->bank_handler_r)
693693   {
694694      if (namcos1_active_bank[banknum].bank_handler_r)
695         memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
695         memory_install_read8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_r[banknum]);
696696   }
697697   else
698698   {
699699      if (!namcos1_active_bank[banknum].bank_handler_r)
700         memory_install_read8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
700         memory_install_read8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_r[banknum]);
701701   }
702702
703703   /* write handlers (except for the 0xe000-0xffff range) */
r3957r3958
706706      if (!handler->bank_handler_w)
707707      {
708708         if (namcos1_active_bank[banknum].bank_handler_w)
709            memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
709            memory_install_write8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, ram_bank_handler_w[banknum]);
710710      }
711711      else
712712      {
713713         if (!namcos1_active_bank[banknum].bank_handler_r)
714            memory_install_write8_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
714            memory_install_write8_handler(space, bankstart, bankstart + 0x1fff, 0, 0, io_bank_handler_w[banknum]);
715715      }
716716   }
717717
r3957r3958
873873   namcos1_bankswitch(machine, 1, 0x0e01, 0xff);
874874
875875   /* reset Cpu 0 and stop all other CPUs */
876   cpu_reset(machine->cpu[0]);
876   device_reset(machine->cpu[0]);
877877   cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
878878   cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
879879   cpu_set_input_line(machine->cpu[3], INPUT_LINE_RESET, ASSERT_LINE);
src/mame/machine/segaic16.c
r3957r3958
325325   if (LOG_MEMORY_MAP) mame_printf_debug("----\nRemapping:\n");
326326
327327   /* first reset everything back to the beginning */
328   memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpu_get_index(chip->cpu)], ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
328   memory_install_readwrite16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w);
329329
330330   /* loop over the regions */
331331   for (rgnum = 0; chip->map[rgnum].regbase != 0; rgnum++)
src/mame/machine/fddebug.h
r0r3958
1void fd1094_regenerate_key(running_machine *machine);
2void fd1094_init_debugging(running_machine *machine, const char *cpureg, const char *keyreg, const char *statreg, void (*changed)(running_machine *));
3
4
src/mame/machine/n64.c
r3957r3958
465465        {
466466            case 0x00/4:        // SP_PC_REG
467467                //printf( "Setting PC to: %08x\n", 0x04001000 | (data & 0xfff ) );
468                if( cpu_get_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_NEXTPC) != 0xffffffff )
468                if( device_get_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_NEXTPC) != 0xffffffff )
469469                {
470                    cpu_set_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_NEXTPC, 0x04001000 | (data & 0xfff));
470                    device_set_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_NEXTPC, 0x04001000 | (data & 0xfff));
471471                }
472472                else
473473                {
474                    cpu_set_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_PC, 0x04001000 | (data & 0xfff));
474                    device_set_info_int(space->machine->cpu[1], CPUINFO_INT_REGISTER + RSP_PC, 0x04001000 | (data & 0xfff));
475475                }
476476                break;
477477
r3957r3958
529529
530530      case 0x04/4:      // DP_END_REG
531531         dp_end = data;
532         rdp_process_list();
532         rdp_process_list(space->machine);
533533         break;
534534
535535      case 0x0c/4:      // DP_STATUS_REG
r3957r3958
16281628
16291629   cic_status = 0;
16301630
1631   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
1631   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
16321632
16331633      /* configure fast RAM regions for DRC */
1634   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
1635   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
1636   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x007fffff);
1637   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rdram);
1638   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
1634   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
1635   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
1636   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x007fffff);
1637   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rdram);
1638   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
16391639
16401640   audio_timer = timer_alloc(machine, audio_timer_callback, NULL);
16411641   timer_adjust_oneshot(audio_timer, attotime_never, 0);
src/mame/machine/balsente.c
r3957r3958
189189   memory_configure_bank(machine, 2, 0, numbanks, &memory_region(machine, "main")[0x12000], 0x6000);
190190   memory_set_bank(space->machine, 1, 0);
191191   memory_set_bank(space->machine, 2, 0);
192   cpu_reset(machine->cpu[0]);
192   device_reset(machine->cpu[0]);
193193
194194   /* start a timer to generate interrupts */
195195   scanline_timer = timer_alloc(machine, interrupt_timer, NULL);
src/mame/machine/vsnes.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "video/ppu2c0x.h"
1312#include "includes/vsnes.h"
1413
r3957r3958
8887
8988
9089/* remap callback */
91static int remap_colors( int num, int addr, int data )
90static int remap_colors( running_machine *machine, int num, int addr, int data )
9291{
9392   /* this is the protection. color codes are shuffled around */
9493   /* the ones with value 0xff are unknown */
r3957r3958
806805static int MMC3_prg_chunks, MMC3_prg_mask;
807806static int IRQ_enable, IRQ_count, IRQ_count_latch;
808807
809static void mapper4_set_prg (void)
808static void mapper4_set_prg (const address_space *space)
810809{
811   UINT8 *prg = memory_region( Machine, "main" );
810   UINT8 *prg = memory_region( space->machine, "main" );
812811   MMC3_prg0 &= MMC3_prg_mask;
813812   MMC3_prg1 &= MMC3_prg_mask;
814813
r3957r3958
825824   memcpy( &prg[0xa000], &prg[0x2000 * (MMC3_prg1) + 0x10000], 0x2000 );
826825}
827826
828static void mapper4_set_chr (void)
827static void mapper4_set_chr (const address_space *space)
829828{
830829   UINT8 chr_page = (MMC3_cmd & 0x80) >> 5;
831830   ppu2c0x_set_videorom_bank(0, chr_page ^ 0, 2, MMC3_chr[0], 1);
r3957r3958
839838#define BOTTOM_VISIBLE_SCANLINE   239      /* The bottommost visible scanline */
840839#define NUM_SCANLINE 262
841840
842static void mapper4_irq ( int num, int scanline, int vblank, int blanked )
841static void mapper4_irq ( running_machine *machine, int num, int scanline, int vblank, int blanked )
843842{
844843   mame_printf_debug("entra\n");
845844   if ((scanline < BOTTOM_VISIBLE_SCANLINE) || (scanline == NUM_SCANLINE-1))
r3957r3958
849848         if (IRQ_count == 0)
850849         {
851850            IRQ_count = IRQ_count_latch;
852            cpu_set_input_line (Machine->cpu[0], 0, HOLD_LINE);
851            cpu_set_input_line (machine->cpu[0], 0, HOLD_LINE);
853852         }
854853         IRQ_count --;
855854      }
r3957r3958
867866         if (last_bank != (data & 0xc0))
868867         {
869868            /* Reset the banks */
870            mapper4_set_prg ();
871            mapper4_set_chr ();
869            mapper4_set_prg (space);
870            mapper4_set_chr (space);
872871
873872         }
874873         last_bank = data & 0xc0;
r3957r3958
882881            case 0: case 1:
883882               data &= 0xfe;
884883               MMC3_chr[cmd] = data * 64;
885               mapper4_set_chr ();
884               mapper4_set_chr (space);
886885
887886               break;
888887
889888            case 2: case 3: case 4: case 5:
890889               MMC3_chr[cmd] = data * 64;
891               mapper4_set_chr ();
890               mapper4_set_chr (space);
892891
893892               break;
894893
895894            case 6:
896895               MMC3_prg0 = data;
897               mapper4_set_prg ();
896               mapper4_set_prg (space);
898897               break;
899898
900899            case 7:
901900               MMC3_prg1 = data;
902               mapper4_set_prg ();
901               mapper4_set_prg (space);
903902               break;
904903         }
905904         break;
src/mame/machine/pcecommn.c
r3957r3958
1717static int joystick_port_select;        /* internal index of joystick ports */
1818static int joystick_data_select;        /* which nibble of joystick data we want */
1919
20static UINT8 (*pce_joystick_readinputport_callback)(void) = NULL;
20static UINT8 (*pce_joystick_readinputport_callback)(running_machine *) = NULL;
2121
2222DRIVER_INIT( pce ) {
2323   pce.io_port_options = PCE_JOY_SIG | CONST_SIG;
r3957r3958
5353
5454   if ( pce_joystick_readinputport_callback != NULL )
5555   {
56      data = pce_joystick_readinputport_callback();
56      data = pce_joystick_readinputport_callback(space->machine);
5757   }
5858   else
5959   {
r3957r3958
6767   return (ret);
6868}
6969
70void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(void))
70void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(running_machine *))
7171{
7272   pce_joystick_readinputport_callback = joy_read;
7373}
src/mame/machine/mexico86.c
r3957r3958
2323WRITE8_HANDLER( mexico86_f008_w )
2424{
2525   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 4) ? CLEAR_LINE : ASSERT_LINE);
26    if (space->machine->config->cpu[2].type != CPU_DUMMY)
26    if (space->machine->cpu[2] != NULL)
2727   {
2828      // mexico 86, knight boy
2929      cpu_set_input_line(space->machine->cpu[2], INPUT_LINE_RESET, (data & 2) ? CLEAR_LINE : ASSERT_LINE);
src/mame/machine/pcecommn.h
r3957r3958
3030DRIVER_INIT( pce );
3131MACHINE_RESET( pce );
3232
33void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(void));
33void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(running_machine *));
3434#endif
src/mame/machine/taitosj.c
r3957r3958
5353   zaccept = 1;
5454   zready = 0;
5555   busreq = 0;
56    if (machine->config->cpu[2].type != CPU_DUMMY)
57   cpu_set_input_line(machine->cpu[2],0,CLEAR_LINE);
56    if (machine->cpu[2] != NULL)
57      cpu_set_input_line(machine->cpu[2],0,CLEAR_LINE);
5858
5959   spacecr_prot_value = 0;
6060}
src/mame/machine/amiga.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1312#include "includes/amiga.h"
1413#include "cpu/m68000/m68000.h"
1514#include "machine/6526cia.h"
r3957r3958
170169 *
171170 *************************************/
172171
173static void custom_reset(void);
174static void autoconfig_reset(void);
172static void custom_reset(running_machine *machine);
173static void autoconfig_reset(running_machine *machine);
175174static TIMER_CALLBACK( amiga_irq_proc );
176175static TIMER_CALLBACK( amiga_blitter_proc );
177176static TIMER_CALLBACK( scanline_callback );
r3957r3958
284283   /* Initialize the various chips */
285284   devtag_reset(device->machine, CIA8520, "cia_0");
286285   devtag_reset(device->machine, CIA8520, "cia_1");
287   custom_reset();
288   autoconfig_reset();
286   custom_reset(device->machine);
287   autoconfig_reset(device->machine);
289288
290289   /* set the overlay bit */
291290   if ( IS_AGA(amiga_intf) )
r3957r3958
304303//  const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
305304
306305   /* set m68k reset  function */
307   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)amiga_m68k_reset);
306   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_RESET_CALLBACK, (genf *)amiga_m68k_reset);
308307
309308   amiga_m68k_reset(machine->cpu[0]);
310309
311310   /* call the system-specific callback */
312311   if (amiga_intf->reset_callback)
313      (*amiga_intf->reset_callback)();
312      (*amiga_intf->reset_callback)(machine);
314313
315314   /* start the scanline timer */
316315   timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, scanline_callback);
r3957r3958
341340
342341      /* call the system-specific callback */
343342      if (amiga_intf->scanline0_callback != NULL)
344         (*amiga_intf->scanline0_callback)();
343         (*amiga_intf->scanline0_callback)(machine);
345344   }
346345
347346   /* on every scanline, clock the second CIA TOD */
r3957r3958
11111110 *
11121111 *************************************/
11131112
1114static void custom_reset(void)
1113static void custom_reset(running_machine *machine)
11151114{
1116   int clock = cpu_get_clock(Machine->cpu[0]);
1115   int clock = cpu_get_clock(machine->cpu[0]);
11171116   UINT16   vidmode = (clock == AMIGA_68000_NTSC_CLOCK || clock == AMIGA_68EC020_NTSC_CLOCK ) ? 0x1000 : 0x0000; /* NTSC or PAL? */
11181117
11191118   CUSTOM_REG(REG_DDFSTRT) = 0x18;
r3957r3958
11761175
11771176      case REG_JOY0DAT:
11781177         if (amiga_intf->joy0dat_r != NULL)
1179            return (*amiga_intf->joy0dat_r)();
1178            return (*amiga_intf->joy0dat_r)(space->machine);
11801179         return input_port_read_safe(space->machine, "JOY0DAT", 0xffff);
11811180
11821181      case REG_JOY1DAT:
11831182         if (amiga_intf->joy1dat_r != NULL)
1184            return (*amiga_intf->joy1dat_r)();
1183            return (*amiga_intf->joy1dat_r)(space->machine);
11851184         return input_port_read_safe(space->machine, "JOY1DAT", 0xffff);
11861185
11871186      case REG_ADKCONR:
r3957r3958
11981197
11991198      case REG_DSKBYTR:
12001199         if (amiga_intf->dskbytr_r != NULL)
1201            return (*amiga_intf->dskbytr_r)();
1200            return (*amiga_intf->dskbytr_r)(space->machine);
12021201         return 0x0000;
12031202
12041203      case REG_INTENAR:
r3957r3958
12701269
12711270      case REG_DSKLEN:
12721271         if (amiga_intf->dsklen_w != NULL)
1273            (*amiga_intf->dsklen_w)(data);
1272            (*amiga_intf->dsklen_w)(space->machine, data);
12741273         break;
12751274
12761275      case REG_POTGO:
12771276         if (amiga_intf->potgo_w != NULL)
1278            (*amiga_intf->potgo_w)(data);
1277            (*amiga_intf->potgo_w)(space->machine, data);
12791278         break;
12801279
12811280      case REG_SERDAT:
12821281         if (amiga_intf->serdat_w != NULL)
1283            (*amiga_intf->serdat_w)(data);
1282            (*amiga_intf->serdat_w)(space->machine, data);
12841283         CUSTOM_REG(REG_SERDATR) &= ~0x3000;
1285         timer_set(space->machine, amiga_get_serial_char_period(), NULL, 0, finish_serial_write);
1284         timer_set(space->machine, amiga_get_serial_char_period(space->machine), NULL, 0, finish_serial_write);
12861285         break;
12871286
12881287      case REG_BLTSIZE:
r3957r3958
14691468 *
14701469 *************************************/
14711470
1472void amiga_serial_in_w(UINT16 data)
1471void amiga_serial_in_w(running_machine *machine, UINT16 data)
14731472{
1473   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
14741474   int mask = (CUSTOM_REG(REG_SERPER) & 0x8000) ? 0x1ff : 0xff;
14751475
14761476   /* copy the data to the low 8 bits of SERDATR and set RBF */
r3957r3958
14851485   }
14861486
14871487   /* signal an interrupt */
1488   amiga_custom_w(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_RBF, 0xffff);
1488   amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_RBF, 0xffff);
14891489}
14901490
14911491
1492attotime amiga_get_serial_char_period(void)
1492attotime amiga_get_serial_char_period(running_machine *machine)
14931493{
14941494   UINT32 divisor = (CUSTOM_REG(REG_SERPER) & 0x7fff) + 1;
1495   UINT32 baud = cpu_get_clock(Machine->cpu[0]) / 2 / divisor;
1495   UINT32 baud = cpu_get_clock(machine->cpu[0]) / 2 / divisor;
14961496   UINT32 numbits = 2 + ((CUSTOM_REG(REG_SERPER) & 0x8000) ? 9 : 8);
14971497   return attotime_mul(ATTOTIME_IN_HZ(baud), numbits);
14981498}
r3957r3958
15051505 *
15061506 *************************************/
15071507
1508void amiga_add_autoconfig(const amiga_autoconfig_device *device)
1508void amiga_add_autoconfig(running_machine *machine, const amiga_autoconfig_device *device)
15091509{
15101510   autoconfig_device *dev, **d;
15111511
15121512   /* validate the data */
1513   assert_always(mame_get_phase(Machine) == MAME_PHASE_INIT, "Can only call amiga_add_autoconfig at init time!");
1513   assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call amiga_add_autoconfig at init time!");
15141514   assert_always((device->size & (device->size - 1)) == 0, "device->size must be power of 2!");
15151515
15161516   /* allocate memory and link it in at the end of the list */
r3957r3958
15321532 *
15331533 *************************************/
15341534
1535static void autoconfig_reset(void)
1535static void autoconfig_reset(running_machine *machine)
15361536{
15371537   autoconfig_device *dev;
15381538
r3957r3958
15401540   for (dev = autoconfig_list; dev; dev = dev->next)
15411541      if (dev->base && dev->device.uninstall)
15421542      {
1543         (*dev->device.uninstall)(dev->base);
1543         (*dev->device.uninstall)(machine, dev->base);
15441544         dev->base = 0;
15451545      }
15461546
r3957r3958
16721672      case 0x40/4:
16731673         byte = 0x00;
16741674         if (cur_autoconfig->device.int_control_r)
1675            byte = (*cur_autoconfig->device.int_control_r)();
1675            byte = (*cur_autoconfig->device.int_control_r)(space->machine);
16761676         break;
16771677
16781678      default:
r3957r3958
17311731   {
17321732      logerror("Install to %06X\n", cur_autoconfig->base);
17331733      if (cur_autoconfig->base && cur_autoconfig->device.install)
1734         (*cur_autoconfig->device.install)(cur_autoconfig->base);
1734         (*cur_autoconfig->device.install)(space->machine, cur_autoconfig->base);
17351735      cur_autoconfig = cur_autoconfig->next;
17361736   }
17371737}
src/mame/machine/vertigo.c
r3957r3958
55*************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "vertigo.h"
109#include "exidy440.h"
1110#include "machine/74148.h"
r3957r3958
2120
2221static PIT8253_OUTPUT_CHANGED( v_irq4_w );
2322static PIT8253_OUTPUT_CHANGED( v_irq3_w );
24static void update_irq(void);
23static void update_irq(running_machine *machine);
2524
2625
2726
r3957r3958
7574 *
7675 *************************************/
7776
78static void update_irq(void)
77static void update_irq(running_machine *machine)
7978{
8079   if (irq_state < 7)
81      cpu_set_input_line(Machine->cpu[0], irq_state ^ 7, CLEAR_LINE);
80      cpu_set_input_line(machine->cpu[0], irq_state ^ 7, CLEAR_LINE);
8281
8382   irq_state = TTL74148_output_r(0);
8483
8584   if (irq_state < 7)
86      cpu_set_input_line(Machine->cpu[0], irq_state ^ 7, ASSERT_LINE);
85      cpu_set_input_line(machine->cpu[0], irq_state ^ 7, ASSERT_LINE);
8786}
8887
8988
90static void update_irq_encoder(int line, int state)
89static void update_irq_encoder(running_machine *machine, int line, int state)
9190{
9291   TTL74148_input_line_w(0, line, !state);
93   TTL74148_update(0);
92   TTL74148_update(machine, 0);
9493}
9594
9695
9796static PIT8253_OUTPUT_CHANGED( v_irq4_w )
9897{
99   update_irq_encoder(INPUT_LINE_IRQ4, state);
98   update_irq_encoder(device->machine, INPUT_LINE_IRQ4, state);
10099   vertigo_vproc(cpu_attotime_to_clocks(device->machine->cpu[0], attotime_sub(timer_get_time(device->machine), irq4_time)), state);
101100   irq4_time = timer_get_time(device->machine);
102101}
r3957r3958
107106   if (state)
108107      cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_IRQ0, ASSERT_LINE);
109108
110   update_irq_encoder(INPUT_LINE_IRQ3, state);
109   update_irq_encoder(device->machine, INPUT_LINE_IRQ3, state);
111110}
112111
113112
r3957r3958
127126   else
128127      adc_result = input_port_read(space->machine, adcnames[offset]);
129128
130   update_irq_encoder(INPUT_LINE_IRQ2, ASSERT_LINE);
129   update_irq_encoder(space->machine, INPUT_LINE_IRQ2, ASSERT_LINE);
131130   return 0;
132131}
133132
134133
135134READ16_HANDLER( vertigo_io_adc )
136135{
137   update_irq_encoder(INPUT_LINE_IRQ2, CLEAR_LINE);
136   update_irq_encoder(space->machine, INPUT_LINE_IRQ2, CLEAR_LINE);
138137   return adc_result;
139138}
140139
141140
142141READ16_HANDLER( vertigo_coin_r )
143142{
144   update_irq_encoder(INPUT_LINE_IRQ6, CLEAR_LINE);
143   update_irq_encoder(space->machine, INPUT_LINE_IRQ6, CLEAR_LINE);
145144   return (input_port_read(space->machine, "COIN"));
146145}
147146
r3957r3958
150149{
151150   /* Coin inputs cause IRQ6 */
152151   if ((input_port_read(device->machine, "COIN") & 0x7) < 0x7)
153      update_irq_encoder(INPUT_LINE_IRQ6, ASSERT_LINE);
152      update_irq_encoder(device->machine, INPUT_LINE_IRQ6, ASSERT_LINE);
154153}
155154
156155
r3957r3958
218217   for (i = 0; i < 8; i++)
219218      TTL74148_input_line_w(0, i, 1);
220219
221   TTL74148_update(0);
220   TTL74148_update(machine, 0);
222221   vertigo_vproc_init(machine);
223222
224223   irq4_time = timer_get_time(machine);
src/mame/machine/pcshare.c
r3957r3958
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "deprecat.h"
2524#include "machine/pcshare.h"
2625#include "machine/pckeybrd.h"
2726
2827#define VERBOSE_DBG 0       /* general debug messages */
2928#define DBG_LOG(N,M,A) \
30   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(Machine)),(char*)M ); logerror A; }
29   if(VERBOSE_DBG>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(pc_keyb.machine)),(char*)M ); logerror A; }
3130
3231#define VERBOSE_JOY 0      /* JOY (joystick port) */
3332#define JOY_LOG(N,M,A) \
34   if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(Machine)),(char*)M ); logerror A; }
33   if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time(pc_keyb.machine)),(char*)M ); logerror A; }
3534
3635
37static emu_timer *pc_keyboard_timer;
38static void (*set_keyb_int)(int);
3936static TIMER_CALLBACK( pc_keyb_timer );
4037
38/*
39   keyboard seams to permanently sent data clocked by the mainboard
40   clock line low for longer means "resync", keyboard sends 0xaa as answer
41   will become automatically 0x00 after a while
42*/
4143
42void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int))
44static struct {
45   running_machine *machine;
46   void (*int_cb)(running_machine *, int);
47   emu_timer *timer;
48   UINT8 data;
49   int on;
50   int self_test;
51} pc_keyb;
52
53
54
55void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(running_machine *, int))
4356{
4457   /* PC-XT keyboard */
4558   if (flags & PCCOMMON_KEYBOARD_AT)
r3957r3958
4861      at_keyboard_init(machine, AT_KEYBOARD_TYPE_PC);
4962   at_keyboard_set_scan_code_set(1);
5063
51   set_keyb_int = set_keyb_int_func;
52
53   pc_keyboard_timer = timer_alloc(machine, pc_keyb_timer, NULL);
64   memset(&pc_keyb, 0, sizeof(pc_keyb));
65   pc_keyb.machine = machine;
66   pc_keyb.int_cb = set_keyb_int_func;
67   pc_keyb.timer = timer_alloc(machine, pc_keyb_timer, NULL);
5468}
5569
56/*
57   keyboard seams to permanently sent data clocked by the mainboard
58   clock line low for longer means "resync", keyboard sends 0xaa as answer
59   will become automatically 0x00 after a while
60*/
61
62static struct {
63   UINT8 data;
64   int on;
65   int self_test;
66} pc_keyb= { 0 };
67
6870UINT8 pc_keyb_read(void)
6971{
7072   return pc_keyb.data;
r3957r3958
9294   if (pc_keyb.on != on)
9395   {
9496      if (!on)
95         timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC(5), 0);
97         timer_adjust_oneshot(pc_keyb.timer, ATTOTIME_IN_MSEC(5), 0);
9698      else {
9799         if ( pc_keyb.self_test ) {
98100            /* The self test of the keyboard takes some time. 2 msec seems to work. */
99101            /* This still needs to verified against a real keyboard. */
100            timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC( 2 ), 0);
102            timer_adjust_oneshot(pc_keyb.timer, ATTOTIME_IN_MSEC( 2 ), 0);
101103         } else {
102            timer_reset(pc_keyboard_timer, attotime_never);
104            timer_reset(pc_keyb.timer, attotime_never);
103105            pc_keyb.self_test = 0;
104106         }
105107      }
r3957r3958
111113void pc_keyb_clear(void)
112114{
113115   pc_keyb.data = 0;
114   if ( set_keyb_int ) {
115      set_keyb_int(0);
116   if ( pc_keyb.int_cb ) {
117      pc_keyb.int_cb(pc_keyb.machine, 0);
116118   }
117119}
118120
r3957r3958
127129      if ( (data=at_keyboard_read())!=-1) {
128130         pc_keyb.data = data;
129131         DBG_LOG(1,"KB_scancode",("$%02x\n", pc_keyb.data));
130         if ( set_keyb_int ) {
131            set_keyb_int(1);
132         if ( pc_keyb.int_cb ) {
133            pc_keyb.int_cb(pc_keyb.machine, 1);
132134         }
133135         pc_keyb.self_test = 0;
134136      }
src/mame/machine/atarigen.c
r3957r3958
535535    slapstic and sets the chip number.
536536---------------------------------------------------------------*/
537537
538void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum)
538void atarigen_slapstic_init(const device_config *device, offs_t base, offs_t mirror, int chipnum)
539539{
540540   /* reset in case we have no state */
541541   atarigen_slapstic_num = chipnum;
r3957r3958
545545   if (chipnum != 0)
546546   {
547547      /* initialize the slapstic */
548      slapstic_init(machine, chipnum);
548      slapstic_init(device->machine, chipnum);
549549
550550      /* install the memory handlers */
551      atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
551      atarigen_slapstic = memory_install_readwrite16_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), base, base + 0x7fff, 0, mirror, atarigen_slapstic_r, atarigen_slapstic_w);
552552
553553      /* allocate memory for a copy of bank 0 */
554554      atarigen_slapstic_bank0 = auto_malloc(0x2000);
r3957r3958
560560      /* install an opcode base handler if we are a 68000 or variant */
561561      atarigen_slapstic_base = base;
562562      atarigen_slapstic_mirror = mirror;
563      memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect);
563      memory_set_direct_update_handler(cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM), atarigen_slapstic_setdirect);
564564   }
565565}
566566
src/mame/machine/zs01.c
r3957r3958
88 */
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "machine/zs01.h"
1312
1413#define VERBOSE_LEVEL ( 0 )
r3957r3958
6766#define STATE_LOAD_COMMAND ( 2 )
6867#define STATE_READ_DATA ( 3 )
6968
70void zs01_init( int chip, UINT8 *data, zs01_write_handler write, zs01_read_handler read, UINT8 *ds2401 )
69void zs01_init( running_machine *machine, int chip, UINT8 *data, zs01_write_handler write, zs01_read_handler read, UINT8 *ds2401 )
7170{
72   running_machine *machine = Machine;
7371   int offset;
7472   struct zs01_chip *c;
7573
r3957r3958
134132   state_save_register_item_pointer( machine, "zs01", NULL, chip, c->data_key, SIZE_DATA );
135133}
136134
137void zs01_rst_write( int chip, int rst )
135void zs01_rst_write( running_machine *machine, int chip, int rst )
138136{
139   running_machine *machine = Machine;
140137   struct zs01_chip *c;
141138
142139   if( chip >= ZS01_MAXCHIP )
r3957r3958
161158   c->rst = rst;
162159}
163160
164void zs01_cs_write( int chip, int cs )
161void zs01_cs_write( running_machine *machine, int chip, int cs )
165162{
166   running_machine *machine = Machine;
167163   struct zs01_chip *c;
168164
169165   if( chip >= ZS01_MAXCHIP )
r3957r3958
391387   return block * SIZE_DATA_BUFFER;
392388}
393389
394void zs01_scl_write( int chip, int scl )
390void zs01_scl_write( running_machine *machine, int chip, int scl )
395391{
396   running_machine *machine = Machine;
397392   struct zs01_chip *c;
398393
399394   if( chip >= ZS01_MAXCHIP )
r3957r3958
601596   c->scl = scl;
602597}
603598
604void zs01_sda_write( int chip, int sda )
599void zs01_sda_write( running_machine *machine, int chip, int sda )
605600{
606   running_machine *machine = Machine;
607601   struct zs01_chip *c;
608602
609603   if( chip >= ZS01_MAXCHIP )
r3957r3958
649643   c->sdaw = sda;
650644}
651645
652int zs01_sda_read( int chip )
646int zs01_sda_read( running_machine *machine, int chip )
653647{
654   running_machine *machine = Machine;
655648   struct zs01_chip *c;
656649
657650   if( chip >= ZS01_MAXCHIP )
src/mame/machine/atarigen.h
r3957r3958
134134    SLAPSTIC HANDLING
135135---------------------------------------------------------------*/
136136
137void atarigen_slapstic_init(running_machine *machine, int cpunum, offs_t base, offs_t mirror, int chipnum);
137void atarigen_slapstic_init(const device_config *device, offs_t base, offs_t mirror, int chipnum);
138138void atarigen_slapstic_reset(void);
139139
140140WRITE16_HANDLER( atarigen_slapstic_w );
src/mame/machine/midwunit.c
r3957r3958
55**************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "cpu/tms34010/tms34010.h"
109#include "cpu/m6809/m6809.h"
1110#include "audio/dcs.h"
r3957r3958
3029
3130/* prototype */
3231static READ16_HANDLER( midwunit_sound_state_r );
33static void midxunit_dcs_output_full(int state);
32static void midxunit_dcs_output_full(running_machine *machine, int state);
3433
3534
3635
r3957r3958
254253 *
255254 *************************************/
256255
257void midxunit_dcs_output_full(int state)
256static void midxunit_dcs_output_full(running_machine *machine, int state)
258257{
259258   /* only signal if not in loopback state */
260259   if (uart[1] != 0x66)
261      cpu_set_input_line(Machine->cpu[0], 1, state ? ASSERT_LINE : CLEAR_LINE);
260      cpu_set_input_line(machine->cpu[0], 1, state ? ASSERT_LINE : CLEAR_LINE);
262261}
263262
264263
r3957r3958
647646
648647READ16_HANDLER( midwunit_security_r )
649648{
650   return midway_serial_pic_r();
649   return midway_serial_pic_r(space);
651650}
652651
653652
654653WRITE16_HANDLER( midwunit_security_w )
655654{
656655   if (offset == 0 && ACCESSING_BITS_0_7)
657      midway_serial_pic_w(data);
656      midway_serial_pic_w(space, data);
658657}
659658
660659
r3957r3958
668667WRITE16_HANDLER( midxunit_security_clock_w )
669668{
670669   if (offset == 0 && ACCESSING_BITS_0_7)
671      midway_serial_pic_w(((~data & 2) << 3) | security_bits);
670      midway_serial_pic_w(space, ((~data & 2) << 3) | security_bits);
672671}
673672
674673
src/mame/machine/zs01.h
r3957r3958
99
1010#define ZS01_MAXCHIP ( 2 )
1111
12typedef void (*zs01_write_handler)( int pin, int value );
13typedef int (*zs01_read_handler)( int pin );
12typedef void (*zs01_write_handler)( running_machine *machine, int pin, int value );
13typedef int (*zs01_read_handler)( running_machine *machine, int pin );
1414
15extern void zs01_init( int chip, UINT8 *data, zs01_write_handler write, zs01_read_handler read, UINT8 *ds2401 );
16extern void zs01_cs_write( int chip, int cs );
17extern void zs01_rst_write( int chip, int rst );
18extern void zs01_scl_write( int chip, int scl );
19extern void zs01_sda_write( int chip, int sda );
20extern int zs01_sda_read( int chip );
15extern void zs01_init( running_machine *machine, int chip, UINT8 *data, zs01_write_handler write, zs01_read_handler read, UINT8 *ds2401 );
16extern void zs01_cs_write( running_machine *machine, int chip, int cs );
17extern void zs01_rst_write( running_machine *machine, int chip, int rst );
18extern void zs01_scl_write( running_machine *machine, int chip, int scl );
19extern void zs01_sda_write( running_machine *machine, int chip, int sda );
20extern int zs01_sda_read( running_machine *machine, int chip );
2121extern NVRAM_HANDLER( zs01_0 );
2222extern NVRAM_HANDLER( zs01_1 );
2323
src/mame/machine/naomibd.c
r3957r3958
224224   {
225225      UINT64 ret;
226226
227      ret = x76f100_sda_read( 0 ) << 15;
227      ret = x76f100_sda_read( device->machine, 0 ) << 15;
228228
229229      return ret << 32;
230230   }
r3957r3958
273273   }
274274   else if ((offset == 15) && ACCESSING_BITS_0_15)
275275   {
276      running_machine *machine = device->machine;
277
276278      // NAOMI_BOARDID_WRITE
277      x76f100_cs_write(0, (data >> 2) & 1 );
278      x76f100_rst_write(0, (data >> 3) & 1 );
279      x76f100_scl_write(0, (data >> 1) & 1 );
280      x76f100_sda_write(0, (data >> 0) & 1 );
279      x76f100_cs_write(machine, 0, (data >> 2) & 1 );
280      x76f100_rst_write(machine, 0, (data >> 3) & 1 );
281      x76f100_scl_write(machine, 0, (data >> 1) & 1 );
282      x76f100_sda_write(machine, 0, (data >> 0) & 1 );
281283   }
282284   else if ((offset == 2) && ACCESSING_BITS_32_63)
283285   {
r3957r3958
629631         switch (config->type)
630632         {
631633            default:
632            case ROM_BOARD:               info->s = "Naomi Rom Board";         break;
633            case DIMM_BOARD:            info->s = "Naomi Dimm Board";         break;
634            case ROM_BOARD:               strcpy(info->s, "Naomi Rom Board");            break;
635            case DIMM_BOARD:            strcpy(info->s, "Naomi Dimm Board");         break;
634636         }
635637         break;
636      case DEVINFO_STR_FAMILY:            info->s = "Naomi plug-in board";      break;
637      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
638      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
639      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
638      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Naomi plug-in board");         break;
639      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                     break;
640      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                  break;
641      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
640642   }
641643}
src/mame/machine/tx1.c
r3957r3958
44
55***************************************************************************/
66#include "driver.h"
7#include "deprecat.h"
87#include "debugger.h"
98#include "machine/8255ppi.h"
109#include "tx1.h"
r3957r3958
188187   SN74S516.ZWfl = 0;
189188}
190189
191static void sn_divide(void)
190static void sn_divide(running_machine *machine)
192191{
193192   INT32 Z = 0;
194193   INT32 W = 0;
195194
196195   if ( SN74S516.X == 0 )
197196   {
198      mame_printf_debug("%s:SN74S516 tried to divide by zero\n", cpuexec_describe_context(Machine));
197      mame_printf_debug("%s:SN74S516 tried to divide by zero\n", cpuexec_describe_context(machine));
199198      SN74S516.ZW.Z = 0xffff;
200199      SN74S516.ZW.W = 0xffff;
201200      SN74S516.ZWfl = 0;
r3957r3958
237236   SN74S516.ZWfl = 0;
238237}
239238
240static void sn74s516_update(const int ins)
239static void sn74s516_update(running_machine *machine, int ins)
241240{
242241   SN74S516.state = state_table[SN74S516.state][ins];
243242
r3957r3958
248247   }
249248   else if ( SN74S516.state == 5 )
250249   {
251      sn_divide();
250      sn_divide(machine);
252251      SN74S516.state = 10;
253252   }
254253}
255254
256static void kick_sn74s516(UINT16 *data, const int ins)
255static void kick_sn74s516(running_machine *machine, UINT16 *data, const int ins)
257256{
258257
259258#define LOAD_X      (SN74S516.X = *data)
r3957r3958
279278         if (ins < 4)
280279         {
281280            LOAD_Y;
282            sn74s516_update(ins);
281            sn74s516_update(machine, ins);
283282         }
284283         else if (ins == 4)
285284         {
286            sn74s516_update(ins);
285            sn74s516_update(machine, ins);
287286         }
288287         else if (ins < 7)
289288         {
290289            LOAD_X;
291            sn74s516_update(ins);
290            sn74s516_update(machine, ins);
292291         }
293292         else if (ins == 7)
294293         {
r3957r3958
307306         if (ins < 4)
308307         {
309308            LOAD_Y;
310            sn74s516_update(ins);
309            sn74s516_update(machine, ins);
311310         }
312311         else if (ins == 4)
313312         {
314            sn74s516_update(ins);
313            sn74s516_update(machine, ins);
315314         }
316315         else if (ins == 5)
317316         {
318317            // Rounding
319318            // Operation
320            sn74s516_update(ins);
319            sn74s516_update(machine, ins);
321320         }
322321         else if (ins == 6)
323322         {
324323            LOAD_X;
325            sn74s516_update(ins);
324            sn74s516_update(machine, ins);
326325         }
327326         else if (ins == 7)
328327         {
329328            READ_ZW;
330            sn74s516_update(ins);
329            sn74s516_update(machine, ins);
331330         }
332331         break;
333332      }
r3957r3958
337336         if (SN74S516.code == 0x6666)
338337         {
339338            CLEAR_SEQUENCE;
340            mame_printf_debug("%s:Code 6666: PROMADDR:%x\n", cpuexec_describe_context(Machine), math.promaddr);
339            mame_printf_debug("%s:Code 6666: PROMADDR:%x\n", cpuexec_describe_context(machine), math.promaddr);
341340         }
342341
343342         UPDATE_SEQUENCE;
344343         if (ins < 4)
345344         {
346345            LOAD_Y;
347            sn74s516_update(ins);
346            sn74s516_update(machine, ins);
348347         }
349348         else if (ins < 6)
350349         {
351            sn74s516_update(ins);
350            sn74s516_update(machine, ins);
352351         }
353352         else if (ins == 6)
354353         {
355354            LOAD_Z;
356            sn74s516_update(ins);
355            sn74s516_update(machine, ins);
357356         }
358357         else if (ins == 7)
359358         {
360359            // Pointless operation.
361            sn74s516_update(ins);
360            sn74s516_update(machine, ins);
362361         }
363362
364363         break;
r3957r3958
369368         if (ins < 4)
370369         {
371370            LOAD_Y;
372            sn74s516_update(ins);
371            sn74s516_update(machine, ins);
373372         }
374373         else if (ins == 4)
375374         {
376375            LOAD_W;
377            sn74s516_update(ins);
376            sn74s516_update(machine, ins);
378377         }
379378         else if (ins == 5)
380379         {
381            sn74s516_update(ins);
380            sn74s516_update(machine, ins);
382381         }
383382         else if (ins == 6)
384383         {
385384            LOAD_W;
386            sn74s516_update(ins);
385            sn74s516_update(machine, ins);
387386         }
388387         else if (ins == 7)
389388         {
390389            READ_ZW;
391            sn74s516_update(ins);
390            sn74s516_update(machine, ins);
392391         }
393392         break;
394393      }
r3957r3958
398397         if (ins < 4)
399398         {
400399            LOAD_Y;
401            sn74s516_update(ins);
400            sn74s516_update(machine, ins);
402401         }
403402         else if (ins < 6)
404403         {
405            sn74s516_update(ins);
404            sn74s516_update(machine, ins);
406405         }
407406         else if (ins == 6)
408407         {
409408            // CHECK: Incomplete state
410            sn74s516_update(ins);
409            sn74s516_update(machine, ins);
411410         }
412411         else if (ins == 7)
413412         {
414413            /* 6667 = Load X, Load Z, Load W, Clear Z */
415414            SN74S516.ZW.Z = 0;
416            sn74s516_update(ins);
415            sn74s516_update(machine, ins);
417416         }
418417         break;
419418      }
r3957r3958
424423   }
425424
426425   math.dbgaddr = math.promaddr;
427   math.dbgpc = cpu_get_previouspc(Machine->cpu[1]);
426   math.dbgpc = cpu_get_previouspc(machine->cpu[1]);
428427}
429428
430429
r3957r3958
548547            else if ( dsel == 3 )
549548               data = ROL16(SWAP16(math.muxlatch), 3);
550549
551            kick_sn74s516(&data, ins);
550            kick_sn74s516(machine, &data, ins);
552551         }
553552         /*
554553                TODO: Changed ppshift to muxlatch for TX-1
r3957r3958
564563         {
565564            UINT16 data;
566565
567            kick_sn74s516(&data, ins);
566            kick_sn74s516(machine, &data, ins);
568567
569568            /* All latches enabled */
570569            if ( LHIEN(math.inslatch) && LLOEN(math.inslatch) )
r3957r3958
638637         {
639638            if ( math.mux == TX1_SEL_PPSEN )
640639            {
641               kick_sn74s516(&math.ppshift, ins);
640               kick_sn74s516(machine, &math.ppshift, ins);
642641            }
643642            else
644643            {
645644               /* Bus pullups give 0xffff */
646645               UINT16 data = 0xffff;
647               kick_sn74s516(&data, ins);
646               kick_sn74s516(machine, &data, ins);
648647            }
649648         }
650649      }
r3957r3958
677676      }
678677
679678      /* TODO What do we return? */
680      kick_sn74s516(&math.retval, ins);
679      kick_sn74s516(space->machine, &math.retval, ins);
681680   }
682681   /* /PPSEN */
683682   else if ( offset < 0x800 )
r3957r3958
794793         ins = (offset >> 1) & 7;
795794      }
796795
797      kick_sn74s516(&math.cpulatch, ins);
796      kick_sn74s516(space->machine, &math.cpulatch, ins);
798797   }
799798   /* /PPSEN */
800799   else if ( (offset & 0xc00) == 0x400 )
r3957r3958
872871      int ins = math.inslatch & 7;
873872
874873      TX1_SET_INS0_BIT;
875      kick_sn74s516(&math.cpulatch, ins);
874      kick_sn74s516(space->machine, &math.cpulatch, ins);
876875   }
877876   else if ( math.mux == TX1_SEL_PPSEN )
878877   {
r3957r3958
936935      int ins = math.inslatch & 7;
937936
938937      TX1_SET_INS0_BIT;
939      kick_sn74s516(&math.cpulatch, ins);
938      kick_sn74s516(space->machine, &math.cpulatch, ins);
940939   }
941940   else if ( math.mux == TX1_SEL_PPSEN )
942941   {
r3957r3958
10711070         {
10721071            UINT16 *romdata = (UINT16*)memory_region(machine, "user1");
10731072            UINT16 addr = get_bb_datarom_addr();
1074            kick_sn74s516(&romdata[addr], ins);
1073            kick_sn74s516(machine, &romdata[addr], ins);
10751074         }
10761075         else if ( math.mux == BB_MUX_PPOE )
10771076         {
1078            kick_sn74s516(&math.ppshift, ins);
1077            kick_sn74s516(machine, &math.ppshift, ins);
10791078         }
10801079         /* This is quite tricky. */
10811080         /* It can either be a read operation or */
r3957r3958
10841083         {
10851084            UINT16 data;
10861085
1087            kick_sn74s516(&data, ins);
1086            kick_sn74s516(machine, &data, ins);
10881087
10891088            if ( LHIEN(math.inslatch) && LLOEN(math.inslatch) )
10901089            {
r3957r3958
11211120         {
11221121            if ( math.mux == BB_MUX_PPSEN )
11231122            {
1124               kick_sn74s516(&math.ppshift, ins);
1123               kick_sn74s516(machine, &math.ppshift, ins);
11251124            }
11261125            else
11271126            {
11281127               /* Bus pullups give 0xffff */
11291128               UINT16 data = 0xffff;
1130               kick_sn74s516(&data, ins);
1129               kick_sn74s516(machine, &data, ins);
11311130            }
11321131         }
11331132      }
r3957r3958
11701169      }
11711170
11721171      /* TODO What do we return? */
1173      kick_sn74s516(&math.retval, ins);
1172      kick_sn74s516(space->machine, &math.retval, ins);
11741173
11751174      /* TODO */
11761175      //if (math.mux == BB_MUX_PPSEN)
r3957r3958
12471246         ins = (offset >> 1) & 7;
12481247      }
12491248
1250      kick_sn74s516(&math.cpulatch, ins);
1249      kick_sn74s516(space->machine, &math.cpulatch, ins);
12511250   }
12521251   /* /PPSEN */
12531252   else if ( (offset & 0xc00) == 0x400 )
r3957r3958
13261325      int ins = math.inslatch & 7;
13271326
13281327      BB_SET_INS0_BIT;
1329      kick_sn74s516(&math.cpulatch, ins);
1328      kick_sn74s516(space->machine, &math.cpulatch, ins);
13301329   }
13311330   else if ( math.mux == BB_MUX_PPSEN )
13321331   {
r3957r3958
13941393      int ins = math.inslatch & 7;
13951394
13961395      BB_SET_INS0_BIT;
1397      kick_sn74s516(&math.cpulatch, ins);
1396      kick_sn74s516(space->machine, &math.cpulatch, ins);
13981397   }
13991398   else if ( math.mux == BB_MUX_PPSEN )
14001399   {
src/mame/machine/mcr.c
r3957r3958
218218
219219const z80ctc_interface mcr_ctc_intf =
220220{
221   "main",            /* clock from the main CPU */
222   0,                 /* clock (filled in from the CPU 0 clock) */
223221   0,                 /* timer disables */
224222   ctc_interrupt,     /* interrupt handler */
225223   z80ctc_trg1_w,      /* ZC/TO0 callback */
r3957r3958
230228
231229const z80ctc_interface nflfoot_ctc_intf =
232230{
233   "ipu",            /* clock from the IPU cpu */
234   0,                  /* clock (filled in from the CPU 3 clock) */
235231   0,                  /* timer disables */
236232   ipu_ctc_interrupt,  /* interrupt handler */
237233   0,               /* ZC/TO0 callback */
r3957r3958
254250
255251const z80sio_interface nflfoot_sio_intf =
256252{
257   "ipu",            /* clock from the IPU cpu */
258   0,                  /* clock (filled in from the CPU 3 clock) */
259253   ipu_ctc_interrupt,   /* interrupt handler */
260254   0,               /* DTR changed handler */
261255   0,               /* RTS changed handler */
r3957r3958
290284   mcr_cocktail_flip = 0;
291285
292286   /* initialize the sound */
293   mcr_sound_reset();
287   mcr_sound_reset(machine);
294288}
295289
296290
r3957r3958
360354   mcr_cocktail_flip = 0;
361355
362356   /* initialize the sound */
363   mcr_sound_reset();
357   mcr_sound_reset(machine);
364358}
365359
366360
src/mame/machine/s24fd.c
r3957r3958
66*/
77
88#include "driver.h"
9#include "deprecat.h"
109#include "cpu/m68000/m68000.h"
1110#include "machine/fd1094.h"
1211
r3957r3958
3029   if it is then it copies the cached data to the user region where code is
3130   executed from, if its not cached then it gets decrypted to the current
3231   cache position using the functions in s24_fd1094.c */
33static void s24_fd1094_setstate_and_decrypt(int state)
32static void s24_fd1094_setstate_and_decrypt(running_machine *machine, int state)
3433{
3534   int i;
3635   UINT32 addr;
r3957r3958
4544
4645   fd1094_state = state;
4746
48   cpu_set_reg(Machine->cpu[1], M68K_PREF_ADDR, 0x0010);   // force a flush of the prefetch cache
47   cpu_set_reg(machine->cpu[1], M68K_PREF_ADDR, 0x0010);   // force a flush of the prefetch cache
4948
5049   /* set the s24_fd1094 state ready to decrypt.. */
5150   state = fd1094_set_state(s24_fd1094_key,state) & 0xff;
r3957r3958
5756      {
5857         /* copy cached state */
5958         s24_fd1094_userregion=s24_fd1094_cacheregion[i];
60         memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
61         m68k_set_encrypted_opcode_range(Machine->cpu[1],0,s24_fd1094_cpuregionsize);
59         memory_set_decrypted_region(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
60         m68k_set_encrypted_opcode_range(machine->cpu[1],0,s24_fd1094_cpuregionsize);
6261
6362         return;
6463      }
r3957r3958
7877
7978   /* copy newly decrypted data to user region */
8079   s24_fd1094_userregion=s24_fd1094_cacheregion[fd1094_current_cacheposition];
81   memory_set_decrypted_region(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
82   m68k_set_encrypted_opcode_range(Machine->cpu[1],0,s24_fd1094_cpuregionsize);
80   memory_set_decrypted_region(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), 0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
81   m68k_set_encrypted_opcode_range(machine->cpu[1],0,s24_fd1094_cpuregionsize);
8382
8483   fd1094_current_cacheposition++;
8584
r3957r3958
9594{
9695   if (reg == 0 && (val & 0x0000ffff) == 0x0000ffff) // ?
9796   {
98      s24_fd1094_setstate_and_decrypt((val & 0xffff0000) >> 16);
97      s24_fd1094_setstate_and_decrypt(device->machine, (val & 0xffff0000) >> 16);
9998   }
10099}
101100
102101/* Callback when the s24_fd1094 enters interrupt code */
103102static IRQ_CALLBACK(s24_fd1094_int_callback)
104103{
105   s24_fd1094_setstate_and_decrypt(FD1094_STATE_IRQ);
104   s24_fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_IRQ);
106105   return (0x60+irqline*4)/4; // vector address
107106}
108107
109108static void s24_fd1094_rte_callback (const device_config *device)
110109{
111   s24_fd1094_setstate_and_decrypt(FD1094_STATE_RTE);
110   s24_fd1094_setstate_and_decrypt(device->machine, FD1094_STATE_RTE);
112111}
113112
114113
r3957r3958
123122
124123
125124/* function, to be called from MACHINE_RESET (every reset) */
126void s24_fd1094_machine_init(void)
125void s24_fd1094_machine_init(running_machine *machine)
127126{
128127   /* punt if no key; this allows us to be called even for non-s24_fd1094 games */
129128   if (!s24_fd1094_key)
130129      return;
131130
132   s24_fd1094_setstate_and_decrypt(FD1094_STATE_RESET);
131   s24_fd1094_setstate_and_decrypt(machine, FD1094_STATE_RESET);
133132   s24_fd1094_kludge_reset_values();
134133
135   cpu_set_info_fct(Machine->cpu[1], CPUINFO_PTR_M68K_CMPILD_CALLBACK, (genf *)s24_fd1094_cmp_callback);
136   cpu_set_info_fct(Machine->cpu[1], CPUINFO_PTR_M68K_RTE_CALLBACK, (genf *)s24_fd1094_rte_callback);
137   cpu_set_irq_callback(Machine->cpu[1], s24_fd1094_int_callback);
134   device_set_info_fct(machine->cpu[1], CPUINFO_FCT_M68K_CMPILD_CALLBACK, (genf *)s24_fd1094_cmp_callback);
135   device_set_info_fct(machine->cpu[1], CPUINFO_FCT_M68K_RTE_CALLBACK, (genf *)s24_fd1094_rte_callback);
136   cpu_set_irq_callback(machine->cpu[1], s24_fd1094_int_callback);
138137
139   cpu_reset(Machine->cpu[1]);
138   device_reset(machine->cpu[1]);
140139}
141140
142141static STATE_POSTLOAD( s24_fd1094_postload )
r3957r3958
146145      int selected_state = fd1094_selected_state;
147146      int state = fd1094_state;
148147
149      s24_fd1094_machine_init();
148      s24_fd1094_machine_init(machine);
150149
151      s24_fd1094_setstate_and_decrypt(selected_state);
152      s24_fd1094_setstate_and_decrypt(state);
150      s24_fd1094_setstate_and_decrypt(machine, selected_state);
151      s24_fd1094_setstate_and_decrypt(machine, state);
153152   }
154153}
155154
src/mame/machine/galaxold.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "deprecat.h"
1211#include "machine/7474.h"
1312#include "includes/galaxold.h"
1413
r3957r3958
1716
1817static UINT8 _4in1_bank;
1918
20static void galaxold_7474_9M_2_callback(void)
19static void galaxold_7474_9M_2_callback(running_machine *machine)
2120{
2221   /* Q bar clocks the other flip-flop,
2322       Q is VBLANK (not visible to the CPU) */
2423   TTL7474_clock_w(1, TTL7474_output_comp_r(0));
25   TTL7474_update(1);
24   TTL7474_update(machine, 1);
2625}
2726
28static void galaxold_7474_9M_1_callback(void)
27static void galaxold_7474_9M_1_callback(running_machine *machine)
2928{
3029   /* Q goes to the NMI line */
31   cpu_set_input_line(Machine->cpu[0], irq_line, TTL7474_output_r(1) ? CLEAR_LINE : ASSERT_LINE);
30   cpu_set_input_line(machine->cpu[0], irq_line, TTL7474_output_r(1) ? CLEAR_LINE : ASSERT_LINE);
3231}
3332
3433static const struct TTL7474_interface galaxold_7474_9M_2_intf =
r3957r3958
4544WRITE8_HANDLER( galaxold_nmi_enable_w )
4645{
4746   TTL7474_preset_w(1, data);
48   TTL7474_update(1);
47   TTL7474_update(space->machine, 1);
4948}
5049
5150
r3957r3958
6160
6261   timer_adjust_oneshot(int_timer, video_screen_get_time_until_pos(machine->primary_screen, param, 0), param);
6362
64   TTL7474_update(0);
63   TTL7474_update(machine, 0);
6564}
6665
6766
src/mame/machine/harddriv.c
r3957r3958
55****************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "cpu/tms34010/tms34010.h"
109#include "cpu/adsp2100/adsp2100.h"
1110#include "cpu/m68000/m68000.h"
r3957r3958
14151414 *
14161415 *************************************/
14171416
1418void hddsk_update_pif(UINT32 pins)
1417void hddsk_update_pif(const device_config *device, UINT32 pins)
14191418{
14201419   atarigen_sound_int_state = ((pins & DSP32_OUTPUT_PIF) != 0);
1421   hd68k_update_interrupts(Machine);
1420   hd68k_update_interrupts(device->machine);
14221421}
14231422
14241423
src/mame/machine/psx.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "cpu/mips/psx.h"
1211#include "includes/psx.h"
1312
r3957r3958
225224            n_address &= n_adrmask;
226225            n_nextaddress = g_p_n_psxram[ n_address / 4 ];
227226            n_size = n_nextaddress >> 24;
228            m_p_fn_dma_write[ n_channel ]( n_address + 4, n_size );
227            m_p_fn_dma_write[ n_channel ]( machine, n_address + 4, n_size );
229228            //FIXME:
230229            // The following conditions will cause an endless loop.
231230            // If stopping the transfer is correct I cannot judge
r3957r3958
312311               m_p_fn_dma_read[ n_channel ] != NULL )
313312            {
314313               verboselog( machine, 1, "dma %d read block %08x %08x\n", n_channel, n_address, n_size );
315               m_p_fn_dma_read[ n_channel ]( n_address, n_size );
316               dma_finished( space->machine, n_channel );
314               m_p_fn_dma_read[ n_channel ]( space->machine, n_address, n_size );
315               dma_finished( machine, n_channel );
317316            }
318317            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x01000200 &&
319318               m_p_fn_dma_read[ n_channel ] != NULL )
320319            {
321320               verboselog( machine, 1, "dma %d read block %08x %08x\n", n_channel, n_address, n_size );
322               m_p_fn_dma_read[ n_channel ]( n_address, n_size );
321               m_p_fn_dma_read[ n_channel ]( space->machine, n_address, n_size );
323322               if( n_channel == 1 )
324323               {
325324                  dma_start_timer( n_channel, 26000 );
326325               }
327326               else
328327               {
329                  dma_finished( space->machine, n_channel );
328                  dma_finished( machine, n_channel );
330329               }
331330            }
332331            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x01000201 &&
333332               m_p_fn_dma_write[ n_channel ] != NULL )
334333            {
335334               verboselog( machine, 1, "dma %d write block %08x %08x\n", n_channel, n_address, n_size );
336               m_p_fn_dma_write[ n_channel ]( n_address, n_size );
337               dma_finished( space->machine, n_channel );
335               m_p_fn_dma_write[ n_channel ]( space->machine, n_address, n_size );
336               dma_finished( machine, n_channel );
338337            }
339338            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x11050100 &&
340339               m_p_fn_dma_write[ n_channel ] != NULL )
341340            {
342341               /* todo: check this is a write not a read... */
343342               verboselog( machine, 1, "dma %d write block %08x %08x\n", n_channel, n_address, n_size );
344               m_p_fn_dma_write[ n_channel ]( n_address, n_size );
345               dma_finished( space->machine, n_channel );
343               m_p_fn_dma_write[ n_channel ]( space->machine, n_address, n_size );
344               dma_finished( machine, n_channel );
346345            }
347346            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x11150100 &&
348347               m_p_fn_dma_write[ n_channel ] != NULL )
349348            {
350349               /* todo: check this is a write not a read... */
351350               verboselog( machine, 1, "dma %d write block %08x %08x\n", n_channel, n_address, n_size );
352               m_p_fn_dma_write[ n_channel ]( n_address, n_size );
353               dma_finished( space->machine, n_channel );
351               m_p_fn_dma_write[ n_channel ]( space->machine, n_address, n_size );
352               dma_finished( machine, n_channel );
354353            }
355354            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x01000401 &&
356355               n_channel == 2 &&
r3957r3958
359358               verboselog( machine, 1, "dma %d write linked list %08x\n",
360359                  n_channel, m_p_n_dmabase[ n_channel ] );
361360
362               dma_finished( space->machine, n_channel );
361               dma_finished( machine, n_channel );
363362            }
364363            else if( m_p_n_dmachannelcontrol[ n_channel ] == 0x11000002 &&
365364               n_channel == 6 )
r3957r3958
483482#define RC_CLC ( 0x100 )
484483#define RC_DIV ( 0x200 )
485484
486static UINT64 psxcpu_gettotalcycles( void )
485static UINT64 psxcpu_gettotalcycles( running_machine *machine )
487486{
488487   /* TODO: should return the start of the current tick. */
489   return cpu_get_total_cycles(Machine->cpu[0]) * 2;
488   return cpu_get_total_cycles(machine->cpu[0]) * 2;
490489}
491490
492491static int root_divider( int n_counter )
r3957r3958
507506   return 1;
508507}
509508
510static UINT16 root_current( int n_counter )
509static UINT16 root_current( running_machine *machine, int n_counter )
511510{
512511   if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 )
513512   {
r3957r3958
516515   else
517516   {
518517      UINT64 n_current;
519      n_current = psxcpu_gettotalcycles() - m_p_n_root_start[ n_counter ];
518      n_current = psxcpu_gettotalcycles(machine) - m_p_n_root_start[ n_counter ];
520519      n_current /= root_divider( n_counter );
521520      n_current += m_p_n_root_count[ n_counter ];
522521      if( n_current > 0xffff )
523522      {
524523         /* TODO: use timer for wrap on 0x10000. */
525524         m_p_n_root_count[ n_counter ] = n_current;
526         m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
525         m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(machine);
527526      }
528527      return n_current;
529528   }
r3957r3958
539538   return 0x10000;
540539}
541540
542static void root_timer_adjust( int n_counter )
541static void root_timer_adjust( running_machine *machine, int n_counter )
543542{
544543   if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 )
545544   {
r3957r3958
549548   {
550549      int n_duration;
551550
552      n_duration = root_target( n_counter ) - root_current( n_counter );
551      n_duration = root_target( n_counter ) - root_current( machine, n_counter );
553552      if( n_duration < 1 )
554553      {
555554         n_duration += 0x10000;
r3957r3958
565564{
566565   int n_counter = param;
567566
568   verboselog( machine, 2, "root_finished( %d ) %04x\n", n_counter, root_current( n_counter ) );
567   verboselog( machine, 2, "root_finished( %d ) %04x\n", n_counter, root_current( machine, n_counter ) );
569568//  if( ( m_p_n_root_mode[ n_counter ] & RC_COUNTTARGET ) != 0 )
570569   {
571570      /* TODO: wrap should be handled differently as RC_COUNTTARGET & RC_IRQTARGET don't have to be the same. */
572571      m_p_n_root_count[ n_counter ] = 0;
573      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
572      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(machine);
574573   }
575574   if( ( m_p_n_root_mode[ n_counter ] & RC_REPEAT ) != 0 )
576575   {
577      root_timer_adjust( n_counter );
576      root_timer_adjust( machine, n_counter );
578577   }
579578   if( ( m_p_n_root_mode[ n_counter ] & RC_IRQOVERFLOW ) != 0 ||
580579      ( m_p_n_root_mode[ n_counter ] & RC_IRQTARGET ) != 0 )
r3957r3958
595594   {
596595   case 0:
597596      m_p_n_root_count[ n_counter ] = data;
598      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
597      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(space->machine);
599598      break;
600599   case 1:
601      m_p_n_root_count[ n_counter ] = root_current( n_counter );
602      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
600      m_p_n_root_count[ n_counter ] = root_current( space->machine, n_counter );
601      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(space->machine);
603602      m_p_n_root_mode[ n_counter ] = data;
604603
605604      if( ( m_p_n_root_mode[ n_counter ] & RC_RESET ) != 0 )
r3957r3958
621620      return;
622621   }
623622
624   root_timer_adjust( n_counter );
623   root_timer_adjust( space->machine, n_counter );
625624}
626625
627626READ32_HANDLER( psx_counter_r )
r3957r3958
634633   switch( offset % 4 )
635634   {
636635   case 0:
637      data = root_current( n_counter );
636      data = root_current( space->machine, n_counter );
638637      break;
639638   case 1:
640639      data = m_p_n_root_mode[ n_counter ];
r3957r3958
701700   }
702701}
703702
704static void sio_timer_adjust( int n_port )
703static void sio_timer_adjust( running_machine *machine, int n_port )
705704{
706   running_machine *machine = Machine;
707705   attotime n_time;
708706   if( ( m_p_n_sio_status[ n_port ] & SIO_STATUS_TX_EMPTY ) == 0 || m_p_n_sio_tx_bits[ n_port ] != 0 )
709707   {
r3957r3958
775773         if( n_port == 0 )
776774         {
777775            m_p_n_sio_tx[ n_port ] &= ~PSX_SIO_OUT_CLOCK;
778            m_p_f_sio_handler[ n_port ]( m_p_n_sio_tx[ n_port ] );
776            m_p_f_sio_handler[ n_port ]( machine, m_p_n_sio_tx[ n_port ] );
779777            m_p_n_sio_tx[ n_port ] |= PSX_SIO_OUT_CLOCK;
780778         }
781         m_p_f_sio_handler[ n_port ]( m_p_n_sio_tx[ n_port ] );
779         m_p_f_sio_handler[ n_port ]( machine, m_p_n_sio_tx[ n_port ] );
782780      }
783781
784782      if( m_p_n_sio_tx_bits[ n_port ] == 0 &&
r3957r3958
811809      }
812810   }
813811
814   sio_timer_adjust( n_port );
812   sio_timer_adjust( machine, n_port );
815813}
816814
817815void psx_sio_input( running_machine *machine, int n_port, int n_mask, int n_data )
r3957r3958
849847      m_p_n_sio_tx_data[ n_port ] = data;
850848      m_p_n_sio_status[ n_port ] &= ~( SIO_STATUS_TX_RDY );
851849      m_p_n_sio_status[ n_port ] &= ~( SIO_STATUS_TX_EMPTY );
852      sio_timer_adjust( n_port );
850      sio_timer_adjust( machine, n_port );
853851      break;
854852   case 1:
855853      verboselog( machine, 0, "psx_sio_w( %08x, %08x, %08x )\n", offset, data, mem_mask );
r3957r3958
890888         {
891889            if( m_p_f_sio_handler[ n_port ] != NULL )
892890            {
893               m_p_f_sio_handler[ n_port ]( m_p_n_sio_tx[ n_port ] );
891               m_p_f_sio_handler[ n_port ]( space->machine, m_p_n_sio_tx[ n_port ] );
894892            }
895893         }
896894         m_p_n_sio_tx_prev[ n_port ] = m_p_n_sio_tx[ n_port ];
r3957r3958
13391337   mdec_decoded = ( 24 * 16 ) / 2;
13401338}
13411339
1342static void mdec0_write( UINT32 n_address, INT32 n_size )
1340static void mdec0_write( running_machine *machine, UINT32 n_address, INT32 n_size )
13431341{
1344   running_machine *machine = Machine;
13451342   int n_index;
13461343
13471344   verboselog( machine, 2, "mdec0_write( %08x, %08x )\n", n_address, n_size );
r3957r3958
13961393   }
13971394}
13981395
1399static void mdec1_read( UINT32 n_address, INT32 n_size )
1396static void mdec1_read( running_machine *machine, UINT32 n_address, INT32 n_size )
14001397{
14011398   UINT32 n_this;
14021399   UINT32 n_nextaddress;
14031400
1404   verboselog( Machine, 2, "mdec1_read( %08x, %08x )\n", n_address, n_size );
1401   verboselog( machine, 2, "mdec1_read( %08x, %08x )\n", n_address, n_size );
14051402   if( ( m_n_mdec0_command & ( 1L << 29 ) ) != 0 && m_n_mdec0_size != 0 )
14061403   {
14071404      while( n_size > 0 )
r3957r3958
14841481   return 0;
14851482}
14861483
1487static void gpu_read( UINT32 n_address, INT32 n_size )
1484static void gpu_read( running_machine *machine, UINT32 n_address, INT32 n_size )
14881485{
1489   psx_gpu_read( &g_p_n_psxram[ n_address / 4 ], n_size );
1486   psx_gpu_read( machine, &g_p_n_psxram[ n_address / 4 ], n_size );
14901487}
14911488
1492static void gpu_write( UINT32 n_address, INT32 n_size )
1489static void gpu_write( running_machine *machine, UINT32 n_address, INT32 n_size )
14931490{
1494   psx_gpu_write( &g_p_n_psxram[ n_address / 4 ], n_size );
1491   psx_gpu_write( machine, &g_p_n_psxram[ n_address / 4 ], n_size );
14951492}
14961493
14971494void psx_machine_init( running_machine *machine )
r3957r3958
15511548
15521549   for( n = 0; n < 3; n++ )
15531550   {
1554      root_timer_adjust( n );
1551      root_timer_adjust( machine, n );
15551552   }
15561553
15571554   for( n = 0; n < 2; n++ )
15581555   {
1559      sio_timer_adjust( n );
1556      sio_timer_adjust( machine, n );
15601557   }
15611558
15621559   mdec_cos_precalc();
r3957r3958
15681565
15691566   for( n = 0; n < 7; n++ )
15701567   {
1571      m_p_timer_dma[ n ] = timer_alloc( machine, dma_finished_callback , NULL);
1568      m_p_timer_dma[ n ] = timer_alloc( machine, dma_finished_callback, machine );
15721569      m_p_fn_dma_read[ n ] = NULL;
15731570      m_p_fn_dma_write[ n ] = NULL;
15741571   }
src/mame/machine/williams.c
r3957r3958
933933
934934MACHINE_START( joust2 )
935935{
936   williams_cvsd_init(3);
936   williams_cvsd_init(machine, 3);
937937}
938938
939939
r3957r3958
963963static WRITE8_HANDLER( joust2_snd_cmd_w )
964964{
965965   joust2_current_sound_data = (joust2_current_sound_data & ~0xff) | (data & 0xff);
966   williams_cvsd_data_w(joust2_current_sound_data);
966   williams_cvsd_data_w(space->machine, joust2_current_sound_data);
967967   timer_call_after_resynch(space->machine, NULL, joust2_current_sound_data, joust2_deferred_snd_cmd_w);
968968}
src/mame/machine/system16.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "system16.h"
43#include "sound/upd7759.h"
54
r3957r3958
98UINT16 *sys16_extraram2;
109UINT16 *sys16_extraram3;
1110
12static void patch_codeX( int offset, int data, const char *cpu ){
11static void patch_codeX( UINT16 *mem, offs_t offset, int data ){
1312   int aligned_offset = offset&0xfffffe;
14   UINT16 *mem = (UINT16 *)memory_region(Machine, cpu);
1513   int old_word = mem[aligned_offset/2];
1614
1715   if( offset&1 )
r3957r3958
2220   mem[aligned_offset/2] = data;
2321}
2422
25void sys16_patch_code( int offset, int data ){
26   patch_codeX(offset,data,"main");
23void sys16_patch_code( running_machine *machine, const sys16_patch *data, int count ){
24   int i;
25   UINT16 *mem = (UINT16 *)memory_region(machine, "main");
26   for (i=0; i<count; i++)
27      patch_codeX(mem, data[i].offset, data[i].data);
2728}
2829
2930
r3957r3958
5455
5556/* sound */
5657
57static void sound_cause_nmi( int chip ){
58static void sound_cause_nmi( const device_config *device, int chip ){
5859   /* upd7759 callback */
59   cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
60   cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
6061}
6162
6263
src/mame/machine/wrally.c
r3957r3958
2828
2929WRITE16_HANDLER( wrally_flipscreen_w )
3030{
31   flip_screen_set(data & 0x01);
31   flip_screen_set(space->machine, data & 0x01);
3232}
3333
3434WRITE16_HANDLER( OKIM6295_bankswitch_w )
src/mame/machine/model1.c
r3957r3958
33*/
44
55#include "driver.h"
6#include "deprecat.h"
76#include "debugger.h"
87#include "cpu/mb86233/mb86233.h"
98#include "cpu/v60/v60.h"
109#include "includes/model1.h"
1110
11#define TGP_FUNCTION(name) void name(running_machine *machine)
12typedef void (*tgp_func)(running_machine *machine);
13
14
1215enum {FIFO_SIZE = 256};
1316enum {MAT_STACK_SIZE = 32};
1417
r3957r3958
2124static int model1_swa;
2225
2326static int fifoin_cbcount;
24static void (*fifoin_cb)(void);
27static tgp_func fifoin_cb;
2528
2629static INT32 fifoout_rpos, fifoout_wpos;
2730static UINT32 fifoout_data[FIFO_SIZE];
r3957r3958
9598      logerror("TGP FIFOIN overflow\n");
9699   fifoin_cbcount--;
97100   if(!fifoin_cbcount)
98      fifoin_cb();
101      fifoin_cb(space->machine);
99102}
100103
101104static float fifoin_pop_f(void)
r3957r3958
103106   return u2f(fifoin_pop());
104107}
105108
106static void function_get_vf(void);
107static void function_get_swa(void);
109static TGP_FUNCTION( function_get_vf );
110static TGP_FUNCTION( function_get_swa );
108111
109112static void next_fn(void)
110113{
r3957r3958
146149   return u2f(ram_data[ram_scanadr++]);
147150}
148151
149static void fadd(void)
152static TGP_FUNCTION( fadd )
150153{
151154   float a = fifoin_pop_f();
152155   float b = fifoin_pop_f();
r3957r3958
156159   next_fn();
157160}
158161
159static void fsub(void)
162static TGP_FUNCTION( fsub )
160163{
161164   float a = fifoin_pop_f();
162165   float b = fifoin_pop_f();
r3957r3958
167170   next_fn();
168171}
169172
170static void fmul(void)
173static TGP_FUNCTION( fmul )
171174{
172175   float a = fifoin_pop_f();
173176   float b = fifoin_pop_f();
r3957r3958
177180   next_fn();
178181}
179182
180static void fdiv(void)
183static TGP_FUNCTION( fdiv )
181184{
182185   float a = fifoin_pop_f();
183186   float b = fifoin_pop_f();
r3957r3958
188191   next_fn();
189192}
190193
191static void matrix_push(void)
194static TGP_FUNCTION( matrix_push )
192195{
193196   if(mat_stack_pos != MAT_STACK_SIZE) {
194197      memcpy(mat_stack[mat_stack_pos], cmat, sizeof(cmat));
r3957r3958
198201   next_fn();
199202}
200203
201static void matrix_pop(void)
204static TGP_FUNCTION( matrix_pop )
202205{
203206   if(mat_stack_pos) {
204207      mat_stack_pos--;
r3957r3958
208211   next_fn();
209212}
210213
211static void matrix_write(void)
214static TGP_FUNCTION( matrix_write )
212215{
213216   int i;
214217   for(i=0; i<12; i++)
r3957r3958
219222   next_fn();
220223}
221224
222static void clear_stack(void)
225static TGP_FUNCTION( clear_stack )
223226{
224227   logerror("TGP clear_stack (%x)\n", pushpc);
225228   mat_stack_pos = 0;
226229   next_fn();
227230}
228231
229static void matrix_mul(void)
232static TGP_FUNCTION( matrix_mul )
230233{
231234   float m[12];
232235   float a = fifoin_pop_f();
r3957r3958
259262   next_fn();
260263}
261264
262static void anglev(void)
265static TGP_FUNCTION( anglev )
263266{
264267   float a = fifoin_pop_f();
265268   float b = fifoin_pop_f();
r3957r3958
279282   next_fn();
280283}
281284
282static void f11(void)
285static TGP_FUNCTION( f11 )
283286{
284287   float a = fifoin_pop_f();
285288   float b = fifoin_pop_f();
r3957r3958
306309   next_fn();
307310}
308311
309static void normalize(void)
312static TGP_FUNCTION( normalize )
310313{
311314   float a = fifoin_pop_f();
312315   float b = fifoin_pop_f();
r3957r3958
319322   next_fn();
320323}
321324
322static void acc_seti(void)
325static TGP_FUNCTION( acc_seti )
323326{
324327   INT32 a = fifoin_pop();
325328   model1_dump = 1;
r3957r3958
328331   next_fn();
329332}
330333
331static void track_select(void)
334static TGP_FUNCTION( track_select )
332335{
333336   INT32 a = fifoin_pop();
334337   logerror("TGP track_select %d (%x)\n", a, pushpc);
r3957r3958
336339   next_fn();
337340}
338341
339static void f14(void)
342static TGP_FUNCTION( f14 )
340343{
341344   tgp_vr_base[0] = fifoin_pop_f();
342345   tgp_vr_base[1] = fifoin_pop_f();
r3957r3958
346349   next_fn();
347350}
348351
349static void f15_swa(void)
352static TGP_FUNCTION( f15_swa )
350353{
351354   logerror("TGP f15_swa (%x)\n", pushpc);
352355
353356   next_fn();
354357}
355358
356static void anglep(void)
359static TGP_FUNCTION( anglep )
357360{
358361   float a = fifoin_pop_f();
359362   float b = fifoin_pop_f();
r3957r3958
377380   next_fn();
378381}
379382
380static void matrix_ident(void)
383static TGP_FUNCTION( matrix_ident )
381384{
382385   logerror("TGP matrix_ident (%x)\n", pushpc);
383386   memset(cmat, 0, sizeof(cmat));
r3957r3958
387390   next_fn();
388391}
389392
390static void matrix_read(void)
393static TGP_FUNCTION( matrix_read )
391394{
392395   int i;
393396   logerror("TGP matrix_read (%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f) (%x)\n",
r3957r3958
397400   next_fn();
398401}
399402
400static void matrix_trans(void)
403static TGP_FUNCTION( matrix_trans )
401404{
402405   float a = fifoin_pop_f();
403406   float b = fifoin_pop_f();
r3957r3958
409412   next_fn();
410413}
411414
412static void matrix_scale(void)
415static TGP_FUNCTION( matrix_scale )
413416{
414417   float a = fifoin_pop_f();
415418   float b = fifoin_pop_f();
r3957r3958
427430   next_fn();
428431}
429432
430static void matrix_rotx(void)
433static TGP_FUNCTION( matrix_rotx )
431434{
432435   INT16 a = fifoin_pop();
433436   float s = tsin(a);
r3957r3958
449452   next_fn();
450453}
451454
452static void matrix_roty(void)
455static TGP_FUNCTION( matrix_roty )
453456{
454457   INT16 a = fifoin_pop();
455458   float s = tsin(a);
r3957r3958
472475   next_fn();
473476}
474477
475static void matrix_rotz(void)
478static TGP_FUNCTION( matrix_rotz )
476479{
477480   INT16 a = fifoin_pop();
478481   float s = tsin(a);
r3957r3958
495498   next_fn();
496499}
497500
498static void track_read_quad(void)
501static TGP_FUNCTION( track_read_quad )
499502{
500   const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, "user2");
503   const UINT32 *tgp_data = (const UINT32 *)memory_region(machine, "user2");
501504   UINT32 a = fifoin_pop();
502505   int offd;
503506
r3957r3958
519522   next_fn();
520523}
521524
522static void f24_swa(void)
525static TGP_FUNCTION( f24_swa )
523526{
524527   float a = fifoin_pop_f();
525528   float b = fifoin_pop_f();
r3957r3958
540543   next_fn();
541544}
542545
543static void transform_point(void)
546static TGP_FUNCTION( transform_point )
544547{
545548   float x = fifoin_pop_f();
546549   float y = fifoin_pop_f();
r3957r3958
553556   next_fn();
554557}
555558
556static void fcos_m1(void)
559static TGP_FUNCTION( fcos_m1 )
557560{
558561    INT16 a = fifoin_pop();
559562   logerror("TGP fcos %d (%x)\n", a, pushpc);
r3957r3958
561564   next_fn();
562565}
563566
564static void fsin_m1(void)
567static TGP_FUNCTION( fsin_m1 )
565568{
566569    INT16 a = fifoin_pop();
567570   logerror("TGP fsin %d (%x)\n", a, pushpc);
r3957r3958
569572   next_fn();
570573}
571574
572static void fcosm_m1(void)
575static TGP_FUNCTION( fcosm_m1 )
573576{
574577    INT16 a = fifoin_pop();
575578   float b = fifoin_pop_f();
r3957r3958
578581   next_fn();
579582}
580583
581static void fsinm_m1(void)
584static TGP_FUNCTION( fsinm_m1 )
582585{
583586    INT16 a = fifoin_pop();
584587   float b = fifoin_pop_f();
r3957r3958
588591   next_fn();
589592}
590593
591static void distance3(void)
594static TGP_FUNCTION( distance3 )
592595{
593596   float a = fifoin_pop_f();
594597   float b = fifoin_pop_f();
r3957r3958
604607   next_fn();
605608}
606609
607static void ftoi(void)
610static TGP_FUNCTION( ftoi )
608611{
609612   float a = fifoin_pop_f();
610613   logerror("TGP ftoi %f (%x)\n", a, pushpc);
r3957r3958
612615   next_fn();
613616}
614617
615static void itof(void)
618static TGP_FUNCTION( itof )
616619{
617620   INT32 a = fifoin_pop();
618621   logerror("TGP itof %d (%x)\n", a, pushpc);
r3957r3958
620623   next_fn();
621624}
622625
623static void acc_set(void)
626static TGP_FUNCTION( acc_set )
624627{
625628   float a = fifoin_pop_f();
626629   logerror("TGP acc_set %f (%x)\n", a, pushpc);
r3957r3958
628631   next_fn();
629632}
630633
631static void acc_get(void)
634static TGP_FUNCTION( acc_get )
632635{
633636   logerror("TGP acc_get (%x)\n", pushpc);
634637   fifoout_push_f(acc);
635638   next_fn();
636639}
637640
638static void acc_add(void)
641static TGP_FUNCTION( acc_add )
639642{
640643   float a = fifoin_pop_f();
641644   logerror("TGP acc_add %f (%x)\n", a, pushpc);
r3957r3958
643646   next_fn();
644647}
645648
646static void acc_sub(void)
649static TGP_FUNCTION( acc_sub )
647650{
648651   float a = fifoin_pop_f();
649652   logerror("TGP acc_sub %f (%x)\n", a, pushpc);
r3957r3958
651654   next_fn();
652655}
653656
654static void acc_mul(void)
657static TGP_FUNCTION( acc_mul )
655658{
656659   float a = fifoin_pop_f();
657660   logerror("TGP acc_mul %f (%x)\n", a, pushpc);
r3957r3958
659662   next_fn();
660663}
661664
662static void acc_div(void)
665static TGP_FUNCTION( acc_div )
663666{
664667   float a = fifoin_pop_f();
665668   logerror("TGP acc_div %f (%x)\n", a, pushpc);
r3957r3958
667670   next_fn();
668671}
669672
670static void f42(void)
673static TGP_FUNCTION( f42 )
671674{
672675   float a = fifoin_pop_f();
673676   float b = fifoin_pop_f();
r3957r3958
676679   (void)b;
677680   (void)c;
678681   logerror("TGP f42 %f, %f, %f (%x)\n", a, b, c, pushpc);
679   //  fifoout_push_f((mame_rand(Machine) % 1000) - 500);
682   //  fifoout_push_f((mame_rand(machine) % 1000) - 500);
680683   fifoout_push_f(0);
681684   fifoout_push_f(0);
682685   fifoout_push_f(0);
r3957r3958
689692
690693// r = (x2 + y2 + z2)1/2,     f = tan-1(y/(x2+z2)1/2),     q = tan-1(z/x)
691694
692static void xyz2rqf(void)
695static TGP_FUNCTION( xyz2rqf )
693696{
694697   float a = fifoin_pop_f();
695698   float b = fifoin_pop_f();
r3957r3958
727730   next_fn();
728731}
729732
730static void f43(void)
733static TGP_FUNCTION( f43 )
731734{
732735   float a = fifoin_pop_f();
733736   float b = fifoin_pop_f();
r3957r3958
749752   next_fn();
750753}
751754
752static void f43_swa(void)
755static TGP_FUNCTION( f43_swa )
753756{
754757   float a = fifoin_pop_f();
755758   int b = fifoin_pop();
r3957r3958
764767   next_fn();
765768}
766769
767static void f44(void)
770static TGP_FUNCTION( f44 )
768771{
769772   float a = fifoin_pop_f();
770773   (void)a;
r3957r3958
775778   next_fn();
776779}
777780
778static void matrix_sdir(void)
781static TGP_FUNCTION( matrix_sdir )
779782{
780783   float a = fifoin_pop_f();
781784   float b = fifoin_pop_f();
r3957r3958
825828   next_fn();
826829}
827830
828static void f45(void)
831static TGP_FUNCTION( f45 )
829832{
830833   float a = fifoin_pop_f();
831834   (void)a;
r3957r3958
834837   next_fn();
835838}
836839
837static void vlength(void)
840static TGP_FUNCTION( vlength )
838841{
839842   float a = fifoin_pop_f() - tgp_vr_base[0];
840843   float b = fifoin_pop_f() - tgp_vr_base[1];
r3957r3958
849852   next_fn();
850853}
851854
852static void f47(void)
855static TGP_FUNCTION( f47 )
853856{
854857   float a = fifoin_pop_f();
855858   float b = fifoin_pop_f();
r3957r3958
860863   next_fn();
861864}
862865
863static void track_read_info(void)
866static TGP_FUNCTION( track_read_info )
864867{
865   const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, "user2");
868   const UINT32 *tgp_data = (const UINT32 *)memory_region(machine, "user2");
866869    UINT16 a = fifoin_pop();
867870   int offd;
868871
r3957r3958
873876   next_fn();
874877}
875878
876static void colbox_set(void)
879static TGP_FUNCTION( colbox_set )
877880{
878881   float a = fifoin_pop_f();
879882   float b = fifoin_pop_f();
r3957r3958
903906   next_fn();
904907}
905908
906static void colbox_test(void)
909static TGP_FUNCTION( colbox_test )
907910{
908911   float a = fifoin_pop_f();
909912   float b = fifoin_pop_f();
r3957r3958
919922   next_fn();
920923}
921924
922static void f49_swa(void)
925static TGP_FUNCTION( f49_swa )
923926{
924927   float a = fifoin_pop_f();
925928   float b = fifoin_pop_f();
r3957r3958
937940   next_fn();
938941}
939942
940static void f50_swa(void)
943static TGP_FUNCTION( f50_swa )
941944{
942945    float a = fifoin_pop_f();
943946   float b = fifoin_pop_f();
r3957r3958
952955   next_fn();
953956}
954957
955static void f52(void)
958static TGP_FUNCTION( f52 )
956959{
957960   logerror("TGP f52 (%x)\n", pushpc);
958961   next_fn();
959962}
960963
961static void matrix_rdir(void)
964static TGP_FUNCTION( matrix_rdir )
962965{
963966   float a = fifoin_pop_f();
964967   float b = fifoin_pop_f();
r3957r3958
10071010   *t2 = (bx*py-by*px)/d;
10081011}
10091012
1010static void track_lookup(void)
1013static TGP_FUNCTION( track_lookup )
10111014{
1012   const UINT32 *tgp_data = (const UINT32 *)memory_region(Machine, "user2");
1015   const UINT32 *tgp_data = (const UINT32 *)memory_region(machine, "user2");
10131016   float a = fifoin_pop_f();
10141017   UINT32 b = fifoin_pop();
10151018   float c = fifoin_pop_f();
r3957r3958
10651068   next_fn();
10661069}
10671070
1068static void f56(void)
1071static TGP_FUNCTION( f56 )
10691072{
10701073   float a = fifoin_pop_f();
10711074   float b = fifoin_pop_f();
r3957r3958
10871090   next_fn();
10881091}
10891092
1090static void f57(void)
1093static TGP_FUNCTION( f57 )
10911094{
10921095   logerror("TGP f57 (%x)\n", pushpc);
10931096   fifoout_push_f(0);
r3957r3958
10961099   next_fn();
10971100}
10981101
1099static void matrix_readt(void)
1102static TGP_FUNCTION( matrix_readt )
11001103{
11011104   logerror("TGP matrix_readt (%x)\n", pushpc);
11021105   fifoout_push_f(cmat[9]);
r3957r3958
11051108   next_fn();
11061109}
11071110
1108static void acc_geti(void)
1111static TGP_FUNCTION( acc_geti )
11091112{
11101113   logerror("TGP acc_geti (%x)\n", pushpc);
11111114   fifoout_push((int)acc);
11121115   next_fn();
11131116}
11141117
1115static void f60(void)
1118static TGP_FUNCTION( f60 )
11161119{
11171120   logerror("TGP f60 (%x)\n", pushpc);
11181121   fifoout_push_f(0);
r3957r3958
11211124   next_fn();
11221125}
11231126
1124static void col_setcirc(void)
1127static TGP_FUNCTION( col_setcirc )
11251128{
11261129   float a = fifoin_pop_f();
11271130   float b = fifoin_pop_f();
r3957r3958
11331136   next_fn();
11341137}
11351138
1136static void col_testpt(void)
1139static TGP_FUNCTION( col_testpt )
11371140{
11381141   float x, y;
11391142   float a = fifoin_pop_f();
r3957r3958
11451148   next_fn();
11461149}
11471150
1148static void push_and_ident(void)
1151static TGP_FUNCTION( push_and_ident )
11491152{
11501153   if(mat_stack_pos != MAT_STACK_SIZE) {
11511154      memcpy(mat_stack[mat_stack_pos], cmat, sizeof(cmat));
r3957r3958
11591162   next_fn();
11601163}
11611164
1162static void catmull_rom(void)
1165static TGP_FUNCTION( catmull_rom )
11631166{
11641167   float a = fifoin_pop_f();
11651168   float b = fifoin_pop_f();
r3957r3958
11931196   next_fn();
11941197}
11951198
1196static void distance(void)
1199static TGP_FUNCTION( distance )
11971200{
11981201   float a = fifoin_pop_f();
11991202   float b = fifoin_pop_f();
r3957r3958
12061209   next_fn();
12071210}
12081211
1209static void car_move(void)
1212static TGP_FUNCTION( car_move )
12101213{
12111214   INT16 a = fifoin_pop();
12121215   float b = fifoin_pop_f();
r3957r3958
12251228   next_fn();
12261229}
12271230
1228static void cpa(void)
1231static TGP_FUNCTION( cpa )
12291232{
12301233   float dv_x, dv_y, dv_z, dv2, dw_x, dw_y, dw_z, dt;
12311234
r3957r3958
12691272   next_fn();
12701273}
12711274
1272static void vmat_store(void)
1275static TGP_FUNCTION( vmat_store )
12731276{
12741277   UINT32 a = fifoin_pop();
12751278   if(a<21)
r3957r3958
12801283   next_fn();
12811284}
12821285
1283static void vmat_restore(void)
1286static TGP_FUNCTION( vmat_restore )
12841287{
12851288   UINT32 a = fifoin_pop();
12861289   if(a<21)
r3957r3958
12911294   next_fn();
12921295}
12931296
1294static void vmat_mul(void)
1297static TGP_FUNCTION( vmat_mul )
12951298{
12961299   UINT32 a = fifoin_pop();
12971300   UINT32 b = fifoin_pop();
r3957r3958
13141317   next_fn();
13151318}
13161319
1317static void vmat_read(void)
1320static TGP_FUNCTION( vmat_read )
13181321{
13191322   UINT32 a = fifoin_pop();
13201323   logerror("TGP vmat_read %d (%x)\n", a, pushpc);
r3957r3958
13311334   next_fn();
13321335}
13331336
1334static void matrix_rtrans(void)
1337static TGP_FUNCTION( matrix_rtrans )
13351338{
13361339   logerror("TGP matrix_rtrans (%x)\n", pushpc);
13371340   fifoout_push_f(cmat[ 9]);
r3957r3958
13401343   next_fn();
13411344}
13421345
1343static void matrix_unrot(void)
1346static TGP_FUNCTION( matrix_unrot )
13441347{
13451348   logerror("TGP matrix_unrot (%x)\n", pushpc);
13461349   memset(cmat, 0, 9*sizeof(cmat[0]));
r3957r3958
13501353   next_fn();
13511354}
13521355
1353static void f80(void)
1356static TGP_FUNCTION( f80 )
13541357{
13551358   logerror("TGP f80 (%x)\n", pushpc);
13561359   //  cmat[9] = cmat[10] = cmat[11] = 0;
13571360   next_fn();
13581361}
13591362
1360static void vmat_save(void)
1363static TGP_FUNCTION( vmat_save )
13611364{
13621365   UINT32 a = fifoin_pop();
13631366   int i;
r3957r3958
13671370   next_fn();
13681371}
13691372
1370static void vmat_load(void)
1373static TGP_FUNCTION( vmat_load )
13711374{
13721375   UINT32 a = fifoin_pop();
13731376   int i;
r3957r3958
13771380   next_fn();
13781381}
13791382
1380static void ram_setadr(void)
1383static TGP_FUNCTION( ram_setadr )
13811384{
13821385    ram_scanadr = fifoin_pop() - 0x8000;
13831386   logerror("TGP f0 ram_setadr 0x%x (%x)\n", ram_scanadr+0x8000, pushpc);
13841387   next_fn();
13851388}
13861389
1387static void groundbox_test(void)
1390static TGP_FUNCTION( groundbox_test )
13881391{
13891392   int out_x, out_y, out_z;
13901393   float x, y, z;
r3957r3958
14071410   next_fn();
14081411}
14091412
1410static void f89(void)
1413static TGP_FUNCTION( f89 )
14111414{
14121415    UINT32 a = fifoin_pop();
14131416   UINT32 b = fifoin_pop();
r3957r3958
14211424   next_fn();
14221425}
14231426
1424static void f92(void)
1427static TGP_FUNCTION( f92 )
14251428{
14261429   float a = fifoin_pop_f();
14271430   float b = fifoin_pop_f();
r3957r3958
14351438   next_fn();
14361439}
14371440
1438static void f93(void)
1441static TGP_FUNCTION( f93 )
14391442{
14401443   float a = fifoin_pop_f();
14411444   (void)a;
r3957r3958
14431446   next_fn();
14441447}
14451448
1446static void f94(void)
1449static TGP_FUNCTION( f94 )
14471450{
14481451   UINT32 a = fifoin_pop();
14491452   (void)a;
r3957r3958
14511454   next_fn();
14521455}
14531456
1454static void vmat_flatten(void)
1457static TGP_FUNCTION( vmat_flatten )
14551458{
14561459   int i;
14571460   float m[12];
r3957r3958
14771480   next_fn();
14781481}
14791482
1480static void vmat_load1(void)
1483static TGP_FUNCTION( vmat_load1 )
14811484{
14821485   UINT32 a = fifoin_pop();
14831486   logerror("TGP vmat_load1 0x%x (%x)\n", a, pushpc);
r3957r3958
14851488   next_fn();
14861489}
14871490
1488static void ram_trans(void)
1491static TGP_FUNCTION( ram_trans )
14891492{
14901493   float a = ram_get_f();
14911494   float b = ram_get_f();
r3957r3958
14971500   next_fn();
14981501}
14991502
1500static void f98_load(void)
1503static TGP_FUNCTION( f98_load )
15011504{
15021505   int i;
15031506   for(i=0; i<list_length; i++) {
r3957r3958
15081511   next_fn();
15091512}
15101513
1511static void f98(void)
1514static TGP_FUNCTION( f98 )
15121515{
15131516    UINT32 a = fifoin_pop();
15141517   (void)a;
r3957r3958
15171520   fifoin_cb = f98_load;
15181521}
15191522
1520static void f99(void)
1523static TGP_FUNCTION( f99 )
15211524{
15221525   logerror("TGP f99 (%x)\n", pushpc);
15231526   next_fn();
15241527}
15251528
1526static void f100(void)
1529static TGP_FUNCTION( f100 )
15271530{
15281531   int i;
15291532   logerror("TGP f100 get list (%x)\n", pushpc);
15301533   for(i=0; i<list_length; i++)
1531      fifoout_push_f((mame_rand(Machine) % 1000)/100.0);
1534      fifoout_push_f((mame_rand(machine) % 1000)/100.0);
15321535   next_fn();
15331536}
15341537
1535static void groundbox_set(void)
1538static TGP_FUNCTION( groundbox_set )
15361539{
15371540   float a = fifoin_pop_f();
15381541   float b = fifoin_pop_f();
r3957r3958
15531556   next_fn();
15541557}
15551558
1556static void f102(void)
1559static TGP_FUNCTION( f102 )
15571560{
15581561   static int ccount = 0;
15591562   float px, py, pz;
r3957r3958
16061609   next_fn();
16071610}
16081611
1609static void f103(void)
1612static TGP_FUNCTION( f103 )
16101613{
16111614    ram_scanadr = fifoin_pop() - 0x8000;
16121615   logerror("TGP f0 mve_setadr 0x%x (%x)\n", ram_scanadr, pushpc);
r3957r3958
16151618}
16161619
16171620struct function {
1618   void (*cb)(void);
1621   tgp_func cb;
16191622   int count;
16201623};
16211624
r3957r3958
18131816};
18141817
18151818
1816static void dump(void)
1819static TGP_FUNCTION( dump )
18171820{
18181821   logerror("TGP FIFOIN write %08x (%x)\n", fifoin_pop(), pushpc);
18191822   fifoin_cbcount = 1;
18201823   fifoin_cb = dump;
18211824}
18221825
1823static void function_get_vf(void)
1826static TGP_FUNCTION( function_get_vf )
18241827{
18251828   UINT32 f = fifoin_pop() >> 23;
18261829
r3957r3958
18351838      fifoin_cb = ftab_vf[f].cb;
18361839      //      logerror("TGP function %d request, %d parameters\n", f, fifoin_cbcount);
18371840      if(!fifoin_cbcount)
1838         fifoin_cb();
1841         fifoin_cb(machine);
18391842   } else {
18401843      logerror("TGP function %d unimplemented (%x)\n", f, pushpc);
18411844      fifoin_cbcount = 1;
r3957r3958
18431846   }
18441847}
18451848
1846static void function_get_swa(void)
1849static TGP_FUNCTION( function_get_swa )
18471850{
18481851   UINT32 f = fifoin_pop();
18491852
r3957r3958
18581861      fifoin_cb = ftab_swa[f].cb;
18591862      //      logerror("TGP function %d request, %d parameters\n", f, fifoin_cbcount);
18601863      if(!fifoin_cbcount)
1861         fifoin_cb();
1864         fifoin_cb(machine);
18621865   } else {
18631866      logerror("TGP function %d unimplemented (%x)\n", f, pushpc);
18641867      fifoin_cbcount = 1;
src/mame/machine/seicop.c
r3957r3958
163163   visarea.min_y = 0; \
164164   visarea.max_y = _y_-1; \
165165   video_screen_configure(space->machine->primary_screen, _x_, _y_, &visarea, video_screen_get_frame_period(space->machine->primary_screen).attoseconds ); \
166   flip_screen_set(_flip_); \
166   flip_screen_set(space->machine, _flip_); \
167167   } \
168168
169169/*TODO: numbers over 65535?*/
src/mame/machine/slapstic.c
r3957r3958
179179*************************************************************************/
180180
181181#include "driver.h"
182#include "cpu/m6800/m6800.h"
182183#include "slapstic.h"
183184#include "cpu/m68000/m68000.h"
184185
r3957r3958
806807
807808void slapstic_init(running_machine *machine, int chip)
808809{
810   cpu_type cputype = cpu_get_type(machine->cpu[0]);
811
809812   /* only a small number of chips are known to exist */
810813   if (chip < 101 || chip > 118)
811814      return;
r3957r3958
819822   slapstic_reset();
820823
821824   /* see if we're 68k or 6502/6809 based */
822   access_68k = (machine->config->cpu[0].type == CPU_M68000 ||
823              machine->config->cpu[0].type == CPU_M68010);
825   access_68k = (cputype == CPU_M68000 || cputype == CPU_M68010);
824826
825827   /* save state */
826828   state_save_register_item(machine, "slapstic", NULL, 0, state);
src/mame/mamedriv.c
r3957r3958
412412   DRIVER( hyhoo2 )   /* (c) 1987 */
413413
414414   DRIVER( jangou )    /* (c) 1983 */
415   /* Jangou Night   *//* (c) 1983 */
415416   DRIVER( jngolady )  /* (c) 1984 */
417   DRIVER( cntrygrl )  /* (c) 1984 Royal Denshi */
418
416419   DRIVER( pastelg )   /* (c) 1985 */
420   DRIVER( 3ds )       /* (c) 1985 */
417421
418422   DRIVER( crystalg )   /* (c) 1986 */
419423   DRIVER( crystal2 )   /* (c) 1986 */
r3957r3958
17251729   DRIVER( cadashu )   /* C21 (c) 1989 Taito America Corporation */
17261730   DRIVER( cadashi )   /* C21 (c) 1989 Taito Corporation Japan */
17271731   DRIVER( cadashf )   /* C21 (c) 1989 Taito Corporation Japan */
1732   DRIVER( parentj )   /* C42 (c) 199? Taito */
17281733   DRIVER( galmedes )   /* (c) 1992 Visco (Japan) */
17291734   DRIVER( earthjkr )   /* (c) 1993 Visco (Japan) */
17301735   DRIVER( eto )      /* (c) 1994 Visco (Japan) */
r3957r3958
27672772   DRIVER( spf2xjd )
27682773   DRIVER( ddsomud )
27692774   DRIVER( megamn2d )
2770   DRIVER( sfz2aad )
2775   DRIVER( sfz2ald )
27712776   DRIVER( xmvsfu1d )
27722777   DRIVER( batcird )
27732778   DRIVER( vsavd )
r3957r3958
58305835   DRIVER( bangbead )   /* 0259 (c) 2000 Visco */
58315836   DRIVER( nitd )      /* 0260 (c) 2000 Eleven / Gavaking */
58325837   DRIVER( nitdbl )   /* bootleg */
5833   DRIVER( sengoku3 )   /* 0261 (c) 2001 SNK */
5838   DRIVER( sengoku3 )   /* 0261 (c) 2001 Noise Factory / SNK */
58345839   DRIVER( kof2001 )   /* 0262 (c) 2001 Eolith / SNK */
58355840   DRIVER( kof2001h )   /* 0262 (c) 2001 Eolith / SNK */
58365841   DRIVER( cthd2003 )   /* bootleg of kof2001 */
r3957r3958
60086013   DRIVER( agress )   /* TA-0029 (c) 1991 Palco */
60096014   DRIVER( agressb )   /* TA-0029 (c) 1991 Palco */
60106015   DRIVER( ddragon3 )   /* TA-0030 (c) 1990 */
6016   DRIVER( ddrago3p )   /* TA-0030 (c) 1990 */
60116017   DRIVER( ddrago3j )   /* TA-0030 (c) 1990 (Japan) */
60126018   DRIVER( ddrago3b )   /* bootleg */
60136019   DRIVER( wwfwfest )   /* TA-0031 (c) 1991 (US) */
r3957r3958
74017407   DRIVER( cb3 )      /* (c) 19?? Dyna/bootleg? */
74027408   DRIVER( cmv801 )   /* (c) 198? Corsica */
74037409   DRIVER( cmaster )   /* (c) 1991 Dyna */
7410   DRIVER( cmasterb )   /* (c) 1991 Dyna */
7411   DRIVER( lucky8 )   /* (c) 1989 Wing Co.Ltd */
74047412    DRIVER( cpoker )   /* (c) 1993? IGS */
74057413    DRIVER( cpokert )   /* (c) 1993? Tuning */
74067414   DRIVER( csk227it )   /* (c) 198? IGS */
r3957r3958
74117419   DRIVER( grndtour )   /* (c) 1993 */
74127420   DRIVER( cabaret )
74137421   DRIVER( jingbell )   /* (c) 1995? */
7422   DRIVER( gp98 )      /* (c) 19?? */
74147423   DRIVER( lhb )      /* (c) 1995 */
74157424   DRIVER( lhba )      /* (c) 1995 */
74167425   DRIVER( dbc )      /* (c) 199? */
r3957r3958
75217530   DRIVER( yachtmn )   /* (c) 1982 [Sanritsu] Esco */
75227531   DRIVER( rougien )   /* (c) 1982 Sanritsu */
75237532   DRIVER( drmicro )   /* (c) 1983 Sanritsu */
7533   DRIVER( jantotsu )  /* (c) 1983 Sanritsu */
75247534   DRIVER( appoooh )   /* (c) 1984 Sega,  made by Sanritsu */
75257535   DRIVER( robowres )   /* (c) 1986 Sega */
75267536   DRIVER( robowrb )   /* bootleg */
r3957r3958
80898099   DRIVER( jolyccra )   /* (c) 1985 TAB-Austria */
80908100   DRIVER( jolyccrb )   /* (c) 1993 Soft Design */
80918101   DRIVER( jolycdit )   /* 199? bootleg */
8102   DRIVER( jolycdib )   /* 1990 bootleg */
80928103   DRIVER( sjcd2kx3 )   /* (c) 1985 M.P.*/
80938104   DRIVER( jolycdab )   /* (c) 1986 Inter Games */
80948105   DRIVER( bigdeal )   /* (c) 1986 Funworld */
r3957r3958
81468157   DRIVER( videomat )   /* 1990 bootleg */
81478158   DRIVER( sigmapkr )   /* (c) 1995 Sigma */
81488159   DRIVER( sigma2k )   /* (c) 2000 Sigma */
8149   DRIVER( lucky8 )   /* (c) 1989 Falcon */
81508160   DRIVER( sidewndr )   /* (c) 1981? ACE */
81518161   DRIVER( spellbnd )   /* (c) 1981? ACE */
81528162   DRIVER( starspnr )   /* (c) 1982? ACE */
r3957r3958
83028312   DRIVER( tetriunk )
83038313   DRIVER( smstrv )   /* (c) 1984 SMS MFG CORP */
83048314   DRIVER( skylncr )   /* (c) 1995 Bordun International */
8315   DRIVER( butrfly )   /* (c) 1995 Bordun International */
83058316   DRIVER( madzoo )   /* (c) 1995 Bordun International */
8317   DRIVER( leader )   /* Bootleg? */
83068318   DRIVER( livequiz )   /* (c) 1999 Andamiro */
83078319   DRIVER( cowrace )   /* (c) 19?? unknown */
83088320   DRIVER( mjsiyoub )   /* (c) 1986 Visco */
r3957r3958
84258437   /* STG? */
84268438   DRIVER ( queen )
84278439
8440   /* Aristocrat */
8441   DRIVER ( caswin )
8442
8443   /* Eagle */
8444   DRIVER ( janshi )
8445
84288446#endif   /* DRIVER_RECURSIVE */
src/mame/includes/jaguar.h
r3957r3958
3333void jaguar_dsp_resume(running_machine *machine);
3434
3535void cojag_sound_init(running_machine *machine);
36void cojag_sound_reset(void);
36void cojag_sound_reset(running_machine *machine);
3737
3838void jaguar_external_int(const device_config *device, int state);
3939
src/mame/includes/carpolo.h
r3957r3958
3030WRITE8_HANDLER( carpolo_car_border_interrupt_clear_w );
3131WRITE8_HANDLER( carpolo_timer_interrupt_clear_w );
3232
33void carpolo_generate_car_car_interrupt(int car1, int car2);
34void carpolo_generate_ball_screen_interrupt(UINT8 cause);
35void carpolo_generate_car_goal_interrupt(int car, int right_goal);
36void carpolo_generate_car_ball_interrupt(int car, int car_x, int car_y);
37void carpolo_generate_car_border_interrupt(int car, int horizontal_border);
33void carpolo_generate_car_car_interrupt(running_machine *machine, int car1, int car2);
34void carpolo_generate_ball_screen_interrupt(running_machine *machine, UINT8 cause);
35void carpolo_generate_car_goal_interrupt(running_machine *machine, int car, int right_goal);
36void carpolo_generate_car_ball_interrupt(running_machine *machine, int car, int car_x, int car_y);
37void carpolo_generate_car_border_interrupt(running_machine *machine, int car, int horizontal_border);
3838
3939
4040/*----------- defined in video/carpolo.c -----------*/
src/mame/includes/amiga.h
r3957r3958
309309{
310310   UINT32 chip_ram_mask;
311311
312   UINT16 (*joy0dat_r)(void);
313   UINT16 (*joy1dat_r)(void);
314   void (*potgo_w)(UINT16 data);
312   UINT16 (*joy0dat_r)(running_machine *machine);
313   UINT16 (*joy1dat_r)(running_machine *machine);
314   void (*potgo_w)(running_machine *machine, UINT16 data);
315315
316   UINT16 (*dskbytr_r)(void);
317   void (*dsklen_w)(UINT16 data);
316   UINT16 (*dskbytr_r)(running_machine *machine);
317   void (*dsklen_w)(running_machine *machine, UINT16 data);
318318
319   void (*serdat_w)(UINT16 data);
319   void (*serdat_w)(running_machine *machine, UINT16 data);
320320
321   void (*scanline0_callback)(void);
322   void (*reset_callback)(void);
323   void (*nmi_callback)(void);
321   void (*scanline0_callback)(running_machine *machine);
322   void (*reset_callback)(running_machine *machine);
323   void (*nmi_callback)(running_machine *machine);
324324
325325   UINT32 flags;
326326};
r3957r3958
342342   UINT16      mfr_number;         /* manufacturers number */
343343   UINT32      serial_number;      /* serial number */
344344   UINT16      rom_vector;         /* ROM vector offset */
345   UINT8      (*int_control_r)(void); /* interrupt control read */
346   void      (*int_control_w)(UINT8 data); /* interrupt control write */
347   void      (*install)(offs_t base); /* memory installation */
348   void      (*uninstall)(offs_t base); /* memory uninstallation */
345   UINT8      (*int_control_r)(running_machine *machine); /* interrupt control read */
346   void      (*int_control_w)(running_machine *machine, UINT8 data); /* interrupt control write */
347   void      (*install)(running_machine *machine, offs_t base); /* memory installation */
348   void      (*uninstall)(running_machine *machine, offs_t base); /* memory uninstallation */
349349};
350350
351351
r3957r3958
376376READ16_HANDLER( amiga_custom_r );
377377WRITE16_HANDLER( amiga_custom_w );
378378
379void amiga_serial_in_w(UINT16 data);
380attotime amiga_get_serial_char_period(void);
379void amiga_serial_in_w(running_machine *machine, UINT16 data);
380attotime amiga_get_serial_char_period(running_machine *machine);
381381
382void amiga_add_autoconfig(const amiga_autoconfig_device *device);
382void amiga_add_autoconfig(running_machine *machine, const amiga_autoconfig_device *device);
383383READ16_HANDLER( amiga_autoconfig_r );
384384WRITE16_HANDLER( amiga_autoconfig_w );
385385
src/mame/includes/harddriv.h
r3957r3958
128128WRITE16_HANDLER( hd68k_ds3_program_w );
129129
130130/* DSK board */
131void hddsk_update_pif(UINT32 pins);
131void hddsk_update_pif(const device_config *device, UINT32 pins);
132132WRITE16_HANDLER( hd68k_dsk_control_w );
133133READ16_HANDLER( hd68k_dsk_ram_r );
134134WRITE16_HANDLER( hd68k_dsk_ram_w );
src/mame/includes/psx.h
r3957r3958
1414VIDEO_UPDATE( psx );
1515INTERRUPT_GEN( psx_vblank );
1616extern void psx_gpu_reset( running_machine *machine );
17extern void psx_gpu_read( UINT32 *p_ram, INT32 n_size );
18extern void psx_gpu_write( UINT32 *p_ram, INT32 n_size );
17extern void psx_gpu_read( running_machine *, UINT32 *p_ram, INT32 n_size );
18extern void psx_gpu_write( running_machine *, UINT32 *p_ram, INT32 n_size );
1919READ32_HANDLER( psx_gpu_r );
2020WRITE32_HANDLER( psx_gpu_w );
2121extern void psx_lightgun_set( int, int );
r3957r3958
2424
2525extern UINT32 *g_p_n_psxram;
2626extern size_t g_n_psxramsize;
27typedef void ( *psx_dma_read_handler )( UINT32, INT32 );
28typedef void ( *psx_dma_write_handler )( UINT32, INT32 );
27typedef void ( *psx_dma_read_handler )( running_machine *, UINT32, INT32 );
28typedef void ( *psx_dma_write_handler )( running_machine *, UINT32, INT32 );
2929WRITE32_HANDLER( psx_com_delay_w );
3030READ32_HANDLER( psx_com_delay_r );
3131WRITE32_HANDLER( psx_irq_w );
r3957r3958
3939READ32_HANDLER( psx_counter_r );
4040WRITE32_HANDLER( psx_sio_w );
4141READ32_HANDLER( psx_sio_r );
42typedef void ( *psx_sio_handler )( int );
42typedef void ( *psx_sio_handler )( running_machine *, int );
4343extern void psx_sio_install_handler( int, psx_sio_handler );
4444extern void psx_sio_input( running_machine *, int, int, int );
4545
src/mame/includes/system16.h
r3957r3958
101101
102102extern int sys18_sound_info[4*2];
103103
104extern void sys16_patch_code( int offset, int data );
104typedef struct _sys16_patch sys16_patch;
105struct _sys16_patch
106{
107   offs_t offset;
108   UINT8 data;
109};
105110
111extern void sys16_patch_code( running_machine *machine, const sys16_patch *patch, int count );
112
106113#define SYS16_MWA16_PALETTERAM   sys16_paletteram_w
107114#define SYS16_MRA16_PALETTERAM   SMH_RAM
108115
src/mame/includes/gaelco3d.h
r3957r3958
1414extern offs_t gaelco3d_texture_size;
1515extern offs_t gaelco3d_texmask_size;
1616
17void gaelco3d_render(void);
17void gaelco3d_render(const device_config *screen);
1818WRITE32_HANDLER( gaelco3d_render_w );
1919
2020WRITE16_HANDLER( gaelco3d_paletteram_w );
src/mame/includes/n64.h
r3957r3958
99
1010extern VIDEO_START( n64 );
1111extern VIDEO_UPDATE( n64 );
12extern void rdp_process_list(void);
12extern void rdp_process_list(running_machine *machine);
1313
1414#define DACRATE_NTSC   (48681812)
1515#define DACRATE_PAL   (49656530)
src/mame/includes/snes.h
r3957r3958
11#ifndef _SNES_H_
22#define _SNES_H_
33
4#include "streams.h"
45#include "sound/custom.h"
56
67/*
r3957r3958
493494extern WRITE8_HANDLER( spc_ram_w );
494495extern READ8_HANDLER( spc_ipl_r );
495496extern CUSTOM_START( snes_sh_start );
496extern void snes_sh_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length );
497extern STREAM_UPDATE( snes_sh_update );
497498
498499/* Stuff from OpenSPC 0.3.99 by Brad Martin */
499500
src/mame/includes/naomibd.h
r3957r3958
4949***************************************************************************/
5050
5151#define MDRV_NAOMIBD_ADD(_tag, _type) \
52   MDRV_DEVICE_ADD(_tag, NAOMI_BOARD) \
52   MDRV_DEVICE_ADD(_tag, NAOMI_BOARD, 0) \
5353   MDRV_DEVICE_CONFIG_DATA32(naomibd_config, type, _type)
5454
5555#define MDRV_NAOMI_ROM_BOARD_ADD(_tag, _region) \
src/mame/includes/galaxold.h
r3957r3958
189189
190190/*----------- defined in audio/scramble.c -----------*/
191191
192void scramble_sh_init(void);
193void sfx_sh_init(void);
192void scramble_sh_init(running_machine *machine);
193void sfx_sh_init(running_machine *machine);
194194
195195WRITE8_HANDLER( scramble_filter_w );
196196WRITE8_HANDLER( frogger_filter_w );
src/mame/mame.mak
r3957r3958
3535
3636CPUS += Z80
3737CPUS += Z180
38CPUS += 8080
39CPUS += 8085A
38CPUS += I8085
4039CPUS += M6502
4140CPUS += M65C02
4241CPUS += M65SC02
r3957r3958
133132CPUS += TMS32032
134133CPUS += TMS32051
135134CPUS += CCPU
136CPUS += ADSP2100
137CPUS += ADSP2101
138CPUS += ADSP2104
139CPUS += ADSP2105
140CPUS += ADSP2115
141CPUS += ADSP2181
135CPUS += ADSP21XX
142136CPUS += PSXCPU
143137CPUS += CXD8661R
144138CPUS += ASAP
r3957r3958
11731167   $(DRIVERS)/bankp.o $(VIDEO)/bankp.o \
11741168   $(DRIVERS)/chinsan.o \
11751169   $(DRIVERS)/drmicro.o $(VIDEO)/drmicro.o \
1170   $(DRIVERS)/jantotsu.o \
11761171   $(DRIVERS)/mayumi.o $(VIDEO)/mayumi.o \
11771172   $(DRIVERS)/mermaid.o $(VIDEO)/mermaid.o \
11781173   $(DRIVERS)/mjkjidai.o $(VIDEO)/mjkjidai.o \
r3957r3958
13631358   $(DRIVERS)/nycaptor.o $(MACHINE)/nycaptor.o $(VIDEO)/nycaptor.o \
13641359   $(DRIVERS)/opwolf.o $(MACHINE)/opwolf.o \
13651360   $(DRIVERS)/othunder.o $(VIDEO)/othunder.o \
1361   $(DRIVERS)/parentj.o \
13661362   $(DRIVERS)/pitnrun.o $(MACHINE)/pitnrun.o $(VIDEO)/pitnrun.o \
13671363   $(DRIVERS)/qix.o $(MACHINE)/qix.o $(AUDIO)/qix.o $(VIDEO)/qix.o \
13681364   $(DRIVERS)/rainbow.o $(MACHINE)/rainbow.o \
r3957r3958
15551551   $(DRIVERS)/koftball.o \
15561552   $(DRIVERS)/calomega.o $(VIDEO)/calomega.o \
15571553   $(DRIVERS)/carrera.o \
1554   $(DRIVERS)/caswin.o \
15581555   $(DRIVERS)/cave.o $(VIDEO)/cave.o \
1559   $(DRIVERS)/cherrym.o \
15601556   $(DRIVERS)/cidelsa.o $(VIDEO)/cidelsa.o \
15611557   $(DRIVERS)/coinmstr.o \
15621558   $(DRIVERS)/comebaby.o \
r3957r3958
16061602   $(DRIVERS)/itgambl3.o \
16071603   $(DRIVERS)/itgamble.o \
16081604   $(DRIVERS)/jackpool.o \
1605   $(DRIVERS)/janshi.o \
16091606   $(DRIVERS)/jokrwild.o \
16101607   $(DRIVERS)/jongkyo.o \
16111608   $(DRIVERS)/kingpin.o \
r3957r3958
16171614   $(DRIVERS)/limenko.o \
16181615   $(DRIVERS)/ltcasino.o \
16191616   $(DRIVERS)/lucky74.o $(VIDEO)/lucky74.o \
1620   $(DRIVERS)/lucky8.o \
16211617   $(DRIVERS)/magic10.o \
16221618   $(DRIVERS)/magicfly.o \
16231619   $(DRIVERS)/magictg.o \
src/mame/video/xevious.c
r3957r3958
194194   UINT8 color = ((attr & 0x03) << 4) | ((attr & 0x3c) >> 2);
195195   SET_TILE_INFO(
196196         0,
197         xevious_fg_videoram[tile_index] | (flip_screen_get() ? 0x100 : 0),
197         xevious_fg_videoram[tile_index] | (flip_screen_get(machine) ? 0x100 : 0),
198198         color,
199         TILE_FLIPYX((attr & 0xc0) >> 6) ^ (flip_screen_get() ? TILE_FLIPX : 0));
199         TILE_FLIPYX((attr & 0xc0) >> 6) ^ (flip_screen_get(machine) ? TILE_FLIPX : 0));
200200}
201201
202202static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
311311      tilemap_set_scrolly(fg_tilemap,0,scroll);
312312      break;
313313   case 7:
314      flip_screen_set(scroll & 1);
314      flip_screen_set(space->machine, scroll & 1);
315315      break;
316316   default:
317317         logerror("CRTC WRITE REG: %x  Data: %03x\n",reg, scroll);
r3957r3958
454454         sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1);
455455         sy = 28*8-spriteram_2[offs]-1;
456456
457         if (flip_screen_get())
457         if (flip_screen_get(machine))
458458         {
459459            flipx = !flipx;
460460            flipy = !flipy;
src/mame/video/blktiger.c
r3957r3958
163163   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
164164
165165   /* bit 6 flips screen */
166   flip_screen_set(data & 0x40);
166   flip_screen_set(space->machine, data & 0x40);
167167
168168   /* bit 7 enables characters? Just a guess */
169169   chon = ~data & 0x80;
r3957r3958
208208      int color = attr & 0x07;
209209      int flipx = attr & 0x08;
210210
211      if (flip_screen_get())
211      if (flip_screen_get(machine))
212212      {
213213         sx = 240 - sx;
214214         sy = 240 - sy;
r3957r3958
218218      drawgfx(bitmap,machine->gfx[2],
219219            code,
220220            color,
221            flipx,flip_screen_get(),
221            flipx,flip_screen_get(machine),
222222            sx,sy,
223223            cliprect,TRANSPARENCY_PEN,15);
224224   }
src/mame/video/dynduke.c
r3957r3958
127127      if (data&0x4) txt_enable = 0; else txt_enable = 1;
128128      if (data&0x8) sprite_enable=0; else sprite_enable=1;
129129
130      flip_screen_set(data & 0x40);
130      flip_screen_set(space->machine, data & 0x40);
131131   }
132132}
133133
r3957r3958
154154      sprite = buffered_spriteram16[offs+1];
155155      sprite &= 0x3fff;
156156
157      if (flip_screen_get()) {
157      if (flip_screen_get(machine)) {
158158         x=240-x;
159159         y=240-y;
160160         if (fx) fx=0; else fx=1;
src/mame/video/tryout.c
r3957r3958
151151
152152WRITE8_HANDLER( tryout_flipscreen_w )
153153{
154   flip_screen_set(data & 1);
154   flip_screen_set(space->machine, data & 1);
155155}
156156
157157static TILEMAP_MAPPER( get_fg_memory_offset )
r3957r3958
199199      fy = 0;
200200      inc = 16;
201201
202      if (flip_screen_get())
202      if (flip_screen_get(machine))
203203      {
204204         x = 240 - x;
205205         fx = !fx;
r3957r3958
239239
240240   int scrollx;
241241
242   if (!flip_screen_get())
242   if (!flip_screen_get(screen->machine))
243243      tilemap_set_scrollx(fg_tilemap, 0, 16); /* Assumed hard-wired */
244244   else
245245      tilemap_set_scrollx(fg_tilemap, 0, -8); /* Assumed hard-wired */
src/mame/video/bublbobl.c
r3957r3958
7878            x = sx + xc * 8;
7979            y = (sy + yc * 8) & 0xff;
8080
81            if (flip_screen_get())
81            if (flip_screen_get(screen->machine))
8282            {
8383               x = 248 - x;
8484               y = 248 - y;
src/mame/video/rocnrope.c
r3957r3958
9696
9797WRITE8_HANDLER( rocnrope_flipscreen_w )
9898{
99   if (flip_screen_get() != (~data & 0x01))
99   if (flip_screen_get(space->machine) != (~data & 0x01))
100100   {
101      flip_screen_set(~data & 0x01);
101      flip_screen_set(space->machine, ~data & 0x01);
102102      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
103103   }
104104}
src/mame/video/docastle.c
r3957r3958
7777
7878READ8_HANDLER( docastle_flipscreen_off_r )
7979{
80   flip_screen_set(0);
80   flip_screen_set(space->machine, 0);
8181   tilemap_mark_all_tiles_dirty(docastle_tilemap);
8282   return 0;
8383}
8484
8585READ8_HANDLER( docastle_flipscreen_on_r )
8686{
87   flip_screen_set(1);
87   flip_screen_set(space->machine, 1);
8888   tilemap_mark_all_tiles_dirty(docastle_tilemap);
8989   return 1;
9090}
9191
9292WRITE8_HANDLER( docastle_flipscreen_off_w )
9393{
94   flip_screen_set(0);
94   flip_screen_set(space->machine, 0);
9595   tilemap_mark_all_tiles_dirty(docastle_tilemap);
9696}
9797
9898WRITE8_HANDLER( docastle_flipscreen_on_w )
9999{
100   flip_screen_set(1);
100   flip_screen_set(space->machine, 1);
101101   tilemap_mark_all_tiles_dirty(docastle_tilemap);
102102}
103103
r3957r3958
188188         flipy = spriteram[offs + 2] & 0x80;
189189      }
190190
191      if (flip_screen_get())
191      if (flip_screen_get(machine))
192192      {
193193         sx = 240 - sx;
194194         sy = 240 - sy;
src/mame/video/mainsnk.c
r3957r3958
5656{
5757   int bank;
5858
59   flip_screen_set(~data & 0x80);
59   flip_screen_set(space->machine, ~data & 0x80);
6060
6161   tilemap_set_palette_offset(bg_tilemap, (data & 0x07) << 4);
6262   tilemap_set_palette_offset(tx_tilemap, (data & 0x07) << 4);
r3957r3958
107107      sx = 288-16 - sx;
108108      sy += 8;
109109
110      if (flip_screen_get())
110      if (flip_screen_get(machine))
111111      {
112112         sx = 288-16 - sx;
113113         sy = 224-16 - sy;
src/mame/video/ygv608.c
r3957r3958
3030 */
3131
3232#include "driver.h"
33#include "deprecat.h"
3433#include "namcond1.h"   // only while debugging
3534#include "video/ygv608.h"
3635
r3957r3958
5150static tilemap *tilemap_B = NULL;
5251static bitmap_t *work_bitmap = NULL;
5352
54static void HandleYGV608Reset( void );
55static void HandleRomTransfers( void );
53static void HandleYGV608Reset( running_machine *machine );
54static void HandleRomTransfers( running_machine *machine );
5655static void SetPreShortcuts( int reg, int data );
57static void SetPostShortcuts( int reg );
56static void SetPostShortcuts( running_machine *machine, int reg );
5857
5958#ifdef MAME_DEBUG
6059static void ShowYGV608Registers( void );
r3957r3958
482481   ygv608.tilemap_resize = 1;
483482
484483   for(i = 0; i < 50; i++)
485      SetPostShortcuts(i);
484      SetPostShortcuts(machine, i);
486485}
487486
488487static void ygv608_register_state_save(running_machine *machine)
r3957r3958
12381237#endif
12391238         SetPreShortcuts (regNum, data);
12401239         ygv608.regs.b[regNum] = data;
1241         SetPostShortcuts (regNum);
1240         SetPostShortcuts (space->machine, regNum);
12421241         if (ygv608.ports.s.p5 & p5_rwai)
12431242         {
12441243            regNum ++;
r3957r3958
12651264      case 0x07: /* P#7 - system control port */
12661265         ygv608.ports.b[7] = data;
12671266         if (ygv608.ports.b[7] & 0x3e)
1268            HandleRomTransfers();
1267            HandleRomTransfers(space->machine);
12691268         if (ygv608.ports.b[7] & 0x01)
1270            HandleYGV608Reset();
1269            HandleYGV608Reset(space->machine);
12711270         break;
12721271
12731272      default:
r3957r3958
12761275   }
12771276}
12781277
1279static void HandleYGV608Reset( void )
1278static void HandleYGV608Reset( running_machine *machine )
12801279{
12811280    int i;
12821281
r3957r3958
12971296    /* should set shortcuts here too */
12981297    for( i=0; i<50; i++ ) {
12991298      //SetPreShortcuts( i );
1300      SetPostShortcuts( i );
1299      SetPostShortcuts( machine, i );
13011300    }
13021301}
13031302
r3957r3958
13081307    - So leave it in!
13091308 */
13101309
1311static void HandleRomTransfers(void)
1310static void HandleRomTransfers(running_machine *machine)
13121311{
13131312#if 0
13141313  static UINT8 *sdt = (UINT8 *)ygv608.scroll_data_table;
13151314  static UINT8 *sat = (UINT8 *)ygv608.sprite_attribute_table.b;
13161315
13171316  /* fudge copy from sprite data for now... */
1318  UINT8 *RAM = Machine->memory_region[0];
1317  UINT8 *RAM = machine->memory_region[0];
13191318  int i;
13201319
13211320  int src = ( ( (int)ygv608.regs.s.tb13 << 8 ) +
r3957r3958
14201419// Set any "short-cut" variables after we have updated the YGV608 registers
14211420// - these are used only in optimisation of the emulation
14221421
1423static void SetPostShortcuts( int reg )
1422static void SetPostShortcuts( running_machine *machine, int reg )
14241423{
14251424   int plane, addr;
14261425
r3957r3958
14311430         UINT8 yTile = ygv608.regs.s.r0 & r0_pny;
14321431
14331432         if (yTile >= ygv608.page_y)
1434            logerror ("%s:setting pny(%d) >= page_y(%d)\n", cpuexec_describe_context(Machine),
1433            logerror ("%s:setting pny(%d) >= page_y(%d)\n", cpuexec_describe_context(machine),
14351434                  yTile, ygv608.page_y );
14361435         yTile &= (ygv608.page_y - 1);
14371436         ygv608.regs.s.r0 &= ~r0_pny;
r3957r3958
14441443         UINT8 xTile = ygv608.regs.s.r1 & r1_pnx;
14451444
14461445         if (xTile >= ygv608.page_x)
1447            logerror ("%s:setting pnx(%d) >= page_x(%d)\n", cpuexec_describe_context(Machine),
1446            logerror ("%s:setting pnx(%d) >= page_x(%d)\n", cpuexec_describe_context(machine),
14481447                  xTile, ygv608.page_x );
14491448         xTile &= (ygv608.page_x - 1);
14501449         ygv608.regs.s.r1 &= ~r1_pnx;
src/mame/video/senjyo.c
r3957r3958
181181      count = 0;
182182      strwid = senjyo_bgstripes;
183183      if (strwid == 0) strwid = 0x100;
184      if (flip_screen_get()) strwid ^= 0xff;
184      if (flip_screen_get(machine)) strwid ^= 0xff;
185185
186186      for (x = 0;x < 256;x++)
187187      {
188         if (flip_screen_get())
188         if (flip_screen_get(machine))
189189            for (y = 0;y < 256;y++)
190190               *BITMAP_ADDR16(bitmap, y, 255 - x) = 384 + pen;
191191         else
r3957r3958
202202   }
203203}
204204
205static void draw_radar(bitmap_t *bitmap,const rectangle *cliprect)
205static void draw_radar(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect)
206206{
207207   int offs,x;
208208
r3957r3958
215215            sx = (8 * (offs % 8) + x) + 256-64;
216216            sy = ((offs & 0x1ff) / 8) + 96;
217217
218            if (flip_screen_get())
218            if (flip_screen_get(machine))
219219            {
220220               sx = 255 - sx;
221221               sy = 255 - sy;
r3957r3958
250250         flipx = spriteram[offs+1] & 0x40;
251251         flipy = spriteram[offs+1] & 0x80;
252252
253         if (flip_screen_get())
253         if (flip_screen_get(machine))
254254         {
255255            flipx = !flipx;
256256            flipy = !flipy;
r3957r3958
295295
296296      scrollx = senjyo_scrollx1[0];
297297      scrolly = senjyo_scrolly1[0] + 256 * senjyo_scrolly1[1];
298      if (flip_screen_get())
298      if (flip_screen_get(screen->machine))
299299         scrollx = -scrollx;
300300      tilemap_set_scrollx(bg1_tilemap,0,scrollx);
301301      tilemap_set_scrolly(bg1_tilemap,0,scrolly);
r3957r3958
307307         scrollx = senjyo_scrollx1[0];
308308         scrolly = senjyo_scrolly1[0] + 256 * senjyo_scrolly1[1];
309309      }
310      if (flip_screen_get())
310      if (flip_screen_get(screen->machine))
311311         scrollx = -scrollx;
312312      tilemap_set_scrollx(bg2_tilemap,0,scrollx);
313313      tilemap_set_scrolly(bg2_tilemap,0,scrolly);
314314
315315      scrollx = senjyo_scrollx3[0];
316316      scrolly = senjyo_scrolly3[0] + 256 * senjyo_scrolly3[1];
317      if (flip_screen_get())
317      if (flip_screen_get(screen->machine))
318318         scrollx = -scrollx;
319319      tilemap_set_scrollx(bg3_tilemap,0,scrollx);
320320      tilemap_set_scrolly(bg3_tilemap,0,scrolly);
r3957r3958
329329   tilemap_draw(bitmap,cliprect,bg1_tilemap,0,0);
330330   draw_sprites(screen->machine, bitmap,cliprect,3);
331331   tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
332   draw_radar(bitmap,cliprect);
332   draw_radar(screen->machine,bitmap,cliprect);
333333
334334#if 0
335335{
src/mame/video/stvvdp1.c
r3957r3958
1717
1818
1919#include "driver.h"
20#include "deprecat.h"
2120#include "sound/scsp.h"
2221#include "includes/stv.h"
2322
r3957r3958
186185
187186
188187
189static void stv_vdp1_process_list(void);
188static void stv_vdp1_process_list(running_machine *machine);
190189
191190READ32_HANDLER( stv_vdp1_regs_r )
192191{
r3957r3958
314313         if ( STV_VDP1_PTMR == 1 )
315314         {
316315            if ( vdp1_sprite_log ) logerror( "VDP1: Access to register PTMR = %1X\n", STV_VDP1_PTMR );
317            stv_vdp1_process_list( );
316            stv_vdp1_process_list( space->machine );
318317         }
319318      }
320319      else if ( ACCESSING_BITS_0_15 )
r3957r3958
856855static UINT16 sprite_colorbank;
857856
858857
859static void (*drawpixel)(int x, int y, int patterndata, int offsetcnt);
858static void (*drawpixel)(running_machine *machine, int x, int y, int patterndata, int offsetcnt);
860859
861static void drawpixel_poly(int x, int y, int patterndata, int offsetcnt)
860static void drawpixel_poly(running_machine *machine, int x, int y, int patterndata, int offsetcnt)
862861{
863862   stv_framebuffer_draw_lines[y][x] = stv2_current_sprite.CMDCOLR;
864863}
865864
866static void drawpixel_8bpp_trans(int x, int y, int patterndata, int offsetcnt)
865static void drawpixel_8bpp_trans(running_machine *machine, int x, int y, int patterndata, int offsetcnt)
867866{
868867   UINT16 pix;
869868
r3957r3958
874873   }
875874}
876875
877static void drawpixel_4bpp_notrans(int x, int y, int patterndata, int offsetcnt)
876static void drawpixel_4bpp_notrans(running_machine *machine, int x, int y, int patterndata, int offsetcnt)
878877{
879878   UINT16 pix;
880879
r3957r3958
883882   stv_framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
884883}
885884
886static void drawpixel_4bpp_trans(int x, int y, int patterndata, int offsetcnt)
885static void drawpixel_4bpp_trans(running_machine *machine, int x, int y, int patterndata, int offsetcnt)
887886{
888887   UINT16 pix;
889888
r3957r3958
893892      stv_framebuffer_draw_lines[y][x] = pix | sprite_colorbank;
894893}
895894
896static void drawpixel_generic(int x, int y, int patterndata, int offsetcnt)
895static void drawpixel_generic(running_machine *machine, int x, int y, int patterndata, int offsetcnt)
897896{
898897   int pix,mode,transmask, spd = stv2_current_sprite.CMDPMOD & 0x40;
899898   int mesh = stv2_current_sprite.CMDPMOD & 0x100;
r3957r3958
964963            pix = pix+(stv2_current_sprite.CMDCOLR&0xff80);
965964            transmask = 0x7f;
966965            mode = 3;
967         //  pix = mame_rand(Machine);
966         //  pix = mame_rand(machine);
968967            break;
969968         case 0x0020: // mode 4 256 colour bank mode (8bits) (hanagumi title)
970969            pix = gfxdata[patterndata+offsetcnt];
r3957r3958
978977            transmask = 0xffff;
979978            break;
980979         default: // other settings illegal
981            pix = mame_rand(Machine);
980            pix = mame_rand(machine);
982981            mode = 0;
983982            transmask = 0xff;
984983      }
r3957r3958
10831082}
10841083
10851084
1086static void vdp1_fill_slope(const rectangle *cliprect, int patterndata, int xsize,
1085static void vdp1_fill_slope(running_machine *machine, const rectangle *cliprect, int patterndata, int xsize,
10871086                     INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 *nx1, INT32 *nx2,
10881087                     INT32 u1, INT32 u2, INT32 slu1, INT32 slu2, INT32 *nu1, INT32 *nu2,
10891088                     INT32 v1, INT32 v2, INT32 slv1, INT32 slv2, INT32 *nv1, INT32 *nv2,
r3957r3958
11731172               xx2 = cliprect->max_x;
11741173
11751174            while(xx1 <= xx2) {
1176               drawpixel(xx1,_y1,
1175               drawpixel(machine,xx1,_y1,
11771176                       patterndata,
11781177                       (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT));
11791178               xx1++;
r3957r3958
11991198   *nv2 = v2;
12001199}
12011200
1202static void vdp1_fill_line(const rectangle *cliprect, int patterndata, int xsize, INT32 y,
1201static void vdp1_fill_line(running_machine *machine, const rectangle *cliprect, int patterndata, int xsize, INT32 y,
12031202                     INT32 x1, INT32 x2, INT32 u1, INT32 u2, INT32 v1, INT32 v2)
12041203{
12051204   int xx1 = x1>>FRAC_SHIFT;
r3957r3958
12271226         xx2 = cliprect->max_x;
12281227
12291228      while(xx1 <= xx2) {
1230         drawpixel(xx1,y,
1229         drawpixel(machine,xx1,y,
12311230                 patterndata,
12321231                 (v>>FRAC_SHIFT)*xsize+(u>>FRAC_SHIFT));
12331232         xx1++;
r3957r3958
12371236   }
12381237}
12391238
1240static void vdp1_fill_quad(const rectangle *cliprect, int patterndata, int xsize, const struct spoint *q)
1239static void vdp1_fill_quad(running_machine *machine, const rectangle *cliprect, int patterndata, int xsize, const struct spoint *q)
12411240{
12421241   INT32 sl1, sl2, slu1, slu2, slv1, slv2, cury, limy, x1, x2, u1, u2, v1, v2, delta;
12431242   int pmin, pmax, i, ps1, ps2;
r3957r3958
12771276            v2 = p[i].v;
12781277         }
12791278      }
1280      vdp1_fill_line(cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2);
1279      vdp1_fill_line(machine, cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2);
12811280      return;
12821281   }
12831282
r3957r3958
12961295
12971296   for(;;) {
12981297      if(p[ps1-1].y == p[ps2+1].y) {
1299         vdp1_fill_slope(cliprect, patterndata, xsize,
1298         vdp1_fill_slope(machine, cliprect, patterndata, xsize,
13001299                     x1, x2, sl1, sl2, &x1, &x2,
13011300                     u1, u2, slu1, slu2, &u1, &u2,
13021301                     v1, v2, slv1, slv2, &v1, &v2,
r3957r3958
13291328         slu2 = (u2-p[ps2+1].u)/delta;
13301329         slv2 = (v2-p[ps2+1].v)/delta;
13311330      } else if(p[ps1-1].y < p[ps2+1].y) {
1332         vdp1_fill_slope(cliprect, patterndata, xsize,
1331         vdp1_fill_slope(machine, cliprect, patterndata, xsize,
13331332                     x1, x2, sl1, sl2, &x1, &x2,
13341333                     u1, u2, slu1, slu2, &u1, &u2,
13351334                     v1, v2, slv1, slv2, &v1, &v2,
r3957r3958
13491348         slu1 = (u1-p[ps1-1].u)/delta;
13501349         slv1 = (v1-p[ps1-1].v)/delta;
13511350      } else {
1352         vdp1_fill_slope(cliprect, patterndata, xsize,
1351         vdp1_fill_slope(machine, cliprect, patterndata, xsize,
13531352                     x1, x2, sl1, sl2, &x1, &x2,
13541353                     u1, u2, slu1, slu2, &u1, &u2,
13551354                     v1, v2, slv1, slv2, &v1, &v2,
r3957r3958
13711370      }
13721371   }
13731372   if(cury == limy)
1374      vdp1_fill_line(cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2);
1373      vdp1_fill_line(machine, cliprect, patterndata, xsize, cury, x1, x2, u1, u2, v1, v2);
13751374}
13761375
13771376static int x2s(int v)
r3957r3958
13841383   return (INT32)(INT16)v + stvvdp1_local_y;
13851384}
13861385
1387static void stv_vdp1_draw_line( const rectangle *cliprect)
1386static void stv_vdp1_draw_line(running_machine *machine, const rectangle *cliprect)
13881387{
13891388   struct spoint q[4];
13901389
r3957r3958
14001399   q[0].u = q[3].u = q[1].u = q[2].u = 0;
14011400   q[0].v = q[1].v = q[2].v = q[3].v = 0;
14021401
1403   vdp1_fill_quad(cliprect, 0, 1, q);
1402   vdp1_fill_quad(machine, cliprect, 0, 1, q);
14041403}
14051404
1406static void stv_vdp1_draw_poly_line( const rectangle *cliprect)
1405static void stv_vdp1_draw_poly_line(running_machine *machine, const rectangle *cliprect)
14071406{
14081407   struct spoint q[4];
14091408
r3957r3958
14191418   q[0].u = q[3].u = q[1].u = q[2].u = 0;
14201419   q[0].v = q[1].v = q[2].v = q[3].v = 0;
14211420
1422   vdp1_fill_quad(cliprect, 0, 1, q);
1421   vdp1_fill_quad(machine, cliprect, 0, 1, q);
14231422
14241423   q[0].x = x2s(stv2_current_sprite.CMDXB);
14251424   q[0].y = y2s(stv2_current_sprite.CMDYB);
r3957r3958
14331432   q[0].u = q[3].u = q[1].u = q[2].u = 0;
14341433   q[0].v = q[1].v = q[2].v = q[3].v = 0;
14351434
1436   vdp1_fill_quad(cliprect, 0, 1, q);
1435   vdp1_fill_quad(machine, cliprect, 0, 1, q);
14371436
14381437   q[0].x = x2s(stv2_current_sprite.CMDXC);
14391438   q[0].y = y2s(stv2_current_sprite.CMDYC);
r3957r3958
14471446   q[0].u = q[3].u = q[1].u = q[2].u = 0;
14481447   q[0].v = q[1].v = q[2].v = q[3].v = 0;
14491448
1450   vdp1_fill_quad(cliprect, 0, 1, q);
1449   vdp1_fill_quad(machine, cliprect, 0, 1, q);
14511450
14521451   q[0].x = x2s(stv2_current_sprite.CMDXD);
14531452   q[0].y = y2s(stv2_current_sprite.CMDYD);
r3957r3958
14621461   q[0].v = q[1].v = q[2].v = q[3].v = 0;
14631462
14641463   stv_vdp1_setup_shading(q, cliprect);
1465   vdp1_fill_quad(cliprect, 0, 1, q);
1464   vdp1_fill_quad(machine, cliprect, 0, 1, q);
14661465
14671466}
14681467
1469static void stv_vpd1_draw_distorted_sprite(const rectangle *cliprect)
1468static void stv_vpd1_draw_distorted_sprite(running_machine *machine, const rectangle *cliprect)
14701469{
14711470   struct spoint q[4];
14721471
r3957r3958
15211520   }
15221521
15231522   stv_vdp1_setup_shading(q, cliprect);
1524   vdp1_fill_quad(cliprect, patterndata, xsize, q);
1523   vdp1_fill_quad(machine, cliprect, patterndata, xsize, q);
15251524}
15261525
1527static void stv_vpd1_draw_scaled_sprite(const rectangle *cliprect)
1526static void stv_vpd1_draw_scaled_sprite(running_machine *machine, const rectangle *cliprect)
15281527{
15291528   struct spoint q[4];
15301529
r3957r3958
16681667   }
16691668
16701669   stv_vdp1_setup_shading(q, cliprect);
1671   vdp1_fill_quad(cliprect, patterndata, xsize, q);
1670   vdp1_fill_quad(machine, cliprect, patterndata, xsize, q);
16721671}
16731672
16741673
1675static void stv_vpd1_draw_normal_sprite(const rectangle *cliprect, int sprite_type)
1674static void stv_vpd1_draw_normal_sprite(running_machine *machine, const rectangle *cliprect, int sprite_type)
16761675{
16771676   UINT16 *destline;
16781677
r3957r3958
17511750      su = u;
17521751      for (drawxpos = x; drawxpos <= maxdrawxpos; drawxpos++ )
17531752      {
1754         drawpixel( drawxpos, drawypos, patterndata, u );
1753         drawpixel( machine, drawxpos, drawypos, patterndata, u );
17551754         u += dux;
17561755      }
17571756      u = su + duy;
17581757   }
17591758}
17601759
1761static void stv_vdp1_process_list()
1760static void stv_vdp1_process_list(running_machine *machine)
17621761{
17631762   int position;
17641763   int spritecount;
r3957r3958
19131912            case 0x0000:
19141913               if (vdp1_sprite_log) logerror ("Sprite List Normal Sprite\n");
19151914               stv2_current_sprite.ispoly = 0;
1916               stv_vpd1_draw_normal_sprite(cliprect, 0);
1915               stv_vpd1_draw_normal_sprite(machine, cliprect, 0);
19171916               break;
19181917
19191918            case 0x0001:
19201919               if (vdp1_sprite_log) logerror ("Sprite List Scaled Sprite\n");
19211920               stv2_current_sprite.ispoly = 0;
1922               stv_vpd1_draw_scaled_sprite(cliprect);
1921               stv_vpd1_draw_scaled_sprite(machine, cliprect);
19231922               break;
19241923
19251924            case 0x0002:
19261925               if (vdp1_sprite_log) logerror ("Sprite List Distorted Sprite\n");
19271926               stv2_current_sprite.ispoly = 0;
1928               stv_vpd1_draw_distorted_sprite(cliprect);
1927               stv_vpd1_draw_distorted_sprite(machine, cliprect);
19291928               break;
19301929
19311930            case 0x0004:
19321931               if (vdp1_sprite_log) logerror ("Sprite List Polygon\n");
19331932               stv2_current_sprite.ispoly = 1;
1934               stv_vpd1_draw_distorted_sprite(cliprect);
1933               stv_vpd1_draw_distorted_sprite(machine, cliprect);
19351934               break;
19361935
19371936            case 0x0005:
19381937               if (vdp1_sprite_log) logerror ("Sprite List Polyline\n");
19391938               stv2_current_sprite.ispoly = 1;
1940               stv_vdp1_draw_poly_line(cliprect);
1939               stv_vdp1_draw_poly_line(machine, cliprect);
19411940               break;
19421941
19431942            case 0x0006:
19441943               if (vdp1_sprite_log) logerror ("Sprite List Line\n");
19451944               stv2_current_sprite.ispoly = 1;
1946               stv_vdp1_draw_line(cliprect);
1945               stv_vdp1_draw_line(machine, cliprect);
19471946               break;
19481947
19491948            case 0x0008:
r3957r3958
19891988
19901989   /* not here! this is done every frame drawn even if the cpu isn't running eg in the debugger */
19911990//  if(!(stv_scu[40] & 0x2000)) /*Sprite draw end irq*/
1992//      cpu_set_input_line_and_vector(Machine->cpu[0], 2, HOLD_LINE , 0x4d);
1991//      cpu_set_input_line_and_vector(machine->cpu[0], 2, HOLD_LINE , 0x4d);
19931992
19941993   if (vdp1_sprite_log) logerror ("End of list processing!\n");
19951994}
r3957r3958
20642063         break;
20652064      case 2:/*Automatic Draw*/
20662065         if ( framebufer_changed )
2067            stv_vdp1_process_list();
2066            stv_vdp1_process_list(machine);
20682067         break;
20692068      case 3:   /*<invalid>*/
20702069         logerror("Warning: Invalid PTM mode set for VDP1!\n");
src/mame/video/yiear.c
r3957r3958
7171{
7272   /* bit 0 flips screen */
7373
74   if (flip_screen_get() != (data & 0x01))
74   if (flip_screen_get(space->machine) != (data & 0x01))
7575   {
76      flip_screen_set(data & 0x01);
76      flip_screen_set(space->machine, data & 0x01);
7777      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
7878   }
7979
r3957r3958
122122      int sy = 240 - spriteram[offs + 1];
123123      int sx = spriteram_2[offs];
124124
125      if (flip_screen_get())
125      if (flip_screen_get(machine))
126126      {
127127         sy = 240 - sy;
128128         flipy = !flipy;
src/mame/video/sonson.c
r3957r3958
116116
117117WRITE8_HANDLER( sonson_flipscreen_w )
118118{
119   flip_screen_set(~data & 0x01);
119   flip_screen_set(space->machine, ~data & 0x01);
120120}
121121
122122static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
148148      int sx = spriteram[offs + 3];
149149      int sy = spriteram[offs + 0];
150150
151      if (flip_screen_get())
151      if (flip_screen_get(machine))
152152      {
153153         sx = 240 - sx;
154154         sy = 240 - sy;
src/mame/video/simpl156.c
r3957r3958
4040   int offs;
4141
4242   //FIXME: flip_screen_x should not be written!
43   flip_screen_set_no_update(1);
43   flip_screen_set_no_update(machine, 1);
4444
4545   for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
4646   {
r3957r3958
8686         inc = 1;
8787      }
8888
89      if (flip_screen_get())
89      if (flip_screen_get(machine))
9090      {
9191         y=240-y;
9292         x=304-x;
src/mame/video/deadang.c
r3957r3958
108108      color = (spriteram16[offs+1]>>12)&0xf;
109109      sprite = spriteram16[offs+1]&0xfff;
110110
111      if (flip_screen_get()) {
111      if (flip_screen_get(machine)) {
112112         x=240-x;
113113         y=240-y;
114114         if (fx) fx=0; else fx=1;
r3957r3958
145145   tilemap_set_enable(pf3_layer,!(deadang_scroll_ram[0x34]&1));
146146   tilemap_set_enable(pf1_layer,!(deadang_scroll_ram[0x34]&2));
147147   tilemap_set_enable(pf2_layer,!(deadang_scroll_ram[0x34]&4));
148   flip_screen_set( deadang_scroll_ram[0x34]&0x40 );
148   flip_screen_set(screen->machine, deadang_scroll_ram[0x34]&0x40 );
149149
150150   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
151151   bitmap_fill(priority_bitmap,cliprect,0);
src/mame/video/bking.c
r3957r3958
149149
150150   coin_lockout_global_w(~data & 0x01);
151151
152   flip_screen_set_no_update(data & 0x04);
152   flip_screen_set_no_update(space->machine, data & 0x04);
153153
154   tilemap_set_flip(ALL_TILEMAPS, flip_screen_get() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
154   tilemap_set_flip(ALL_TILEMAPS, flip_screen_get(space->machine) ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
155155
156156   controller = data & 0x02;
157157
r3957r3958
323323      latch = 0x0400;
324324   }
325325
326   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get() ? -xld : xld);
327   tilemap_set_scrolly(bg_tilemap, 0, flip_screen_get() ? -yld : yld);
326   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get(machine) ? -xld : xld);
327   tilemap_set_scrolly(bg_tilemap, 0, flip_screen_get(machine) ? -yld : yld);
328328
329329   tilemap_draw(helper0, &rect, bg_tilemap, 0, 0);
330330
r3957r3958
350350               int col = (xld + x) / 8 + 1;
351351               int row = (yld + y) / 8 + 0;
352352
353               latch |= (flip_screen_get() ? 31 - col : col) << 0;
354               latch |= (flip_screen_get() ? 31 - row : row) << 5;
353               latch |= (flip_screen_get(machine) ? 31 - col : col) << 0;
354               latch |= (flip_screen_get(machine) ? 31 - row : row) << 5;
355355
356356               pc3259_output[0] = (latch >> 0x0) & 0xf;
357357               pc3259_output[1] = (latch >> 0x4) & 0xf;
src/mame/video/ddragon3.c
r3957r3958
2828      case 2: COMBINE_DATA(&ddragon3_bg_scrollx);   break;   // Scroll X, BG0
2929      case 3: COMBINE_DATA(&ddragon3_bg_scrolly);   break;   // Scroll Y, BG0
3030      case 4:                              break;   // Unknown write
31      case 5: flip_screen_set(data & 0x01);      break;   // Flip Screen
31      case 5: flip_screen_set(space->machine, data & 0x01);      break;   // Flip Screen
3232      case 6:
3333         COMBINE_DATA(&ddragon3_bg_tilebase);         // BG Tile Base
3434         ddragon3_bg_tilebase &= 0x1ff;
r3957r3958
4545      case 1: return ddragon3_fg_scrolly;
4646      case 2: return ddragon3_bg_scrollx;
4747      case 3: return ddragon3_bg_scrolly;
48      case 5: return flip_screen_get();
48      case 5: return flip_screen_get(space->machine);
4949      case 6: return ddragon3_bg_tilebase;
5050   }
5151
r3957r3958
153153         if (attr & 0x02) sy = 239 + (0x100 - sy); else sy = 240 - sy;
154154         if (sx > 0x17f) sx = 0 - (0x200 - sx);
155155
156         if (flip_screen_get())
156         if (flip_screen_get(machine))
157157         {
158158            sx = 304 - sx;
159159            sy = 224 - sy;
r3957r3958
164164         for (i = 0; i <= height; i++)
165165         {
166166            drawgfx(bitmap, machine->gfx[1], code + i, color, flipx, flipy,
167               sx, sy + (flip_screen_get() ? (i * 16) : (-i * 16)), cliprect,
167               sx, sy + (flip_screen_get(machine) ? (i * 16) : (-i * 16)), cliprect,
168168               TRANSPARENCY_PEN, 0);
169169         }
170170      }
src/mame/video/ambush.c
r3957r3958
7373
7474      code = videoram[offs] | ((col & 0x60) << 3);
7575
76      if (flip_screen_get())
76      if (flip_screen_get(machine))
7777      {
7878         sx = 31 - sx;
7979         sy = 31 - sy;
r3957r3958
8383      drawgfx(bitmap,machine->gfx[0],
8484            code,
8585            (col & 0x0f) | ((*ambush_colorbank & 0x03) << 4),
86            flip_screen_get(),flip_screen_get(),
86            flip_screen_get(machine),flip_screen_get(machine),
8787            8*sx, (8*sy + scroll) & 0xff,
8888            cliprect,transparency,0);
8989   }
r3957r3958
124124         /* 16x16 sprites */
125125         gfx = 1;
126126
127         if (!flip_screen_get())
127         if (!flip_screen_get(screen->machine))
128128         {
129129            sy = 240 - sy;
130130         }
r3957r3958
139139         gfx = 0;
140140         code <<= 2;
141141
142         if (!flip_screen_get())
142         if (!flip_screen_get(screen->machine))
143143         {
144144            sy = 248 - sy;
145145         }
r3957r3958
153153      flipx = spriteram[offs + 1] & 0x40;
154154      flipy = spriteram[offs + 1] & 0x80;
155155
156      if (flip_screen_get())
156      if (flip_screen_get(screen->machine))
157157      {
158158         flipx = !flipx;
159159         flipy = !flipy;
src/mame/video/sauro.c
r3957r3958
7878
7979WRITE8_HANDLER( sauro_scroll_fg_w )
8080{
81   const int *map = (flip_screen_get() ? scroll2_map_flip : scroll2_map);
81   const int *map = (flip_screen_get(space->machine) ? scroll2_map_flip : scroll2_map);
8282   int scroll = (data & 0xf8) | map[data & 7];
8383
8484   tilemap_set_scrollx(fg_tilemap, 0, scroll);
r3957r3958
126126
127127      flipx = spriteram[offs+3] & 0x04;
128128
129      if (flip_screen_get())
129      if (flip_screen_get(machine))
130130      {
131131         flipx = !flipx;
132132         sx = (235 - sx) & 0xff;  // The &0xff is not 100% percent correct
r3957r3958
136136      drawgfx(bitmap, machine->gfx[2],
137137            code,
138138            color,
139            flipx,flip_screen_get(),
139            flipx,flip_screen_get(machine),
140140            sx,sy,
141141            cliprect,TRANSPARENCY_PEN,0);
142142   }
r3957r3958
201201
202202      flipx = spriteram[offs+3] & 0x04;
203203
204      if (flip_screen_get())
204      if (flip_screen_get(machine))
205205      {
206206         flipx = !flipx;
207207         sx = (235 - sx) & 0xff;  /* The &0xff is not 100% percent correct */
r3957r3958
211211      drawgfx(bitmap, machine->gfx[1],
212212            code,
213213            color,
214            flipx,flip_screen_get(),
214            flipx,flip_screen_get(machine),
215215            sx,sy,
216216            cliprect,TRANSPARENCY_PEN,0);
217217   }
src/mame/video/gaplus.c
r3957r3958
290290         int duplicate = spriteram_3[offs] & 0x80;
291291         int x,y;
292292
293         if (flip_screen_get())
293         if (flip_screen_get(machine))
294294         {
295295            flipx ^= 1;
296296            flipy ^= 1;
r3957r3958
319319VIDEO_UPDATE( gaplus )
320320{
321321   /* flip screen control is embedded in RAM */
322   flip_screen_set(gaplus_spriteram[0x1f7f-0x800] & 1);
322   flip_screen_set(screen->machine, gaplus_spriteram[0x1f7f-0x800] & 1);
323323
324324   bitmap_fill(bitmap, cliprect, 0);
325325
src/mame/video/carpolo.c
r3957r3958
603603                             car1_x, car1_y, car1_code, car1_flipy,
604604                             car2_x, car2_y, car2_code, car2_flipy,
605605                             &col_x, &col_y))
606      carpolo_generate_car_car_interrupt(0, 1);
606      carpolo_generate_car_car_interrupt(machine, 0, 1);
607607
608608   /* cars 1 and 3 */
609609   else if (check_sprite_sprite_collision(machine,
610610                                 car1_x, car1_y, car1_code, car1_flipy,
611611                                 car3_x, car3_y, car3_code, car3_flipy,
612612                                 &col_x, &col_y))
613      carpolo_generate_car_car_interrupt(0, 2);
613      carpolo_generate_car_car_interrupt(machine, 0, 2);
614614
615615   /* cars 1 and 4 */
616616   else if (check_sprite_sprite_collision(machine,
617617                                 car1_x, car1_y, car1_code, car1_flipy,
618618                                 car4_x, car4_y, car4_code, car4_flipy,
619619                                 &col_x, &col_y))
620      carpolo_generate_car_car_interrupt(0, 3);
620      carpolo_generate_car_car_interrupt(machine, 0, 3);
621621
622622   /* cars 2 and 3 */
623623   else if (check_sprite_sprite_collision(machine,
624624                                 car2_x, car2_y, car2_code, car2_flipy,
625625                                 car3_x, car3_y, car3_code, car3_flipy,
626626                                 &col_x, &col_y))
627      carpolo_generate_car_car_interrupt(1, 2);
627      carpolo_generate_car_car_interrupt(machine, 1, 2);
628628
629629   /* cars 2 and 4 */
630630   else if (check_sprite_sprite_collision(machine,
631631                                 car2_x, car2_y, car2_code, car2_flipy,
632632                                 car4_x, car4_y, car4_code, car4_flipy,
633633                                 &col_x, &col_y))
634      carpolo_generate_car_car_interrupt(1, 3);
634      carpolo_generate_car_car_interrupt(machine, 1, 3);
635635
636636   /* cars 3 and 4 */
637637   else if (check_sprite_sprite_collision(machine,
638638                                 car3_x, car3_y, car3_code, car3_flipy,
639639                                 car4_x, car4_y, car4_code, car4_flipy,
640640                                 &col_x, &col_y))
641      carpolo_generate_car_car_interrupt(2, 3);
641      carpolo_generate_car_car_interrupt(machine, 2, 3);
642642
643643
644644
r3957r3958
647647                             car1_x, car1_y, car1_code, car1_flipy,
648648                             ball_x, ball_y, ball_code, ball_flipy,
649649                             &col_x, &col_y))
650      carpolo_generate_car_ball_interrupt(0, col_x, col_y);
650      carpolo_generate_car_ball_interrupt(machine, 0, col_x, col_y);
651651
652652   else if (check_sprite_sprite_collision(machine,
653653                                 car2_x, car2_y, car2_code, car2_flipy,
654654                                   ball_x, ball_y, ball_code, ball_flipy,
655655                                 &col_x, &col_y))
656      carpolo_generate_car_ball_interrupt(1, col_x, col_y);
656      carpolo_generate_car_ball_interrupt(machine, 1, col_x, col_y);
657657
658658   else if (check_sprite_sprite_collision(machine,
659659                                 car3_x, car3_y, car3_code, car3_flipy,
660660                                   ball_x, ball_y, ball_code, ball_flipy,
661661                                 &col_x, &col_y))
662      carpolo_generate_car_ball_interrupt(2, col_x, col_y);
662      carpolo_generate_car_ball_interrupt(machine, 2, col_x, col_y);
663663
664664   else if (check_sprite_sprite_collision(machine,
665665                                 car4_x, car4_y, car4_code, car4_flipy,
666666                                   ball_x, ball_y, ball_code, ball_flipy,
667667                                 &col_x, &col_y))
668      carpolo_generate_car_ball_interrupt(3, col_x, col_y);
668      carpolo_generate_car_ball_interrupt(machine, 3, col_x, col_y);
669669
670670
671671   /* check car-goal collision */
672672   if (check_sprite_left_goal_collision(machine, car1_x, car1_y, car1_code, car1_flipy, 1))
673      carpolo_generate_car_goal_interrupt(0, 0);
673      carpolo_generate_car_goal_interrupt(machine, 0, 0);
674674
675675   else if (check_sprite_right_goal_collision(machine, car1_x, car1_y, car1_code, car1_flipy, 1))
676      carpolo_generate_car_goal_interrupt(0, 1);
676      carpolo_generate_car_goal_interrupt(machine, 0, 1);
677677
678678   else if (check_sprite_left_goal_collision(machine, car2_x, car2_y, car2_code, car2_flipy, 1))
679      carpolo_generate_car_goal_interrupt(1, 0);
679      carpolo_generate_car_goal_interrupt(machine, 1, 0);
680680
681681   else if (check_sprite_right_goal_collision(machine, car2_x, car2_y, car2_code, car2_flipy, 1))
682      carpolo_generate_car_goal_interrupt(1, 1);
682      carpolo_generate_car_goal_interrupt(machine, 1, 1);
683683
684684   else if (check_sprite_left_goal_collision(machine, car3_x, car3_y, car3_code, car3_flipy, 1))
685      carpolo_generate_car_goal_interrupt(2, 0);
685      carpolo_generate_car_goal_interrupt(machine, 2, 0);
686686
687687   else if (check_sprite_right_goal_collision(machine, car3_x, car3_y, car3_code, car3_flipy, 1))
688      carpolo_generate_car_goal_interrupt(2, 1);
688      carpolo_generate_car_goal_interrupt(machine, 2, 1);
689689
690690   else if (check_sprite_left_goal_collision(machine, car4_x, car4_y, car4_code, car4_flipy, 1))
691      carpolo_generate_car_goal_interrupt(3, 0);
691      carpolo_generate_car_goal_interrupt(machine, 3, 0);
692692
693693   else if (check_sprite_right_goal_collision(machine, car4_x, car4_y, car4_code, car4_flipy, 1))
694      carpolo_generate_car_goal_interrupt(3, 1);
694      carpolo_generate_car_goal_interrupt(machine, 3, 1);
695695
696696
697697   /* check ball collision with static screen elements */
r3957r3958
700700
701701      col = check_sprite_left_goal_collision(machine, ball_x, ball_y, ball_code, ball_flipy, 0);
702702
703      if (col == 1)  carpolo_generate_ball_screen_interrupt(0x05);
704      if (col == 2)  carpolo_generate_ball_screen_interrupt(0x03);
703      if (col == 1)  carpolo_generate_ball_screen_interrupt(machine, 0x05);
704      if (col == 2)  carpolo_generate_ball_screen_interrupt(machine, 0x03);
705705
706706
707707      col = check_sprite_right_goal_collision(machine, ball_x, ball_y, ball_code, ball_flipy, 0);
708708
709      if (col == 1)  carpolo_generate_ball_screen_interrupt(0x05 | 0x08);
710      if (col == 2)  carpolo_generate_ball_screen_interrupt(0x03 | 0x08);
709      if (col == 1)  carpolo_generate_ball_screen_interrupt(machine, 0x05 | 0x08);
710      if (col == 2)  carpolo_generate_ball_screen_interrupt(machine, 0x03 | 0x08);
711711
712712
713713      if (check_sprite_border_collision(machine, ball_x, ball_y, ball_code, ball_flipy))
714         carpolo_generate_ball_screen_interrupt(0x06);
714         carpolo_generate_ball_screen_interrupt(machine, 0x06);
715715   }
716716
717717
r3957r3958
722722      col = check_sprite_border_collision(machine, car1_x, car1_y, car1_code, car1_flipy);
723723
724724      if (col)
725         carpolo_generate_car_border_interrupt(0, (col == 2));
725         carpolo_generate_car_border_interrupt(machine, 0, (col == 2));
726726      else
727727      {
728728         col = check_sprite_border_collision(machine, car2_x, car2_y, car2_code, car2_flipy);
729729
730730         if (col)
731            carpolo_generate_car_border_interrupt(1, (col == 2));
731            carpolo_generate_car_border_interrupt(machine, 1, (col == 2));
732732         else
733733         {
734734            col = check_sprite_border_collision(machine, car3_x, car3_y, car3_code, car3_flipy);
735735
736736            if (col)
737               carpolo_generate_car_border_interrupt(2, (col == 2));
737               carpolo_generate_car_border_interrupt(machine, 2, (col == 2));
738738            else
739739            {
740740               col = check_sprite_border_collision(machine, car4_x, car4_y, car4_code, car4_flipy);
741741
742742               if (col)
743                  carpolo_generate_car_border_interrupt(3, (col == 2));
743                  carpolo_generate_car_border_interrupt(machine, 3, (col == 2));
744744            }
745745         }
746746      }
src/mame/video/drmicro.c
r3957r3958
1717
1818/****************************************************************************/
1919
20void drmicro_flip_w( int flip )
20void drmicro_flip_w( running_machine *machine, int flip )
2121{
2222   flipscreen = flip ? 1 : 0;
23   flip_screen_set(flip);
23   flip_screen_set(machine, flip);
2424}
2525
2626WRITE8_HANDLER( drmicro_videoram_w )
src/mame/video/speedatk.c
r3957r3958
9797      {
9898         /*temporary hook-up.*/
9999         case 0x0d:
100            flip_screen_set(data & 8);
100            flip_screen_set(space->machine, data & 8);
101101            tilemap_set_scrolldx(bg_tilemap,0,data & 0x40);
102102            break;
103103         default:
src/mame/video/system1.c
r3957r3958
164164   system1_video_mode = data;
165165
166166   /* bit 7 is flip screen */
167   flip_screen_set(data & 0x80);
167   flip_screen_set(space->machine, data & 0x80);
168168}
169169
170170READ8_HANDLER( system1_videomode_r )
r3957r3958
289289      x_flipped = x;
290290      y = y_flipped = sy+row;
291291
292      if (flip_screen_get())
292      if (flip_screen_get(machine))
293293      {
294294         y_flipped = 258 - sy - height + row;
295295         x_flipped = (252*2) - x;
r3957r3958
323323         if (color1)
324324            draw_pixel(machine,bitmap,x,y,x_flipped,y_flipped,spr_number,sprite_palette_base+color1);
325325         x++;
326         x_flipped += flip_screen_get() ? -1 : 1;
326         x_flipped += flip_screen_get(machine) ? -1 : 1;
327327
328328         if (color2 == 15) break;
329329         if (color2)
330330            draw_pixel(machine,bitmap,x,y,x_flipped,y_flipped,spr_number,sprite_palette_base+color2);
331331         x++;
332         x_flipped += flip_screen_get() ? -1 : 1;
332         x_flipped += flip_screen_get(machine) ? -1 : 1;
333333      }
334334   }
335335}
r3957r3958
383383         sx = (offs/2) % 32;
384384         sy = (offs/2) / 32;
385385
386         if (flip_screen_get())
386         if (flip_screen_get(machine))
387387         {
388388            sx = 31 - sx;
389389            sy = 31 - sy;
r3957r3958
397397            drawgfx(bitmap,machine->gfx[0],
398398                  code,
399399                  color,
400                  flip_screen_get(),flip_screen_get(),
400                  flip_screen_get(machine),flip_screen_get(machine),
401401                  8*sx + blockgal_kludgeoffset,8*sy,
402402                  cliprect,TRANSPARENCY_PEN,0);
403403         }
r3957r3958
442442            sx = (offs/2) % 32;
443443            sy = (offs/2) / 32;
444444
445            if (flip_screen_get())
445            if (flip_screen_get(machine))
446446            {
447447               sx = 31 - sx;
448448               sy = 31 - sy;
r3957r3958
451451            drawgfx(tmp_bitmap,machine->gfx[0],
452452                  code,
453453                  color,
454                  flip_screen_get(),flip_screen_get(),
454                  flip_screen_get(machine),flip_screen_get(machine),
455455                  8*sx,8*sy,
456456                  0,TRANSPARENCY_NONE,0);
457457         }
458458      }
459459
460460      /* copy the temporary bitmap to the screen */
461      if (flip_screen_get())
461      if (flip_screen_get(machine))
462462         copyscrollbitmap(bitmap,tmp_bitmap,1,&background_scrollx_flip,1,&background_scrolly_flip,cliprect);
463463      else
464464         copyscrollbitmap(bitmap,tmp_bitmap,1,&background_scrollx,1,&background_scrolly,cliprect);
r3957r3958
480480            sx = (offs/2) % 32;
481481            sy = (offs/2) / 32;
482482
483            if (flip_screen_get())
483            if (flip_screen_get(machine))
484484            {
485485               sx = 8*(31-sx) + background_scrollx_flip;
486486               sy = 8*(31-sy) + background_scrolly_flip;
r3957r3958
495495            drawgfx(bitmap,machine->gfx[0],
496496                  code,
497497                  color,
498                  flip_screen_get(),flip_screen_get(),
498                  flip_screen_get(machine),flip_screen_get(machine),
499499                  sx,sy,
500500                  cliprect,TRANSPARENCY_PEN,0);
501501            drawgfx(bitmap,machine->gfx[0],
502502                  code,
503503                  color,
504                  flip_screen_get(),flip_screen_get(),
504                  flip_screen_get(machine),flip_screen_get(machine),
505505                  sx-256,sy,
506506                  cliprect,TRANSPARENCY_PEN,0);
507507            drawgfx(bitmap,machine->gfx[0],
508508                  code,
509509                  color,
510                  flip_screen_get(),flip_screen_get(),
510                  flip_screen_get(machine),flip_screen_get(machine),
511511                  sx,sy-256,
512512                  cliprect,TRANSPARENCY_PEN,0);
513513            drawgfx(bitmap,machine->gfx[0],
514514                  code,
515515                  color,
516                  flip_screen_get(),flip_screen_get(),
516                  flip_screen_get(machine),flip_screen_get(machine),
517517                  sx-256,sy-256,
518518                  cliprect,TRANSPARENCY_PEN,0);
519519         }
r3957r3958
584584            sx = (offs/2) % 32;
585585            sy = (offs/2) / 32;
586586
587            if (flip_screen_get())
587            if (flip_screen_get(machine))
588588            {
589589               sx = 31 - sx;
590590               sy = 31 - sy;
r3957r3958
593593            drawgfx(tmp_bitmap,machine->gfx[0],
594594                  code,
595595                  color,
596                  flip_screen_get(),flip_screen_get(),
596                  flip_screen_get(machine),flip_screen_get(machine),
597597                  8*sx,8*sy,
598598                  0,TRANSPARENCY_NONE,0);
599599         }
r3957r3958
602602      /* copy the temporary bitmap to the screen */
603603      if (choplifter_scroll_x_on)
604604      {
605         if (flip_screen_get())
605         if (flip_screen_get(machine))
606606         {
607607            int scrollx_row_flip[32],i;
608608
r3957r3958
634634            sx = (offs/2) % 32;
635635            sy = (offs/2) / 32;
636636
637            if (flip_screen_get())
637            if (flip_screen_get(machine))
638638            {
639639               sx = 8*(31-sx);
640640
r3957r3958
654654            drawgfx(bitmap,machine->gfx[0],
655655                  code,
656656                  color,
657                  flip_screen_get(),flip_screen_get(),
657                  flip_screen_get(machine),flip_screen_get(machine),
658658                  sx,8*sy,
659659                  cliprect,TRANSPARENCY_PEN,0);
660660         }
r3957r3958
737737            if (x > 256) x -= 512;
738738            if (y > 224) y -= 512;
739739
740            if (flip_screen_get())
740            if (flip_screen_get(machine))
741741            {
742742               x = 248 - x;
743743               y = 248 - y;
r3957r3958
751751               drawgfx(bitmap,machine->gfx[0],
752752                     code,
753753                     ((code >> 5) & 0x3f) + 64,
754                     flip_screen_get(),flip_screen_get(),
754                     flip_screen_get(machine),flip_screen_get(machine),
755755                     x,y,
756756                     cliprect, TRANSPARENCY_NONE, 0);
757757            else if (priority)
758758               drawgfx(bitmap,machine->gfx[0],
759759                     code,
760760                     ((code >> 5) & 0x3f) + 64,
761                     flip_screen_get(),flip_screen_get(),
761                     flip_screen_get(machine),flip_screen_get(machine),
762762                     x,y,
763763                     cliprect, TRANSPARENCY_PEN, 0);
764764
r3957r3958
783783      code = wbml_paged_videoram[offs] | (wbml_paged_videoram[offs+1] << 8);
784784      code = ((code >> 4) & 0x800) | (code & 0x7ff);
785785
786      if (flip_screen_get())
786      if (flip_screen_get(machine))
787787      {
788788         sx = 31 - sx;
789789         sy = 31 - sy;
r3957r3958
792792      drawgfx(bitmap,machine->gfx[0],
793793            code,
794794            (code >> 5) & 0x3f,
795            flip_screen_get(),flip_screen_get(),
795            flip_screen_get(machine),flip_screen_get(machine),
796796            8*sx,8*sy,
797797            cliprect,TRANSPARENCY_PEN,0);
798798   }
r3957r3958
838838            if (x > 256) x -= 512;
839839            if (y > 224) y -= 512;
840840
841            if (flip_screen_get())
841            if (flip_screen_get(machine))
842842            {
843843               x = 248 - x;
844844               y = 248 - y;
r3957r3958
852852               drawgfx(bitmap,machine->gfx[0],
853853                     code,
854854                     ((code >> 5) & 0x3f) + 64,
855                     flip_screen_get(),flip_screen_get(),
855                     flip_screen_get(machine),flip_screen_get(machine),
856856                     x,y,
857857                     cliprect, TRANSPARENCY_NONE, 0);
858858            else if (priority)
859859               drawgfx(bitmap,machine->gfx[0],
860860                     code,
861861                     ((code >> 5) & 0x3f) + 64,
862                     flip_screen_get(),flip_screen_get(),
862                     flip_screen_get(machine),flip_screen_get(machine),
863863                     x,y,
864864                     cliprect, TRANSPARENCY_PEN, 0);
865865
src/mame/video/powerins.c
r3957r3958
5959
6060WRITE16_HANDLER( powerins_flipscreen_w )
6161{
62   if (ACCESSING_BITS_0_7)   flip_screen_set( data & 1 );
62   if (ACCESSING_BITS_0_7)   flip_screen_set(space->machine, data & 1 );
6363}
6464
6565WRITE16_HANDLER( powerins_tilebank_w )
r3957r3958
298298
299299      /* Handle flip_screen. Apply a global offset of 32 pixels along x too */
300300
301      if (flip_screen_get())
301      if (flip_screen_get(machine))
302302      {   sx = screen_w - sx - dimx*16 - 32;   flipx = !flipx;
303303         sy = screen_h - sy - dimy*16;      flipy = !flipy;
304304         code += dimx*dimy-1;         inc = -1;   }
src/mame/video/seta2.c
r3957r3958
128128   switch( offset*2 )
129129   {
130130   case 0x1c:   // FLIP SCREEN (myangel)    <- this is actually zoom
131      flip_screen_set( data & 1 );
131      flip_screen_set(space->machine, data & 1 );
132132      if (data & ~1)   logerror("CPU #0 PC %06X: flip screen unknown bits %04X\n",cpu_get_pc(space->cpu),data);
133133      break;
134134   case 0x2a:   // FLIP X (pzlbowl)
135      flip_screen_x_set( data & 1 );
135      flip_screen_x_set(space->machine, data & 1 );
136136      if (data & ~1)   logerror("CPU #0 PC %06X: flipx unknown bits %04X\n",cpu_get_pc(space->cpu),data);
137137      break;
138138   case 0x2c:   // FLIP Y (pzlbowl)
139      flip_screen_y_set( data & 1 );
139      flip_screen_y_set(space->machine, data & 1 );
140140      if (data & ~1)   logerror("CPU #0 PC %06X: flipy unknown bits %04X\n",cpu_get_pc(space->cpu),data);
141141      break;
142142
src/mame/video/shootout.c
r3957r3958
106106            int flipx = (attributes & 0x04);
107107            int flipy = 0;
108108
109            if (flip_screen_get()) {
109            if (flip_screen_get(machine)) {
110110               flipx = !flipx;
111111               flipy = !flipy;
112112            }
r3957r3958
117117
118118               vx = sx;
119119               vy = sy;
120               if (flip_screen_get()) {
120               if (flip_screen_get(machine)) {
121121                  vx = 240 - vx;
122122                  vy = 240 - vy;
123123               }
r3957r3958
136136
137137            vx = sx;
138138            vy = sy;
139            if (flip_screen_get()) {
139            if (flip_screen_get(machine)) {
140140               vx = 240 - vx;
141141               vy = 240 - vy;
142142            }
src/mame/video/paradise.c
r3957r3958
3939
4040WRITE8_HANDLER( paradise_flipscreen_w )
4141{
42   flip_screen_set(data ? 0 : 1);
42   flip_screen_set(space->machine, data ? 0 : 1);
4343}
4444
4545WRITE8_HANDLER( tgtball_flipscreen_w )
4646{
47   flip_screen_set(data ? 1 : 0);
47   flip_screen_set(space->machine, data ? 1 : 0);
4848}
4949
5050
r3957r3958
192192      int flipx   =   0;   // ?
193193      int flipy   =   0;
194194
195      if (flip_screen_get())   {   x = 0xf0 - x;   flipx = !flipx;
195      if (flip_screen_get(machine))   {   x = 0xf0 - x;   flipx = !flipx;
196196                        y = 0xf0 - y;   flipy = !flipy;   }
197197
198198      drawgfx(bitmap,machine->gfx[0],
r3957r3958
253253
254254   if (layers_ctrl&1)   tilemap_draw(bitmap,cliprect, tilemap_0, 0,0);
255255   if (layers_ctrl&2)   tilemap_draw(bitmap,cliprect, tilemap_1, 0,0);
256   if (layers_ctrl&4)   copybitmap_trans(bitmap,tmpbitmap,flip_screen_get(),flip_screen_get(),0,0,cliprect, 0x80f);
256   if (layers_ctrl&4)   copybitmap_trans(bitmap,tmpbitmap,flip_screen_get(screen->machine),flip_screen_get(screen->machine),0,0,cliprect, 0x80f);
257257
258258   if (paradise_priority & 2)
259259   {
src/mame/video/ashnojoe.c
r3957r3958
205205
206206//  ashnojoe_tilemap_reg[0] & 0x10 // ?? on coin insertion
207207
208   flip_screen_set(ashnojoe_tilemap_reg[0] & 1);
208   flip_screen_set(screen->machine, ashnojoe_tilemap_reg[0] & 1);
209209
210210   if(ashnojoe_tilemap_reg[0] & 0x02)
211211      tilemap_draw(bitmap,cliprect,joetilemap7,0,0);
src/mame/video/terracre.c
r3957r3958
7878         color += 16 * (spritepalettebank[(tile>>1)&0xff] & 0x0f);
7979      }
8080
81      if (flip_screen_get())
81      if (flip_screen_get(machine))
8282      {
8383            sx=240-sx;
8484            sy=240-sy;
r3957r3958
169169   {
170170      coin_counter_w( 0, data&0x01 );
171171      coin_counter_w( 1, (data&0x02)>>1 );
172      flip_screen_set(data&0x04);
172      flip_screen_set(space->machine, data&0x04);
173173   }
174174}
175175
src/mame/video/mouser.c
r3957r3958
4545
4646WRITE8_HANDLER( mouser_flip_screen_x_w )
4747{
48   flip_screen_x_set(~data & 1);
48   flip_screen_x_set(space->machine, ~data & 1);
4949}
5050
5151WRITE8_HANDLER( mouser_flip_screen_y_w )
5252{
53   flip_screen_y_set(~data & 1);
53   flip_screen_y_set(space->machine, ~data & 1);
5454}
5555
5656VIDEO_UPDATE( mouser )
r3957r3958
6868      sx = offs % 32;
6969      sy = offs / 32;
7070
71      if (flip_screen_x_get())
71      if (flip_screen_x_get(screen->machine))
7272      {
7373         sx = 31 - sx;
7474      }
7575
76      if (flip_screen_y_get())
76      if (flip_screen_y_get(screen->machine))
7777      {
7878         sy = 31 - sy;
7979      }
r3957r3958
9090      drawgfx(bitmap,screen->machine->gfx[0],
9191            videoram[offs] | (colorram[color_offs]>>5)*256 | ((colorram[color_offs]>>4)&1)*512,
9292            colorram[color_offs]%16,
93            flip_screen_x_get(),flip_screen_y_get(),
93            flip_screen_x_get(screen->machine),flip_screen_y_get(screen->machine),
9494            8*sx,scrolled_y_position,
9595            cliprect,TRANSPARENCY_NONE,0);
9696   }
r3957r3958
106106      flipx = (spriteram[offs]&0x40)>>6;
107107      flipy = (spriteram[offs]&0x80)>>7;
108108
109      if (flip_screen_x_get())
109      if (flip_screen_x_get(screen->machine))
110110      {
111111         flipx = !flipx;
112112         sx = 240 - sx;
113113      }
114114
115      if (flip_screen_y_get())
115      if (flip_screen_y_get(screen->machine))
116116      {
117117         flipy = !flipy;
118118         sy = 238 - sy;
r3957r3958
136136      flipx = (spriteram[offs]&0x40)>>6;
137137      flipy = (spriteram[offs]&0x80)>>7;
138138
139      if (flip_screen_x_get())
139      if (flip_screen_x_get(screen->machine))
140140      {
141141         flipx = !flipx;
142142         sx = 240 - sx;
143143      }
144144
145      if (flip_screen_y_get())
145      if (flip_screen_y_get(screen->machine))
146146      {
147147         flipy = !flipy;
148148         sy = 238 - sy;
src/mame/video/deco32.c
r3957r3958
240240      fx = !(spritedata[offs+0]&0x4000);
241241      fy = !(spritedata[offs+0]&0x8000);
242242
243      if (!flip_screen_get()) {
243      if (!flip_screen_get(machine)) {
244244         sx = sx & 0x01ff;
245245         sy = sy & 0x01ff;
246246         if (sx>0x180) sx=-(0x200 - sx);
r3957r3958
12181218   int pf1_enable,pf2_enable,pf3_enable;
12191219   static int last_pf3_bank;
12201220
1221   flip_screen_set(deco32_pf12_control[0]&0x80);
1222   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
1221   flip_screen_set(screen->machine, deco32_pf12_control[0]&0x80);
1222   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get(screen->machine) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
12231223
12241224   deco32_setup_scroll(pf1_tilemap, 256,(deco32_pf12_control[5]>>0)&0xff,(deco32_pf12_control[6]>>0)&0xff,deco32_pf12_control[2],deco32_pf12_control[1],deco32_pf1_rowscroll,deco32_pf1_rowscroll+0x200);
12251225   deco32_setup_scroll(pf1a_tilemap,512,(deco32_pf12_control[5]>>0)&0xff,(deco32_pf12_control[6]>>0)&0xff,deco32_pf12_control[2],deco32_pf12_control[1],deco32_pf1_rowscroll,deco32_pf1_rowscroll+0x200);
src/mame/video/vertigo.c
r3957r3958
5757
5858#define MC_LENGTH 512
5959
60#define V_ADDPOINT(h,v,c,i) \
61   vector_add_point (((h) & 0x7ff) << 14, (0x6ff - ((v) & 0x7ff)) << 14, VECTOR_COLOR444(c), (i))
60#define V_ADDPOINT(m,h,v,c,i) \
61   vector_add_point (m, ((h) & 0x7ff) << 14, (0x6ff - ((v) & 0x7ff)) << 14, VECTOR_COLOR444(c), (i))
6262
6363#define ADD(r,s,c)   (((r)  + (s) + (c)) & 0xffff)
6464#define SUBR(r,s,c) ((~(r) + (s) + (c)) & 0xffff)
r3957r3958
140140
141141typedef struct _vector_generator
142142{
143   running_machine *machine;
143144   UINT32 sreg;     /* shift register */
144145   UINT32 l1;        /* latch 1 adder operand only */
145146   UINT32 l2;        /* latch 2 adder operand only */
r3957r3958
242243   memset(&vs, 0, sizeof(vs));
243244   memset(&bsp, 0, sizeof(bsp));
244245   memset(&vgen, 0, sizeof(vgen));
246   vgen.machine = machine;
245247
246248   state_save_register_item_array(machine, "vector_proc", NULL, 0, vs.sram);
247249   state_save_register_item(machine, "vector_proc", NULL, 0, vs.ramlatch);
r3957r3958
456458   if (vg->brez ^ vg->ven)
457459   {
458460      if (vg->brez)
459      V_ADDPOINT (vg->c_h, vg->c_v, 0, 0);
461      V_ADDPOINT (vg->machine, vg->c_h, vg->c_v, 0, 0);
460462      else
461         V_ADDPOINT (vg->c_h, vg->c_v, vg->color, vg->intensity);
463         V_ADDPOINT (vg->machine, vg->c_h, vg->c_v, vg->color, vg->intensity);
462464      vg->ven = vg->brez;
463465   }
464466}
src/mame/video/midzeus.c
r3957r3958
255255      palette_set_color_rgb(machine, i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0));
256256
257257   /* initialize polygon engine */
258   poly = poly_alloc(10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
258   poly = poly_alloc(machine, 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
259259
260260   /* we need to cleanup on exit */
261261   add_exit_callback(machine, exit_handler);
src/mame/video/lkage.c
r3957r3958
128128         priority_mask = (0xf0);
129129      }
130130
131      if (flip_screen_x_get())
131      if (flip_screen_x_get(machine))
132132      {
133133         sx = 239 - sx - 24;
134134         flipx = !flipx;
135135      }
136      if( flip_screen_y_get() )
136      if( flip_screen_y_get(machine) )
137137      {
138138         sy = 254 - 16*height - sy;
139139         flipy = !flipy;
r3957r3958
165165{
166166   int bank;
167167
168   flip_screen_x_set(~lkage_vreg[2] & 0x01);
169   flip_screen_y_set(~lkage_vreg[2] & 0x02);
168   flip_screen_x_set(screen->machine, ~lkage_vreg[2] & 0x01);
169   flip_screen_y_set(screen->machine, ~lkage_vreg[2] & 0x02);
170170
171171   bank = lkage_vreg[1]&0x08;
172172   if( bg_tile_bank != bank )
src/mame/video/gaiden.c
r3957r3958
180180WRITE16_HANDLER( gaiden_flip_w )
181181{
182182   if (ACCESSING_BITS_0_7)
183      flip_screen_set(data & 1);
183      flip_screen_set(space->machine, data & 1);
184184}
185185
186186
r3957r3958
330330         if (ypos >= 256)
331331            ypos -= 512;
332332
333         if (flip_screen_get())
333         if (flip_screen_get(machine))
334334         {
335335            flipx = !flipx;
336336            flipy = !flipy;
r3957r3958
426426         if (ypos >= 256)
427427            ypos -= 512;
428428
429         if (flip_screen_get())
429         if (flip_screen_get(machine))
430430         {
431431            flipx = !flipx;
432432            flipy = !flipy;
src/mame/video/zaxxon.c
r3957r3958
189189WRITE8_HANDLER( zaxxon_flipscreen_w )
190190{
191191   /* low bit controls flip; background and sprite flip are handled at render time */
192   flip_screen_set_no_update(~data & 1);
193   tilemap_set_flip(fg_tilemap, flip_screen_get() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
192   flip_screen_set_no_update(space->machine, ~data & 1);
193   tilemap_set_flip(fg_tilemap, flip_screen_get(space->machine) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
194194}
195195
196196
r3957r3958
313313      int colorbase = bg_color + (congo_color_bank << 8);
314314      int xmask = pixmap->width - 1;
315315      int ymask = pixmap->height - 1;
316      int flipmask = flip_screen_get() ? 0xff : 0x00;
317      int flipoffs = flip_screen_get() ? 0x38 : 0x40;
316      int flipmask = flip_screen_get(machine) ? 0xff : 0x00;
317      int flipoffs = flip_screen_get(machine) ? 0x38 : 0x40;
318318      int x, y;
319319
320320      /* the starting X value is offset by 1 pixel (normal) or 7 pixels */
321321      /* (flipped) due to a delay in the loading */
322      if (!flip_screen_get())
322      if (!flip_screen_get(machine))
323323         flipoffs -= 1;
324324      else
325325         flipoffs += 7;
r3957r3958
375375 *
376376 *************************************/
377377
378INLINE int find_minimum_y(UINT8 value)
378INLINE int find_minimum_y(UINT8 value, int flip)
379379{
380   int flipmask = flip_screen_get() ? 0xff : 0x00;
381   int flipconst = flip_screen_get() ? 0xef : 0xf1;
380   int flipmask = flip ? 0xff : 0x00;
381   int flipconst = flip ? 0xef : 0xf1;
382382   int y;
383383
384384   /* the sum of the Y position plus a constant based on the flip state */
r3957r3958
406406}
407407
408408
409INLINE int find_minimum_x(UINT8 value)
409INLINE int find_minimum_x(UINT8 value, int flip)
410410{
411   int flipmask = flip_screen_get() ? 0xff : 0x00;
411   int flipmask = flip ? 0xff : 0x00;
412412   int x;
413413
414414   /* the sum of the X position plus a constant specifies the address within */
r3957r3958
422422
423423static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 flipxmask, UINT16 flipymask)
424424{
425   int flipmask = flip_screen_get() ? 0xff : 0x00;
425   int flip = flip_screen_get(machine);
426   int flipmask = flip ? 0xff : 0x00;
426427   int offs;
427428
428429   /* only the lower half of sprite RAM is read during rendering */
429430   for (offs = 0x7c; offs >= 0; offs -= 4)
430431   {
431      int sy = find_minimum_y(spriteram[offs]);
432      int sy = find_minimum_y(spriteram[offs], flip);
432433      int flipy = (spriteram[offs + (flipymask >> 8)] ^ flipmask) & flipymask;
433434      int flipx = (spriteram[offs + (flipxmask >> 8)] ^ flipmask) & flipxmask;
434435      int code = spriteram[offs + 1];
435436      int color = (spriteram[offs + 2] & 0x1f) + (congo_color_bank << 5);
436      int sx = find_minimum_x(spriteram[offs + 3]);
437      int sx = find_minimum_x(spriteram[offs + 3], flip);
437438
438439      /* draw with 256 pixel offsets to ensure we wrap properly */
439440      drawgfx(bitmap, machine->gfx[2], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 0);
src/mame/video/trackfld.c
r3957r3958
107107
108108WRITE8_HANDLER( trackfld_flipscreen_w )
109109{
110   if (flip_screen_get() != data)
110   if (flip_screen_get(space->machine) != data)
111111   {
112      flip_screen_set(data);
112      flip_screen_set(space->machine, data);
113113      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
114114   }
115115}
r3957r3958
202202      int sx = spriteram[offs] - 1;
203203      int sy = 240 - spriteram_2[offs + 1];
204204
205      if (flip_screen_get())
205      if (flip_screen_get(machine))
206206      {
207207         sy = 240 - sy;
208208         flipy = !flipy;
r3957r3958
238238   for (row = 0; row < 32; row++)
239239   {
240240      scrollx = trackfld_scroll[row] + 256 * (trackfld_scroll2[row] & 0x01);
241      if (flip_screen_get()) scrollx = -scrollx;
241      if (flip_screen_get(screen->machine)) scrollx = -scrollx;
242242      tilemap_set_scrollx(bg_tilemap, row, scrollx);
243243   }
244244
src/mame/video/fastfred.c
r3957r3958
219219
220220WRITE8_HANDLER( fastfred_flip_screen_x_w )
221221{
222   if (flip_screen_x_get() != (data & 0x01))
222   if (flip_screen_x_get(space->machine) != (data & 0x01))
223223   {
224      flip_screen_x_set(data & 0x01);
224      flip_screen_x_set(space->machine, data & 0x01);
225225
226      tilemap_set_flip(bg_tilemap, (flip_screen_x_get() ? TILEMAP_FLIPX : 0) | (flip_screen_y_get() ? TILEMAP_FLIPY : 0));
226      tilemap_set_flip(bg_tilemap, (flip_screen_x_get(space->machine) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(space->machine) ? TILEMAP_FLIPY : 0));
227227   }
228228}
229229
230230WRITE8_HANDLER( fastfred_flip_screen_y_w )
231231{
232   if (flip_screen_y_get() != (data & 0x01))
232   if (flip_screen_y_get(space->machine) != (data & 0x01))
233233   {
234      flip_screen_y_set(data & 0x01);
234      flip_screen_y_set(space->machine, data & 0x01);
235235
236      tilemap_set_flip(bg_tilemap, (flip_screen_x_get() ? TILEMAP_FLIPX : 0) | (flip_screen_y_get() ? TILEMAP_FLIPY : 0));
236      tilemap_set_flip(bg_tilemap, (flip_screen_x_get(space->machine) ? TILEMAP_FLIPX : 0) | (flip_screen_y_get(space->machine) ? TILEMAP_FLIPY : 0));
237237   }
238238}
239239
r3957r3958
287287      }
288288
289289
290      if (flip_screen_x_get())
290      if (flip_screen_x_get(machine))
291291      {
292292         sx = 240 - sx;
293293         flipx = !flipx;
294294      }
295      if (flip_screen_y_get())
295      if (flip_screen_y_get(machine))
296296      {
297297         sy = 240 - sy;
298298         flipy = !flipy;
r3957r3958
303303            colorbank | (fastfred_spriteram[offs + 2] & 0x07),
304304            flipx,flipy,
305305            sx,sy,
306            flip_screen_x_get() ? &spritevisibleareaflipx : &spritevisiblearea,TRANSPARENCY_PEN,0);
306            flip_screen_x_get(machine) ? &spritevisibleareaflipx : &spritevisiblearea,TRANSPARENCY_PEN,0);
307307   }
308308}
309309
src/mame/video/lwings.c
r3957r3958
203203         flipx = buffered_spriteram[offs + 1] & 0x02;
204204         flipy = buffered_spriteram[offs + 1] & 0x04;
205205
206         if (flip_screen_get())
206         if (flip_screen_get(machine))
207207         {
208208            sx = 240 - sx;
209209            sy = 240 - sy;
r3957r3958
252252            flipy = 1;
253253         }
254254
255         if (flip_screen_get())
255         if (flip_screen_get(machine))
256256         {
257257            sx = 240 - sx;
258258            sy = 240 - sy;
src/mame/video/tecmo.c
r3957r3958
151151
152152WRITE8_HANDLER( tecmo_flipscreen_w )
153153{
154   flip_screen_set(data & 1);
154   flip_screen_set(space->machine, data & 1);
155155}
156156
157157
r3957r3958
201201         flipx = bank & 1;
202202         flipy = bank & 2;
203203
204         if (flip_screen_get())
204         if (flip_screen_get(machine))
205205         {
206206            xpos = 256 - (8 * size) - xpos;
207207            ypos = 256 - (8 * size) - ypos;
src/mame/video/finalizr.c
r3957r3958
1414UINT8 *finalizr_videoram2,*finalizr_colorram2;
1515static int spriterambank,charbank;
1616
17static tilemap *bg_tilemap;
18static tilemap *fg_tilemap;
1719
1820
21
1922PALETTE_INIT( finalizr )
2023{
2124   int i;
r3957r3958
4952   }
5053}
5154
55static TILE_GET_INFO( get_bg_tile_info )
56{
57   int attr = colorram[tile_index];
58   int code = videoram[tile_index] + ((attr & 0xc0) << 2) + (charbank<<10);
59   int color = attr & 0x0f;
60   int flags = TILE_FLIPYX((attr & 0x30) >> 4);
61
62   SET_TILE_INFO(0, code, color, flags);
63}
64
65static TILE_GET_INFO( get_fg_tile_info )
66{
67   int attr = finalizr_colorram2[tile_index];
68   int code = finalizr_videoram2[tile_index] + ((attr & 0xc0) << 2);
69   int color = attr & 0x0f;
70   int flags = TILE_FLIPYX((attr & 0x30) >> 4);
71
72   SET_TILE_INFO(0, code, color, flags);
73}
74
5275VIDEO_START( finalizr )
5376{
54   tmpbitmap = auto_bitmap_alloc(256,256,video_screen_get_format(machine->primary_screen));
77   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,  8, 8, 32, 32);
78   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,  8, 8, 32, 32);
5579}
5680
5781
r3957r3958
7195{
7296   int offs;
7397
98   tilemap_mark_all_tiles_dirty(bg_tilemap);
99   tilemap_mark_all_tiles_dirty(fg_tilemap);
74100
75   /* for every character in the Video RAM */
76   for (offs = videoram_size - 1;offs >= 0;offs--)
77   {
78      int sx,sy;
101   tilemap_set_scrollx(bg_tilemap, 0, *finalizr_scroll-16);
102   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
79103
80
81      sx = offs % 32;
82      sy = offs / 32;
83
84      drawgfx(tmpbitmap,screen->machine->gfx[0],
85            videoram[offs] + ((colorram[offs] & 0xc0) << 2) + (charbank<<10),
86            (colorram[offs] & 0x0f),
87            colorram[offs] & 0x10,colorram[offs] & 0x20,
88            8*sx,8*sy,
89            0,TRANSPARENCY_NONE,0);
90   }
91
92
93   /* copy the temporary bitmap to the screen */
94   {
95      int scroll;
96
97
98      scroll = -*finalizr_scroll + 16;
99
100      copyscrollbitmap(bitmap,tmpbitmap,1,&scroll,0,0,cliprect);
101   }
102
103
104104   /* Draw the sprites. */
105105   {
106      UINT8 *sr;
106      const gfx_element *gfx1 = screen->machine->gfx[1];
107      const gfx_element *gfx2 = screen->machine->gfx[2];
107108
109      UINT8 *sr = spriterambank ? spriteram_2 : spriteram;
108110
109      if (spriterambank != 0)
110         sr = spriteram_2;
111      else sr = spriteram;
112111
113      for (offs = 0;offs < spriteram_size;offs += 5)
112      for (offs = 0;offs <= spriteram_size-5;offs += 5)
114113      {
115         int sx,sy,flipx,flipy,code,color;
114         int sx,sy,flipx,flipy,code,color,size;
116115
117116
118117         sx = 16 + sr[offs+3] - ((sr[offs+4] & 0x01) << 8);
r3957r3958
124123
125124//          (sr[offs+4] & 0x02) is used, meaning unknown
126125
127         switch (sr[offs+4] & 0x1c)
126         size = sr[offs+4] & 0x1c;
127
128         if (size >= 0x10)   /* 32x32 */
128129         {
129            case 0x10:   /* 32x32? */
130            case 0x14:   /* ? */
131            case 0x18:   /* ? */
132            case 0x1c:   /* ? */
133               drawgfx(bitmap,screen->machine->gfx[1],
134                     code,
135                     color,
136                     flipx,flipy,
137                     flipx?sx+16:sx,flipy?sy+16:sy,
138                     cliprect,TRANSPARENCY_PEN,0);
139               drawgfx(bitmap,screen->machine->gfx[1],
140                     code + 1,
141                     color,
142                     flipx,flipy,
143                     flipx?sx:sx+16,flipy?sy+16:sy,
144                     cliprect,TRANSPARENCY_PEN,0);
145               drawgfx(bitmap,screen->machine->gfx[1],
146                     code + 2,
147                     color,
148                     flipx,flipy,
149                     flipx?sx+16:sx,flipy?sy:sy+16,
150                     cliprect,TRANSPARENCY_PEN,0);
151               drawgfx(bitmap,screen->machine->gfx[1],
152                     code + 3,
153                     color,
154                     flipx,flipy,
155                     flipx?sx:sx+16,flipy?sy:sy+16,
156                     cliprect,TRANSPARENCY_PEN,0);
157               break;
130            if (flip_screen_get(screen->machine))
131            {
132               sx = 256 - sx;
133               sy = 224 - sy;
134               flipx = !flipx;
135               flipy = !flipy;
136            }
158137
159            case 0x00:   /* 16x16 */
160               drawgfx(bitmap,screen->machine->gfx[1],
138            drawgfx(bitmap,gfx1,
139                  code,
140                  color,
141                  flipx,flipy,
142                  flipx?sx+16:sx,flipy?sy+16:sy,
143                  cliprect,TRANSPARENCY_PEN,0);
144            drawgfx(bitmap,gfx1,
145                  code + 1,
146                  color,
147                  flipx,flipy,
148                  flipx?sx:sx+16,flipy?sy+16:sy,
149                  cliprect,TRANSPARENCY_PEN,0);
150            drawgfx(bitmap,gfx1,
151                  code + 2,
152                  color,
153                  flipx,flipy,
154                  flipx?sx+16:sx,flipy?sy:sy+16,
155                  cliprect,TRANSPARENCY_PEN,0);
156            drawgfx(bitmap,gfx1,
157                  code + 3,
158                  color,
159                  flipx,flipy,
160                  flipx?sx:sx+16,flipy?sy:sy+16,
161                  cliprect,TRANSPARENCY_PEN,0);
162         }
163         else
164         {
165            if (flip_screen_get(screen->machine))
166            {
167               sx = ((size & 0x08) ? 280:272) - sx;
168               sy = ((size & 0x04) ? 248:240) - sy;
169               flipx = !flipx;
170               flipy = !flipy;
171            }
172
173            if (size == 0x00)   /* 16x16 */
174            {
175               drawgfx(bitmap,gfx1,
161176                     code,
162177                     color,
163178                     flipx,flipy,
164179                     sx,sy,
165180                     cliprect,TRANSPARENCY_PEN,0);
166               break;
167
168            case 0x04:   /* 16x8 */
181            }
182            else
183            {
169184               code = ((code & 0x3ff) << 2) | ((code & 0xc00) >> 10);
170               drawgfx(bitmap,screen->machine->gfx[2],
171                     code & ~1,
172                     color,
173                     flipx,flipy,
174                     flipx?sx+8:sx,sy,
175                     cliprect,TRANSPARENCY_PEN,0);
176               drawgfx(bitmap,screen->machine->gfx[2],
177                     code | 1,
178                     color,
179                     flipx,flipy,
180                     flipx?sx:sx+8,sy,
181                     cliprect,TRANSPARENCY_PEN,0);
182               break;
183185
184            case 0x08:   /* 8x16 */
185               code = ((code & 0x3ff) << 2) | ((code & 0xc00) >> 10);
186               drawgfx(bitmap,screen->machine->gfx[2],
187                     code & ~2,
188                     color,
189                     flipx,flipy,
190                     sx,flipy?sy+8:sy,
191                     cliprect,TRANSPARENCY_PEN,0);
192               drawgfx(bitmap,screen->machine->gfx[2],
193                     code | 2,
194                     color,
195                     flipx,flipy,
196                     sx,flipy?sy:sy+8,
197                     cliprect,TRANSPARENCY_PEN,0);
198               break;
199
200            case 0x0c:   /* 8x8 */
201               code = ((code & 0x3ff) << 2) | ((code & 0xc00) >> 10);
202               drawgfx(bitmap,screen->machine->gfx[2],
203                     code,
204                     color,
205                     flipx,flipy,
206                     sx,sy,
207                     cliprect,TRANSPARENCY_PEN,0);
208               break;
186               if (size == 0x04)   /* 16x8 */
187               {
188                  drawgfx(bitmap,gfx2,
189                        code & ~1,
190                        color,
191                        flipx,flipy,
192                        flipx?sx+8:sx,sy,
193                        cliprect,TRANSPARENCY_PEN,0);
194                  drawgfx(bitmap,gfx2,
195                        code | 1,
196                        color,
197                        flipx,flipy,
198                        flipx?sx:sx+8,sy,
199                        cliprect,TRANSPARENCY_PEN,0);
200               }
201               else if (size == 0x08)   /* 8x16 */
202               {
203                  drawgfx(bitmap,gfx2,
204                        code & ~2,
205                        color,
206                        flipx,flipy,
207                        sx,flipy?sy+8:sy,
208                        cliprect,TRANSPARENCY_PEN,0);
209                  drawgfx(bitmap,gfx2,
210                        code | 2,
211                        color,
212                        flipx,flipy,
213                        sx,flipy?sy:sy+8,
214                        cliprect,TRANSPARENCY_PEN,0);
215               }
216               else if (size == 0x0c)   /* 8x8 */
217               {
218                  drawgfx(bitmap,gfx2,
219                        code,
220                        color,
221                        flipx,flipy,
222                        sx,sy,
223                        cliprect,TRANSPARENCY_PEN,0);
224               }
225            }
209226         }
210227      }
211228   }
212229
213   for (offs = videoram_size - 1;offs >= 0;offs--)
214230   {
215      int sx,sy;
231      const rectangle *visarea = video_screen_get_visible_area(screen);
232      rectangle clip = *cliprect;
216233
234      /* draw top status region */
235      clip.min_x = visarea->min_x;
236      clip.max_x = visarea->min_x + 15;
237      tilemap_set_scrolldx(fg_tilemap,  0,-16);
238      tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
217239
218      sx = offs % 32;
219      if (sx < 6)
220      {
221         if (sx >= 3) sx += 30;
222         sy = offs / 32;
223
224         drawgfx(bitmap,screen->machine->gfx[0],
225               finalizr_videoram2[offs] + ((finalizr_colorram2[offs] & 0xc0) << 2),
226               (finalizr_colorram2[offs] & 0x0f),
227               finalizr_colorram2[offs] & 0x10,finalizr_colorram2[offs] & 0x20,
228               8*sx,8*sy,
229               cliprect,TRANSPARENCY_NONE,0);
230      }
240      /* draw bottom status region */
241      clip.min_x = visarea->max_x - 15;
242      clip.max_x = visarea->max_x;
243      tilemap_set_scrolldx(fg_tilemap,-16,  0);
244      tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
231245   }
232246   return 0;
233247}
src/mame/video/hexa.c
r3957r3958
2323   int bankaddress;
2424
2525   /* bit 0 = flipx (or y?) */
26   if (flip_screen_x_get() != (data & 0x01))
26   if (flip_screen_x_get(space->machine) != (data & 0x01))
2727   {
28      flip_screen_x_set(data & 0x01);
28      flip_screen_x_set(space->machine, data & 0x01);
2929      tilemap_mark_all_tiles_dirty(bg_tilemap);
3030   }
3131
3232   /* bit 1 = flipy (or x?) */
33   if (flip_screen_y_get() != (data & 0x02))
33   if (flip_screen_y_get(space->machine) != (data & 0x02))
3434   {
35      flip_screen_y_set(data & 0x02);
35      flip_screen_y_set(space->machine, data & 0x02);
3636      tilemap_mark_all_tiles_dirty(bg_tilemap);
3737   }
3838
src/mame/video/cloak.c
r3957r3958
155155
156156WRITE8_HANDLER( cloak_flipscreen_w )
157157{
158   flip_screen_set(data & 0x80);
158   flip_screen_set(space->machine, data & 0x80);
159159}
160160
161161static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
215215      int sx = spriteram[offs + 192];
216216      int sy = 240 - spriteram[offs];
217217
218      if (flip_screen_get())
218      if (flip_screen_get(machine))
219219      {
220220         sx -= 9;
221221         sy = 240 - sy;
src/mame/video/gticlub.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "cpu/sharc/sharc.h"
43#include "machine/konppc.h"
54#include "video/poly.h"
r3957r3958
222221
223222   K001005_3d_fifo = auto_malloc(0x10000 * sizeof(UINT32));
224223
225   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
224   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
226225   add_exit_callback(machine, K001005_exit);
227226
228227   for (i=0; i < 128; i++)
r3957r3958
482481   }
483482}
484483
484static UINT8 *gfxrom;
485
485486static void draw_scanline_tex(void *dest, INT32 scanline, const poly_extent *extent, const void *extradata, int threadid)
486487{
487488   const poly_extra_data *extra = extradata;
488489   bitmap_t *destmap = dest;
489   UINT8 *texrom = memory_region(Machine, "gfx1") + (extra->texture_page * 0x40000);
490   UINT8 *texrom = gfxrom + (extra->texture_page * 0x40000);
490491   int pal_chip = (extra->texture_palette & 0x8) ? 1 : 0;
491492   int palette_index = (extra->texture_palette & 0x7) * 256;
492493   float z = extent->param[0].start;
r3957r3958
978979   tick = 0;
979980   debug_tex_page = 0;
980981   debug_tex_palette = 0;
982   gfxrom = memory_region(machine, "gfx1");
981983
982984   K001006_init(machine);
983985   K001005_init(machine);
src/mame/video/armedf.c
r3957r3958
242242      int sx = buffered_spriteram16[offs+3];
243243      int sy = sprite_offy+240-(buffered_spriteram16[offs+0]&0x1ff);
244244
245      if (flip_screen_get()) {
245      if (flip_screen_get(machine)) {
246246         sx = 320 - sx + 176;   /* don't ask where 176 comes from, just tried it out */
247247         sy = 240 - sy + 1;      /* don't ask where 1 comes from, just tried it out */
248248         flipx = !flipx;         /* the values seem to result in pixel-correct placement */
src/mame/video/appoooh.c
r3957r3958
183183   interrupt_enable_w(space,0,data & 0x01);
184184
185185   /* bit 1 flip screen */
186   flip_screen_set(data & 0x02);
186   flip_screen_set(space->machine, data & 0x02);
187187
188188   /* bits 2-3 unknown */
189189
r3957r3958
203203   /* bit 7 unknown (used) */
204204}
205205
206static void appoooh_draw_sprites(bitmap_t *dest_bmp,
206static void appoooh_draw_sprites(running_machine *machine,
207      bitmap_t *dest_bmp,
207208      const rectangle *cliprect,
208209        const gfx_element *gfx,
209210        UINT8 *sprite)
r3957r3958
220221
221222      if(sx>=248) sx -= 256;
222223
223      if (flip_screen_get())
224      if (flip_screen_get(machine))
224225      {
225226         sx = 239 - sx;
226227         sy = 239 - sy;
r3957r3958
229230      drawgfx( dest_bmp, gfx,
230231            code,
231232            color,
232            flipx,flip_screen_get(),
233            flipx,flip_screen_get(machine),
233234            sx, sy,
234235            cliprect,
235236            TRANSPARENCY_PEN , 0);
236237    }
237238}
238239
239static void robowres_draw_sprites(bitmap_t *dest_bmp,
240static void robowres_draw_sprites(running_machine *machine,
241      bitmap_t *dest_bmp,
240242      const rectangle *cliprect,
241243        const gfx_element *gfx,
242244        UINT8 *sprite)
r3957r3958
253255
254256      if(sx>=248) sx -= 256;
255257
256      if (flip_screen_get())
258      if (flip_screen_get(machine))
257259      {
258260         sx = 239 - sx;
259261         sy = 239 - sy;
r3957r3958
262264      drawgfx( dest_bmp, gfx,
263265            code,
264266            color,
265            flipx,flip_screen_get(),
267            flipx,flip_screen_get(machine),
266268            sx, sy,
267269            cliprect,
268270            TRANSPARENCY_PEN , 0);
r3957r3958
281283   if (priority == 1)
282284   {
283285      /* sprite set #1 */
284      appoooh_draw_sprites( bitmap, cliprect, screen->machine->gfx[2],spriteram);
286      appoooh_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[2],spriteram);
285287      /* sprite set #2 */
286      appoooh_draw_sprites( bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
288      appoooh_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
287289   }
288290   else
289291   {
290292      /* sprite set #2 */
291      appoooh_draw_sprites( bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
293      appoooh_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
292294      /* sprite set #1 */
293      appoooh_draw_sprites( bitmap, cliprect, screen->machine->gfx[2],spriteram);
295      appoooh_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[2],spriteram);
294296   }
295297
296298   if (priority != 0)   /* fg in front of sprites */
r3957r3958
309311   if (priority == 1)
310312   {
311313      /* sprite set #1 */
312      robowres_draw_sprites( bitmap, cliprect, screen->machine->gfx[2],spriteram);
314      robowres_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[2],spriteram);
313315      /* sprite set #2 */
314      robowres_draw_sprites( bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
316      robowres_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
315317   }
316318   else
317319   {
318320      /* sprite set #2 */
319      robowres_draw_sprites( bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
321      robowres_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[3],spriteram_2);
320322      /* sprite set #1 */
321      robowres_draw_sprites( bitmap, cliprect, screen->machine->gfx[2],spriteram);
323      robowres_draw_sprites( screen->machine, bitmap, cliprect, screen->machine->gfx[2],spriteram);
322324   }
323325
324326   if (priority != 0)   /* fg in front of sprites */
src/mame/video/travrusa.c
r3957r3958
276276   /* screen flip is handled both by software and hardware */
277277   data ^= ~input_port_read(space->machine, "DSW2") & 1;
278278
279   flip_screen_set(data & 1);
279   flip_screen_set(space->machine, data & 1);
280280
281281   coin_counter_w(0,data & 0x02);
282282   coin_counter_w(1,data & 0x20);
r3957r3958
304304      8*8, 32*8-1
305305   };
306306   rectangle clip = *cliprect;
307   if (flip_screen_get())
307   if (flip_screen_get(machine))
308308      sect_rect(&clip, &spritevisibleareaflip);
309309   else
310310      sect_rect(&clip, &spritevisiblearea);
r3957r3958
319319      int flipx = attr & 0x40;
320320      int flipy = attr & 0x80;
321321
322      if (flip_screen_get())
322      if (flip_screen_get(machine))
323323      {
324324         sx = 240 - sx;
325325         sy = 240 - sy;
src/mame/video/psx.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "deprecat.h"
2221#include "includes/psx.h"
2322
2423#define STOP_ON_ERROR ( 0 )
r3957r3958
946945    |iy|ix|ty|     |   tp|  abr|ty|         tx
947946*/
948947
949INLINE void decode_tpage( struct PSXGPU *p_psxgpu, UINT32 tpage )
948INLINE void decode_tpage( running_machine *machine, struct PSXGPU *p_psxgpu, UINT32 tpage )
950949{
951   running_machine *machine = Machine;
952
953950   if( m_n_gputype == 2 )
954951   {
955952      m_n_gpustatus = ( m_n_gpustatus & 0xfffff800 ) | ( tpage & 0x7ff );
r3957r3958
14511448      } \
14521449   }
14531450
1454static void FlatPolygon( int n_points )
1451static void FlatPolygon( running_machine *machine, int n_points )
14551452{
1456   running_machine *machine = Machine;
14571453   INT16 n_y;
14581454   INT16 n_x;
14591455
r3957r3958
16071603   }
16081604}
16091605
1610static void FlatTexturedPolygon( int n_points )
1606static void FlatTexturedPolygon( running_machine *machine, int n_points )
16111607{
1612   running_machine *machine = Machine;
16131608   INT16 n_y;
16141609   INT16 n_x;
16151610   int n_tx;
r3957r3958
16861681   n_cu2.d = 0;
16871682   n_cv2.d = 0;
16881683
1689   decode_tpage( &psxgpu, m_packet.FlatTexturedPolygon.vertex[ 1 ].n_texture.w.h );
1684   decode_tpage( machine, &psxgpu, m_packet.FlatTexturedPolygon.vertex[ 1 ].n_texture.w.h );
16901685   TEXTURESETUP
16911686
16921687   switch( n_cmd & 0x01 )
r3957r3958
18301825   }
18311826}
18321827
1833static void GouraudPolygon( int n_points )
1828static void GouraudPolygon( running_machine *machine, int n_points )
18341829{
1835   running_machine *machine = Machine;
18361830   INT16 n_y;
18371831   INT16 n_x;
18381832
r3957r3958
20442038   }
20452039}
20462040
2047static void GouraudTexturedPolygon( int n_points )
2041static void GouraudTexturedPolygon( running_machine *machine, int n_points )
20482042{
2049   running_machine *machine = Machine;
20502043   INT16 n_y;
20512044   INT16 n_x;
20522045   int n_tx;
r3957r3958
21412134   n_cu2.d = 0;
21422135   n_cv2.d = 0;
21432136
2144   decode_tpage( &psxgpu, m_packet.GouraudTexturedPolygon.vertex[ 1 ].n_texture.w.h );
2137   decode_tpage( machine, &psxgpu, m_packet.GouraudTexturedPolygon.vertex[ 1 ].n_texture.w.h );
21452138   TEXTURESETUP
21462139
21472140   if( n_points == 4 )
r3957r3958
26152608   }
26162609}
26172610
2618static void FlatRectangle( void )
2611static void FlatRectangle( running_machine *machine )
26192612{
2620   running_machine *machine = Machine;
26212613   INT16 n_y;
26222614   INT16 n_x;
26232615
r3957r3958
26812673   }
26822674}
26832675
2684static void FlatRectangle8x8( void )
2676static void FlatRectangle8x8( running_machine *machine )
26852677{
2686   running_machine *machine = Machine;
26872678   INT16 n_y;
26882679   INT16 n_x;
26892680
r3957r3958
27472738   }
27482739}
27492740
2750static void FlatRectangle16x16( void )
2741static void FlatRectangle16x16( running_machine *machine )
27512742{
2752   running_machine *machine = Machine;
27532743   INT16 n_y;
27542744   INT16 n_x;
27552745
r3957r3958
28132803   }
28142804}
28152805
2816static void FlatTexturedRectangle( void )
2806static void FlatTexturedRectangle( running_machine *machine )
28172807{
2818   running_machine *machine = Machine;
28192808   INT16 n_y;
28202809   INT16 n_x;
28212810   int n_tx;
r3957r3958
29122901   }
29132902}
29142903
2915static void Sprite8x8( void )
2904static void Sprite8x8( running_machine *machine )
29162905{
2917   running_machine *machine = Machine;
29182906   INT16 n_y;
29192907   INT16 n_x;
29202908   int n_tx;
r3957r3958
30112999   }
30123000}
30133001
3014static void Sprite16x16( void )
3002static void Sprite16x16( running_machine *machine )
30153003{
3016   running_machine *machine = Machine;
30173004   INT16 n_y;
30183005   INT16 n_x;
30193006   int n_tx;
r3957r3958
31923179   }
31933180}
31943181
3195void psx_gpu_write( UINT32 *p_ram, INT32 n_size )
3182void psx_gpu_write( running_machine *machine, UINT32 *p_ram, INT32 n_size )
31963183{
3197   running_machine *machine = Machine;
3198
31993184   while( n_size > 0 )
32003185   {
32013186      UINT32 data = *( p_ram );
r3957r3958
32343219         else
32353220         {
32363221            verboselog( machine, 1, "%02x: monochrome 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3237            FlatPolygon( 3 );
3222            FlatPolygon( machine, 3 );
32383223            m_n_gpu_buffer_offset = 0;
32393224         }
32403225         break;
r3957r3958
32493234         else
32503235         {
32513236            verboselog( machine, 1, "%02x: textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3252            FlatTexturedPolygon( 3 );
3237            FlatTexturedPolygon( machine, 3 );
32533238            m_n_gpu_buffer_offset = 0;
32543239         }
32553240         break;
r3957r3958
32643249         else
32653250         {
32663251            verboselog( machine, 1, "%02x: monochrome 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3267            FlatPolygon( 4 );
3252            FlatPolygon( machine, 4 );
32683253            m_n_gpu_buffer_offset = 0;
32693254         }
32703255         break;
r3957r3958
32793264         else
32803265         {
32813266            verboselog( machine, 1, "%02x: textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3282            FlatTexturedPolygon( 4 );
3267            FlatTexturedPolygon( machine, 4 );
32833268            m_n_gpu_buffer_offset = 0;
32843269         }
32853270         break;
r3957r3958
32943279         else
32953280         {
32963281            verboselog( machine, 1, "%02x: gouraud 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3297            GouraudPolygon( 3 );
3282            GouraudPolygon( machine, 3 );
32983283            m_n_gpu_buffer_offset = 0;
32993284         }
33003285         break;
r3957r3958
33093294         else
33103295         {
33113296            verboselog( machine, 1, "%02x: gouraud textured 3 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3312            GouraudTexturedPolygon( 3 );
3297            GouraudTexturedPolygon( machine, 3 );
33133298            m_n_gpu_buffer_offset = 0;
33143299         }
33153300         break;
r3957r3958
33243309         else
33253310         {
33263311            verboselog( machine, 1, "%02x: gouraud 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3327            GouraudPolygon( 4 );
3312            GouraudPolygon( machine, 4 );
33283313            m_n_gpu_buffer_offset = 0;
33293314         }
33303315         break;
r3957r3958
33393324         else
33403325         {
33413326            verboselog( machine, 1, "%02x: gouraud textured 4 point polygon\n", m_packet.n_entry[ 0 ] >> 24 );
3342            GouraudTexturedPolygon( 4 );
3327            GouraudTexturedPolygon( machine, 4 );
33433328            m_n_gpu_buffer_offset = 0;
33443329         }
33453330         break;
r3957r3958
34333418               m_packet.n_entry[ 0 ] >> 24,
34343419               (INT16)( m_packet.n_entry[ 1 ] & 0xffff ), (INT16)( m_packet.n_entry[ 1 ] >> 16 ),
34353420               (INT16)( m_packet.n_entry[ 2 ] & 0xffff ), (INT16)( m_packet.n_entry[ 2 ] >> 16 ) );
3436            FlatRectangle();
3421            FlatRectangle(machine);
34373422            m_n_gpu_buffer_offset = 0;
34383423         }
34393424         break;
r3957r3958
34523437               (INT16)( m_packet.n_entry[ 1 ] & 0xffff ), (INT16)( m_packet.n_entry[ 1 ] >> 16 ),
34533438               m_packet.n_entry[ 3 ] & 0xffff, m_packet.n_entry[ 3 ] >> 16,
34543439               m_packet.n_entry[ 0 ], m_packet.n_entry[ 2 ] );
3455            FlatTexturedRectangle();
3440            FlatTexturedRectangle(machine);
34563441            m_n_gpu_buffer_offset = 0;
34573442         }
34583443         break;
r3957r3958
34833468         {
34843469            verboselog( machine, 1, "%02x: 16x16 rectangle %08x %08x\n", m_packet.n_entry[ 0 ] >> 24,
34853470               m_packet.n_entry[ 0 ], m_packet.n_entry[ 1 ] );
3486            FlatRectangle8x8();
3471            FlatRectangle8x8(machine);
34873472            m_n_gpu_buffer_offset = 0;
34883473         }
34893474         break;
r3957r3958
34993484         {
35003485            verboselog( machine, 1, "%02x: 8x8 sprite %08x %08x %08x\n", m_packet.n_entry[ 0 ] >> 24,
35013486               m_packet.n_entry[ 0 ], m_packet.n_entry[ 1 ], m_packet.n_entry[ 2 ] );
3502            Sprite8x8();
3487            Sprite8x8(machine);
35033488            m_n_gpu_buffer_offset = 0;
35043489         }
35053490         break;
r3957r3958
35143499         {
35153500            verboselog( machine, 1, "%02x: 16x16 rectangle %08x %08x\n", m_packet.n_entry[ 0 ] >> 24,
35163501               m_packet.n_entry[ 0 ], m_packet.n_entry[ 1 ] );
3517            FlatRectangle16x16();
3502            FlatRectangle16x16(machine);
35183503            m_n_gpu_buffer_offset = 0;
35193504         }
35203505         break;
r3957r3958
35303515         {
35313516            verboselog( machine, 1, "%02x: 16x16 sprite %08x %08x %08x\n", m_packet.n_entry[ 0 ] >> 24,
35323517               m_packet.n_entry[ 0 ], m_packet.n_entry[ 1 ], m_packet.n_entry[ 2 ] );
3533            Sprite16x16();
3518            Sprite16x16(machine);
35343519            m_n_gpu_buffer_offset = 0;
35353520         }
35363521         break;
r3957r3958
35993584      case 0xe1:
36003585         verboselog( machine, 1, "%02x: draw mode %06x\n", m_packet.n_entry[ 0 ] >> 24,
36013586            m_packet.n_entry[ 0 ] & 0xffffff );
3602         decode_tpage( &psxgpu, m_packet.n_entry[ 0 ] & 0xffffff );
3587         decode_tpage( machine, &psxgpu, m_packet.n_entry[ 0 ] & 0xffffff );
36033588         break;
36043589      case 0xe2:
36053590         m_n_twy = ( ( ( m_packet.n_entry[ 0 ] >> 15 ) & 0x1f ) << 3 );
r3957r3958
36823667   switch( offset )
36833668   {
36843669   case 0x00:
3685      psx_gpu_write( &data, 1 );
3670      psx_gpu_write( machine, &data, 1 );
36863671      break;
36873672   case 0x01:
36883673      switch( data >> 24 )
r3957r3958
38413826}
38423827
38433828
3844void psx_gpu_read( UINT32 *p_ram, INT32 n_size )
3829void psx_gpu_read( running_machine *machine, UINT32 *p_ram, INT32 n_size )
38453830{
3846   running_machine *machine = Machine;
3847
38483831   while( n_size > 0 )
38493832   {
38503833      if( ( m_n_gpustatus & ( 1L << 0x1b ) ) != 0 )
r3957r3958
38983881   switch( offset )
38993882   {
39003883   case 0x00:
3901      psx_gpu_read( &data, 1 );
3884      psx_gpu_read( space->machine, &data, 1 );
39023885      break;
39033886   case 0x01:
39043887      verboselog( space->machine, 1, "read GPU status (%08x)\n", m_n_gpustatus );
src/mame/video/metlclsh.c
r3957r3958
194194      if (sx < -7) sx += 256;
195195      sy   =   240 - spriteram[offs+2];
196196
197      if (flip_screen_get())
197      if (flip_screen_get(machine))
198198      {
199199         sx = 240 - sx;   flipx = !flipx;
200200         sy = 240 - sy;   flipy = !flipy;      if (sizey)   sy+=16;
r3957r3958
243243   if (metlclsh_scrollx[0] & 0x08)               // background (if enabled)
244244   {
245245      /* The background seems to be always flipped along x */
246      tilemap_set_flip(bg_tilemap, (flip_screen_get() ? (TILEMAP_FLIPX|TILEMAP_FLIPY) : 0) ^ TILEMAP_FLIPX);
246      tilemap_set_flip(bg_tilemap, (flip_screen_get(screen->machine) ? (TILEMAP_FLIPX|TILEMAP_FLIPY) : 0) ^ TILEMAP_FLIPX);
247247      tilemap_set_scrollx(bg_tilemap, 0,metlclsh_scrollx[1] + ((metlclsh_scrollx[0]&0x02)<<7) );
248248      tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
249249   }
src/mame/video/goldstar.c
r3957r3958
1414size_t goldstar_video_size;
1515UINT8 *goldstar_reel1_scroll, *goldstar_reel2_scroll, *goldstar_reel3_scroll;
1616
17static bitmap_t *tmpbitmap4;
1817static int bgcolor;
1918
2019
r3957r3958
2423  Start the video hardware emulation.
2524
2625***************************************************************************/
27static tilemap *reel1_tilemap;
26
27static tilemap *goldstar_fg_tilemap;
28
29
30WRITE8_HANDLER( goldstar_fg_vidram_w )
31{
32   videoram[offset] = data;
33   tilemap_mark_tile_dirty(goldstar_fg_tilemap,offset);
34}
35
36WRITE8_HANDLER( goldstar_fg_atrram_w )
37{
38   colorram[offset] = data;
39   tilemap_mark_tile_dirty(goldstar_fg_tilemap,offset);
40}
41
42static TILE_GET_INFO( get_goldstar_fg_tile_info )
43{
44   int code = videoram[tile_index];
45   int attr = colorram[tile_index];
46
47   SET_TILE_INFO(
48         0,
49         code | (attr & 0xf0)<<4,
50         attr&0x0f,
51         0);
52}
53
54// colour / high tile bits are swapped around
55static TILE_GET_INFO( get_cherrym_fg_tile_info )
56{
57   int code = videoram[tile_index];
58   int attr = colorram[tile_index];
59
60   SET_TILE_INFO(
61         0,
62         code | (attr & 0x0f)<<8,
63         (attr&0xf0)>>4,
64         0);
65}
66
67
68
69static tilemap *goldstar_reel1_tilemap;
2870UINT8 *goldstar_reel1_ram;
2971
3072WRITE8_HANDLER( goldstar_reel1_ram_w )
3173{
3274   goldstar_reel1_ram[offset] = data;
33   tilemap_mark_tile_dirty(reel1_tilemap,offset);
75   tilemap_mark_tile_dirty(goldstar_reel1_tilemap,offset);
3476}
3577
36static TILE_GET_INFO( get_reel1_tile_info )
78static TILE_GET_INFO( get_goldstar_reel1_tile_info )
3779{
3880   int code = goldstar_reel1_ram[tile_index];
3981
r3957r3958
4587}
4688
4789
48static tilemap *reel2_tilemap;
90static tilemap *goldstar_reel2_tilemap;
4991UINT8 *goldstar_reel2_ram;
5092
5193WRITE8_HANDLER( goldstar_reel2_ram_w )
5294{
5395   goldstar_reel2_ram[offset] = data;
54   tilemap_mark_tile_dirty(reel2_tilemap,offset);
96   tilemap_mark_tile_dirty(goldstar_reel2_tilemap,offset);
5597}
5698
57static TILE_GET_INFO( get_reel2_tile_info )
99static TILE_GET_INFO( get_goldstar_reel2_tile_info )
58100{
59101   int code = goldstar_reel2_ram[tile_index];
60102
r3957r3958
65107         0);
66108}
67109
68static tilemap *reel3_tilemap;
110static tilemap *goldstar_reel3_tilemap;
69111UINT8 *goldstar_reel3_ram;
70112
71113WRITE8_HANDLER( goldstar_reel3_ram_w )
72114{
73115   goldstar_reel3_ram[offset] = data;
74   tilemap_mark_tile_dirty(reel3_tilemap,offset);
116   tilemap_mark_tile_dirty(goldstar_reel3_tilemap,offset);
75117}
76118
77static TILE_GET_INFO( get_reel3_tile_info )
119static TILE_GET_INFO( get_goldstar_reel3_tile_info )
78120{
79121   int code = goldstar_reel3_ram[tile_index];
80122
r3957r3958
89131
90132VIDEO_START( goldstar )
91133{
92   tmpbitmap4 = video_screen_auto_bitmap_alloc(machine->primary_screen);
134   goldstar_reel1_tilemap = tilemap_create(machine,get_goldstar_reel1_tile_info,tilemap_scan_rows,8,32, 64, 8);
135   goldstar_reel2_tilemap = tilemap_create(machine,get_goldstar_reel2_tile_info,tilemap_scan_rows,8,32, 64, 8);
136   goldstar_reel3_tilemap = tilemap_create(machine,get_goldstar_reel3_tile_info,tilemap_scan_rows,8,32, 64, 8);
93137
94   reel1_tilemap = tilemap_create(machine,get_reel1_tile_info,tilemap_scan_rows,8,32, 64, 8);
95   reel2_tilemap = tilemap_create(machine,get_reel2_tile_info,tilemap_scan_rows,8,32, 64, 8);
96   reel3_tilemap = tilemap_create(machine,get_reel3_tile_info,tilemap_scan_rows,8,32, 64, 8);
138   tilemap_set_scroll_cols(goldstar_reel1_tilemap, 64);
139   tilemap_set_scroll_cols(goldstar_reel2_tilemap, 64);
140   tilemap_set_scroll_cols(goldstar_reel3_tilemap, 64);
97141
98   tilemap_set_scroll_cols(reel1_tilemap, 64);
99   tilemap_set_scroll_cols(reel2_tilemap, 64);
100   tilemap_set_scroll_cols(reel3_tilemap, 64);
142   goldstar_fg_tilemap = tilemap_create(machine,get_goldstar_fg_tile_info,tilemap_scan_rows,8,8, 64, 32);
143   tilemap_set_transparent_pen(goldstar_fg_tilemap,0);
144}
101145
146VIDEO_START( cherrym )
147{
148   goldstar_reel1_tilemap = tilemap_create(machine,get_goldstar_reel1_tile_info,tilemap_scan_rows,8,32, 64, 8);
149   goldstar_reel2_tilemap = tilemap_create(machine,get_goldstar_reel2_tile_info,tilemap_scan_rows,8,32, 64, 8);
150   goldstar_reel3_tilemap = tilemap_create(machine,get_goldstar_reel3_tile_info,tilemap_scan_rows,8,32, 64, 8);
151
152   tilemap_set_scroll_cols(goldstar_reel1_tilemap, 64);
153   tilemap_set_scroll_cols(goldstar_reel2_tilemap, 64);
154   tilemap_set_scroll_cols(goldstar_reel3_tilemap, 64);
155
156   goldstar_fg_tilemap = tilemap_create(machine,get_cherrym_fg_tile_info,tilemap_scan_rows,8,8, 64, 32);
157   tilemap_set_transparent_pen(goldstar_fg_tilemap,0);
102158}
103159
104160
105161
106
107162WRITE8_HANDLER( goldstar_fa00_w )
108163{
109164   /* bit 1 toggles continuously - might be irq enable or watchdog reset */
r3957r3958
114169
115170
116171// are these hardcoded, or registers?
117static const rectangle visible1 = { 14*8, (14+48)*8-1,  4*8,  (4+7)*8-1 };
118static const rectangle visible2 = { 14*8, (14+48)*8-1, 12*8, (12+7)*8-1 };
119static const rectangle visible3 = { 14*8, (14+48)*8-1, 20*8, (20+7)*8-1 };
172static const rectangle visible1 = { 0*8, (14+48)*8-1,  4*8,  (4+7)*8-1 };
173static const rectangle visible2 = { 0*8, (14+48)*8-1, 12*8, (12+7)*8-1 };
174static const rectangle visible3 = { 0*8, (14+48)*8-1, 20*8, (20+7)*8-1 };
120175
121176
122177VIDEO_UPDATE( goldstar )
123178{
124   int offs;
125179   int i;
126180
127181   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
128182
129183   for (i= 0;i < 64;i++)
130184   {
131      tilemap_set_scrolly(reel1_tilemap, i, goldstar_reel1_scroll[i]);
132      tilemap_set_scrolly(reel2_tilemap, i, goldstar_reel2_scroll[i]);
133      tilemap_set_scrolly(reel3_tilemap, i, goldstar_reel3_scroll[i]);
185      tilemap_set_scrolly(goldstar_reel1_tilemap, i, goldstar_reel1_scroll[i]);
186      tilemap_set_scrolly(goldstar_reel2_tilemap, i, goldstar_reel2_scroll[i]);
187      tilemap_set_scrolly(goldstar_reel3_tilemap, i, goldstar_reel3_scroll[i]);
134188   }
135189
136   tilemap_draw(bitmap,&visible1,reel1_tilemap,0,0);
137   tilemap_draw(bitmap,&visible2,reel2_tilemap,0,0);
138   tilemap_draw(bitmap,&visible3,reel3_tilemap,0,0);
190   tilemap_draw(bitmap,&visible1,goldstar_reel1_tilemap,0,0);
191   tilemap_draw(bitmap,&visible2,goldstar_reel2_tilemap,0,0);
192   tilemap_draw(bitmap,&visible3,goldstar_reel3_tilemap,0,0);
139193
194   tilemap_draw(bitmap,cliprect,goldstar_fg_tilemap,0,0);
140195
141
142   for (offs = videoram_size - 1;offs >= 0;offs--)
143   {
144      int sx,sy;
145
146
147      sx = offs % 64;
148      sy = offs / 64;
149
150      drawgfx(bitmap,screen->machine->gfx[0],
151            videoram[offs] + ((colorram[offs] & 0xf0) << 4),
152            colorram[offs] & 0x0f,
153            0,0,
154            8*sx,8*sy,
155            0,TRANSPARENCY_PEN,0);
156   }
157
158196   return 0;
159197}
160
161
162VIDEO_UPDATE( cherrym )
163{
164   int offs;
165   int i;
166
167   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
168
169   for (i= 0;i < 64;i++)
170   {
171      tilemap_set_scrolly(reel1_tilemap, i, goldstar_reel1_scroll[i]);
172      tilemap_set_scrolly(reel2_tilemap, i, goldstar_reel2_scroll[i]);
173      tilemap_set_scrolly(reel3_tilemap, i, goldstar_reel3_scroll[i]);
174   }
175
176   tilemap_draw(bitmap,&visible1,reel1_tilemap,0,0);
177   tilemap_draw(bitmap,&visible2,reel2_tilemap,0,0);
178   tilemap_draw(bitmap,&visible3,reel3_tilemap,0,0);
179
180   for (offs = videoram_size - 1;offs >= 0;offs--)
181   {
182      int sx,sy;
183
184
185      sx = offs % 64;
186      sy = offs / 64;
187
188      drawgfx(bitmap,screen->machine->gfx[0],
189            videoram[offs] + ((colorram[offs] & 0x0f) << 8),
190            (colorram[offs] & 0xf0)>>4,
191            0,0,
192            8*sx,8*sy,
193            0,TRANSPARENCY_PEN,0);
194   }
195
196   return 0;
197}
src/mame/video/prehisle.c
r3957r3958
5656   case 0x23: invert_controls = data ? 0x00ff : 0x0000; break;
5757   case 0x28: coin_counter_w(0, data & 1); break;
5858   case 0x29: coin_counter_w(1, data & 1); break;
59   case 0x30: flip_screen_set(data & 0x01); break;
59   case 0x30: flip_screen_set(space->machine, data & 0x01); break;
6060   }
6161}
6262
r3957r3958
127127
128128      if (sx & 0x200) sx = -(0xff - (sx & 0xff));   // wraparound
129129
130      if (flip_screen_get())
130      if (flip_screen_get(machine))
131131      {
132132         sx = 240 - sx;
133133         sy = 240 - sy;
src/mame/video/jagblit.c
r3957r3958
130130   } while (0)
131131#endif
132132
133static void FUNCNAME(UINT32 command, UINT32 a1flags, UINT32 a2flags)
133static void FUNCNAME(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags)
134134{
135135   UINT32 a1_base = blitter_regs[A1_BASE];
136136   INT32 a1_pitch = (A1FIXED & 3) ^ ((A1FIXED & 2) >> 1);
r3957r3958
165165   UINT8 a1_phrase_mode = 0;
166166   UINT8 a2_phrase_mode = 0;
167167
168   void *a1_base_mem = get_jaguar_memory(a1_base);
169   void *a2_base_mem = get_jaguar_memory(a2_base);
168   void *a1_base_mem = get_jaguar_memory(machine, a1_base);
169   void *a2_base_mem = get_jaguar_memory(machine, a2_base);
170170
171171   void *asrc_base_mem =   (COMMAND & 0x00000800) ? a1_base_mem : a2_base_mem;
172172   UINT32 asrcflags =      (COMMAND & 0x00000800) ? A1FIXED : A2FIXED;
r3957r3958
195195   {
196196      if (LOG_BAD_BLITS)
197197      {
198      logerror("%s:Blit!\n", cpuexec_describe_context(Machine));
198      logerror("%s:Blit!\n", cpuexec_describe_context(machine));
199199      logerror("  a1_base  = %08X\n", a1_base);
200200      logerror("  a2_base  = %08X\n", a2_base);
201201      }
r3957r3958
275275
276276   if (LOG_BLITS)
277277   {
278   logerror("%s:Blit!\n", cpuexec_describe_context(Machine));
278   logerror("%s:Blit!\n", cpuexec_describe_context(machine));
279279   logerror("  a1_base  = %08X\n", a1_base);
280280   logerror("  a1_pitch = %d\n", a1_pitch);
281281   logerror("  a1_psize = %d\n", 1 << ((A1FIXED >> 3) & 7));
src/mame/video/wwfsstar.c
r3957r3958
154154
155155         number &= ~(chain - 1);
156156
157         if (flip_screen_get())
157         if (flip_screen_get(machine))
158158         {
159159            flipy = !flipy;
160160            flipx = !flipx;
r3957r3958
164164
165165         for (count=0;count<chain;count++)
166166         {
167            if (flip_screen_get())
167            if (flip_screen_get(machine))
168168            {
169169               if (!flipy)
170170               {
src/mame/video/model1.c
r3957r3958
724724   return 0;
725725}
726726
727static void push_object(UINT32 tex_adr, UINT32 poly_adr, UINT32 size)
727static void push_object(running_machine *machine, UINT32 tex_adr, UINT32 poly_adr, UINT32 size)
728728{
729729   int i;
730730   UINT32 flags;
r3957r3958
889889      {
890890         /*float dif=mult_vector(&vn, &view.light);
891891            float ln=lightparams[lightmode].a + lightparams[lightmode].d*MAX(0.0,dif);
892            cquad.col = scale_color(Machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)], MIN(1.0,ln));
893            cquad.col = scale_color(Machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)], MIN(1.0,ln));
892            cquad.col = scale_color(machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)], MIN(1.0,ln));
893            cquad.col = scale_color(machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)], MIN(1.0,ln));
894894            */
895895         float dif=mult_vector(&vn, &view.light);
896896         float spec=compute_specular(&vn,&view.light,dif,lightmode);
r3957r3958
10651065         b=(model1_color_xlat[(b<<8)|lumval|0x4000]>>3)&0x1f;
10661066         cquad.col=(r<<10)|(g<<5)|(b<<0);
10671067      }
1068      //cquad.col  = scale_color(Machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)],((float) (lum>>24)) / 128.0);
1068      //cquad.col  = scale_color(machine->pens[0x1000|(tgp_ram[tex_adr-0x40000] & 0x3ff)],((float) (lum>>24)) / 128.0);
10691069      if(flags & 0x00002000)
10701070         cquad.col |= MOIRE;
10711071
r3957r3958
11731173   LOG_TGP(("VIDEO: control=%08x\n", (listctl[1]<<16)|listctl[0]));
11741174}
11751175
1176static void tgp_render(bitmap_t *bitmap, const rectangle *cliprect)
1176static void tgp_render(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
11771177{
11781178   render_done = 1;
11791179   if((listctl[1] & 0x1f) == 0x1f) {
r3957r3958
12021202            // 6 = ??  draw object (57bd4, 387460, 2ad)
12031203
12041204            if(1 || zz >= 666)
1205               push_object(readi(list+2), readi(list+4), readi(list+6));
1205               push_object(machine, readi(list+2), readi(list+4), readi(list+6));
12061206            list += 8;
12071207            break;
12081208         case 2:
r3957r3958
15151515   sys24_tile_draw(screen->machine, bitmap, cliprect, 2, 0, 0);
15161516   sys24_tile_draw(screen->machine, bitmap, cliprect, 0, 0, 0);
15171517
1518   tgp_render(bitmap, cliprect);
1518   tgp_render(screen->machine, bitmap, cliprect);
15191519
15201520   sys24_tile_draw(screen->machine, bitmap, cliprect, 7, 0, 0);
15211521   sys24_tile_draw(screen->machine, bitmap, cliprect, 5, 0, 0);
src/mame/video/jackal.c
r3957r3958
138138      if (attr & 0x01) sx = sx - 256;
139139      if (sy > 0xf0)   sy = sy - 256;
140140
141      if (flip_screen_get())
141      if (flip_screen_get(machine))
142142      {
143143         sx = 240 - sx;
144144         sy = 240 - sy;
r3957r3958
151151         int spritenum = sn1*4 + ((sn2 & (8+4)) >> 2) + ((sn2 & (2+1)) << 10);
152152         int mod = -8;
153153
154         if (flip_screen_get())
154         if (flip_screen_get(machine))
155155         {
156156            sx += 8;
157157            sy -= 8;
r3957r3958
160160
161161         if ((attr & 0x0C) == 0x0C)
162162         {
163            if (flip_screen_get()) sy += 16;
163            if (flip_screen_get(machine)) sy += 16;
164164            DRAW_SPRITE(bank + 1, spritenum, sx, sy)
165165         }
166166
r3957r3958
183183
184184         if (attr & 0x10)
185185         {
186            if (flip_screen_get())
186            if (flip_screen_get(machine))
187187            {
188188               sx -= 16;
189189               sy -= 16;
src/mame/video/taitoic.c
r3957r3958
577577/* Note: various assumptions are made in these routines, typically that
578578   only CPU#0 is of interest. If in doubt, check the routine. */
579579
580static int has_write_handler(running_machine *machine, int cpunum, write16_space_func handler)
580static int has_write_handler(const device_config *cpu, write16_space_func handler)
581581{
582   const device_config *cpu = machine->cpu[cpunum];
583582   if (cpu != NULL)
584583   {
585584      const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
r3957r3958
596595
597596int TC0100SCN_count(running_machine *machine)
598597{
599   int mask = (has_write_handler(machine, 0, TC0100SCN_word_0_w) ||
600      has_write_handler(machine, 0, TC0100SCN_dual_screen_w) ||
601      has_write_handler(machine, 0, TC0100SCN_triple_screen_w)) ? 1 : 0;
602   mask |= has_write_handler(machine, 0, TC0100SCN_word_1_w) << 1;
603   mask |= has_write_handler(machine, 0, TC0100SCN_word_2_w) << 2;
598   int mask = (has_write_handler(machine->cpu[0], TC0100SCN_word_0_w) ||
599      has_write_handler(machine->cpu[0], TC0100SCN_dual_screen_w) ||
600      has_write_handler(machine->cpu[0], TC0100SCN_triple_screen_w)) ? 1 : 0;
601   mask |= has_write_handler(machine->cpu[0], TC0100SCN_word_1_w) << 1;
602   mask |= has_write_handler(machine->cpu[0], TC0100SCN_word_2_w) << 2;
604603
605604   /* Catch illegal configurations */
606605   /* TODO: we should give an appropriate warning */
r3957r3958
611610
612611int TC0110PCR_mask(running_machine *machine)
613612{
614   int mask = (has_write_handler(machine, 0, TC0110PCR_word_w) ||
615         has_write_handler(machine, 0, TC0110PCR_step1_word_w) ||
616         has_write_handler(machine, 0, TC0110PCR_step1_rbswap_word_w) ||
617         has_write_handler(machine, 0, TC0110PCR_step1_4bpg_word_w)) ? 1 : 0;
618   mask |= has_write_handler(machine, 0, TC0110PCR_step1_word_1_w) << 1;
619   mask |= has_write_handler(machine, 0, TC0110PCR_step1_word_2_w) << 2;
613   int mask = (has_write_handler(machine->cpu[0], TC0110PCR_word_w) ||
614         has_write_handler(machine->cpu[0], TC0110PCR_step1_word_w) ||
615         has_write_handler(machine->cpu[0], TC0110PCR_step1_rbswap_word_w) ||
616         has_write_handler(machine->cpu[0], TC0110PCR_step1_4bpg_word_w)) ? 1 : 0;
617   mask |= has_write_handler(machine->cpu[0], TC0110PCR_step1_word_1_w) << 1;
618   mask |= has_write_handler(machine->cpu[0], TC0110PCR_step1_word_2_w) << 2;
620619   return mask;
621620}
622621
623622int has_TC0150ROD(running_machine *machine)
624623{
625   return   has_write_handler(machine, 0, TC0150ROD_word_w) ||
626         has_write_handler(machine, 1, TC0150ROD_word_w) ||
627         has_write_handler(machine, 2, TC0150ROD_word_w);
624   return   has_write_handler(machine->cpu[0], TC0150ROD_word_w) ||
625         has_write_handler(machine->cpu[1], TC0150ROD_word_w) ||
626         has_write_handler(machine->cpu[2], TC0150ROD_word_w);
628627}
629628
630629
631630int has_TC0280GRD(running_machine *machine)
632631{
633   return   has_write_handler(machine, 0, TC0280GRD_word_w);
632   return   has_write_handler(machine->cpu[0], TC0280GRD_word_w);
634633}
635634
636635
637636int has_TC0360PRI(running_machine *machine)
638637{
639   return   has_write_handler(machine, 0, TC0360PRI_halfword_w) ||
640         has_write_handler(machine, 0, TC0360PRI_halfword_swap_w);
638   return   has_write_handler(machine->cpu[0], TC0360PRI_halfword_w) ||
639         has_write_handler(machine->cpu[0], TC0360PRI_halfword_swap_w);
641640}
642641
643642
644643int has_TC0430GRW(running_machine *machine)
645644{
646   return   has_write_handler(machine, 0, TC0430GRW_word_w);
645   return   has_write_handler(machine->cpu[0], TC0430GRW_word_w);
647646}
648647
649648
650649int has_TC0480SCP(running_machine *machine)
651650{
652   return   has_write_handler(machine, 0, TC0480SCP_word_w);
651   return   has_write_handler(machine->cpu[0], TC0480SCP_word_w);
653652}
654653
655654
src/mame/video/namcos86.c
r3957r3958
300300      sx += sprite_xoffs;
301301      sy -= sprite_yoffs;
302302
303      if (flip_screen_get())
303      if (flip_screen_get(machine))
304304      {
305305         sx = -sx - sizex;
306306         sy = -sy - sizey;
r3957r3958
328328}
329329
330330
331static void set_scroll(int layer)
331static void set_scroll(running_machine *machine, int layer)
332332{
333333   static const int xdisp[4] = { 47, 49, 46, 48 };
334334   int scrollx,scrolly;
335335
336336   scrollx = xscroll[layer] - xdisp[layer];
337337   scrolly = yscroll[layer] + 9;
338   if (flip_screen_get())
338   if (flip_screen_get(machine))
339339   {
340340      scrollx = -scrollx;
341341      scrolly = -scrolly;
r3957r3958
350350   int layer;
351351
352352   /* flip screen is embedded in the sprite control registers */
353   /* can't use flip_screen_set() because the visible area is asymmetrical */
354   flip_screen_set_no_update(spriteram[0x07f6] & 1);
355   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
356   set_scroll(0);
357   set_scroll(1);
358   set_scroll(2);
359   set_scroll(3);
353   /* can't use flip_screen_set(screen->machine, ) because the visible area is asymmetrical */
354   flip_screen_set_no_update(screen->machine, spriteram[0x07f6] & 1);
355   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get(screen->machine) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
356   set_scroll(screen->machine, 0);
357   set_scroll(screen->machine, 1);
358   set_scroll(screen->machine, 2);
359   set_scroll(screen->machine, 3);
360360
361361   bitmap_fill(priority_bitmap, cliprect, 0);
362362
src/mame/video/suna8.c
r3957r3958
318318            if (flipx)   tile_flipx = !tile_flipx;
319319            if (flipy)   tile_flipy = !tile_flipy;
320320
321            if (flip_screen_get())
321            if (flip_screen_get(machine))
322322            {   sx = max_x - sx;   tile_flipx = !tile_flipx;
323323               sy = max_y - sy;   tile_flipy = !tile_flipy;   }
324324
r3957r3958
383383            int sx      =    x + tx * 8;
384384            int sy      =   (y + real_ty * 8) & 0xff;
385385
386            if (flip_screen_get())
386            if (flip_screen_get(machine))
387387            {   sx = max_x - sx;   flipx = !flipx;
388388               sy = max_y - sy;   flipy = !flipy;   }
389389
src/mame/video/vaportra.c
r3957r3958
121121         inc = 1;
122122      }
123123
124      if (flip_screen_get())
124      if (flip_screen_get(machine))
125125      {
126126         y=240-y;
127127         x=240-x;
r3957r3958
150150{
151151   int pri=vaportra_priority[0] & 0x03;
152152
153   flip_screen_set( !(deco16_pf12_control[0]&0x80) );
153   flip_screen_set(screen->machine, !(deco16_pf12_control[0]&0x80) );
154154
155155   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
156156   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
src/mame/video/btime.c
r3957r3958
268268    // Bit 7   = Flip Screen
269269
270270   btime_palette = (data & 0x30) >> 3;
271   flip_screen_set(data & 0x80);
271   flip_screen_set(space->machine, data & 0x80);
272272}
273273
274274WRITE8_HANDLER( btime_video_control_w )
r3957r3958
278278    // Bit 0   = Flip screen
279279    // Bit 1-7 = Unknown
280280
281   flip_screen_set(data & 0x01);
281   flip_screen_set(space->machine, data & 0x01);
282282}
283283
284284WRITE8_HANDLER( bnj_video_control_w )
r3957r3958
312312
313313   if (!(input_port_read(space->machine, "DSW1") & 0x40)) /* cocktail mode */
314314   {
315      flip_screen_set(data & 0x01);
315      flip_screen_set(space->machine, data & 0x01);
316316   }
317317}
318318
r3957r3958
338338        /* check priority */
339339        if ((priority != -1) && (priority != ((code >> 7) & 0x01)))  continue;
340340
341        if (flip_screen_get())
341        if (flip_screen_get(machine))
342342        {
343343            x = 31 - x;
344344            y = 31 - y;
r3957r3958
347347        drawgfx(bitmap,machine->gfx[0],
348348                code,
349349                color,
350                flip_screen_get(),flip_screen_get(),
350                flip_screen_get(machine),flip_screen_get(machine),
351351                8*x,8*y,
352352                cliprect,transparency,0);
353353    }
r3957r3958
374374        flipx = sprite_ram[offs + 0] & 0x04;
375375        flipy = sprite_ram[offs + 0] & 0x02;
376376
377        if (flip_screen_get())
377        if (flip_screen_get(machine))
378378        {
379379            x = 240 - x;
380380            y = 240 - y + sprite_y_adjust_flip_screen;
r3957r3958
392392                x, y,
393393                cliprect,TRANSPARENCY_PEN,0);
394394
395        y = y + (flip_screen_get() ? -256 : 256);
395        y = y + (flip_screen_get(machine) ? -256 : 256);
396396
397397        // Wrap around
398398        drawgfx(bitmap,machine->gfx[1],
r3957r3958
426426            int x = 240 - (16 * (offs / 16) + scroll);
427427            int y = 16 * (offs % 16);
428428
429            if (flip_screen_get())
429            if (flip_screen_get(machine))
430430            {
431431                x = 240 - x;
432432                y = 240 - y;
r3957r3958
435435            drawgfx(bitmap, machine->gfx[2],
436436                    gfx[tileoffset + offs],
437437                    color,
438                    flip_screen_get(),flip_screen_get(),
438                    flip_screen_get(machine),flip_screen_get(machine),
439439                    x,y,
440440                    cliprect,TRANSPARENCY_NONE,0);
441441        }
r3957r3958
489489        // Generate tile map
490490        static UINT8 btime_tilemap[4];
491491
492        if (flip_screen_get())
492        if (flip_screen_get(screen->machine))
493493            start = 0;
494494        else
495495            start = 1;
r3957r3958
562562            sy = 16 * (((offs % 0x100) < 0x80) ? offs % 8 : (offs % 8) + 8);
563563            sx = 496 - sx;
564564
565            if (flip_screen_get())
565            if (flip_screen_get(screen->machine))
566566            {
567567                sx = 496 - sx;
568568                sy = 240 - sy;
r3957r3958
571571            drawgfx(background_bitmap, screen->machine->gfx[2],
572572                    (bnj_backgroundram[offs] >> 4) + ((offs & 0x80) >> 3) + 32,
573573                    0,
574                    flip_screen_get(), flip_screen_get(),
574                    flip_screen_get(screen->machine), flip_screen_get(screen->machine),
575575                    sx, sy,
576576                    0, TRANSPARENCY_NONE, 0);
577577        }
578578
579579        /* copy the background bitmap to the screen */
580580        scroll = (bnj_scroll1 & 0x02) * 128 + 511 - bnj_scroll2;
581        if (!flip_screen_get())
581        if (!flip_screen_get(screen->machine))
582582            scroll = 767-scroll;
583583        copyscrollbitmap(bitmap, background_bitmap, 1, &scroll, 0, 0, cliprect);
584584
r3957r3958
609609        sx = 31 - (offs / 32);
610610        sy = offs % 32;
611611
612        if (flip_screen_get())
612        if (flip_screen_get(screen->machine))
613613        {
614614            sx = 31 - sx;
615615            sy = 31 - sy;
r3957r3958
618618        drawgfx(bitmap, screen->machine->gfx[2],
619619                bnj_backgroundram[offs],
620620                0,
621                flip_screen_get(), flip_screen_get(),
621                flip_screen_get(screen->machine), flip_screen_get(screen->machine),
622622                8*sx,8*sy,
623623                cliprect, TRANSPARENCY_NONE, 0);
624624    }
src/mame/video/nova2001.c
r3957r3958
241241WRITE8_HANDLER( nova2001_flipscreen_w )
242242{
243243   // inverted
244   flip_screen_set(~data & 1);
244   flip_screen_set(space->machine, ~data & 1);
245245}
246246
247247WRITE8_HANDLER( pkunwar_flipscreen_w )
248248{
249   flip_screen_set(data & 1);
249   flip_screen_set(space->machine, data & 1);
250250}
251251
252252
r3957r3958
277277         continue;
278278      }
279279
280      if (flip_screen_get())
280      if (flip_screen_get(machine))
281281      {
282282         sx = 240 - sx;
283283         sy = 240 - sy;
r3957r3958
314314         continue;
315315      }
316316
317      if (flip_screen_get())
317      if (flip_screen_get(machine))
318318      {
319319         sx = 240 - sx;
320320         sy = 240 - sy;
src/mame/video/cps1.c
r3957r3958
22102210{
22112211#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)               \
22122212{                                                   \
2213   if (flip_screen_get())                                 \
2213   if (flip_screen_get(machine))                                 \
22142214      pdrawgfx(bitmap,machine->gfx[2],                     \
22152215            CODE,                                    \
22162216            COLOR,                                    \
r3957r3958
24462446{
24472447#define DRAWSPRITE(CODE,COLOR,FLIPX,FLIPY,SX,SY)                           \
24482448{                                                               \
2449   if (flip_screen_get())                                             \
2449   if (flip_screen_get(machine))                                             \
24502450      pdrawgfx(bitmap,machine->gfx[2],                                 \
24512451            CODE,                                                \
24522452            COLOR,                                                \
r3957r3958
26132613            int sy = (offs % 256);
26142614            sx = (sx - stars2x + (col & 0x1f)) & 0x1ff;
26152615            sy = (sy - stars2y) & 0xff;
2616            if (flip_screen_get())
2616            if (flip_screen_get(screen->machine))
26172617            {
26182618               sx = 511 - sx;
26192619               sy = 255 - sy;
r3957r3958
26392639            int sy = (offs % 256);
26402640            sx = (sx - stars1x + (col & 0x1f)) & 0x1ff;
26412641            sy = (sy - stars1y) & 0xff;
2642            if (flip_screen_get())
2642            if (flip_screen_get(screen->machine))
26432643            {
26442644               sx = 511 - sx;
26452645               sy = 255 - sy;
r3957r3958
26992699   int videocontrol = cps1_cps_a_regs[CPS1_VIDEOCONTROL];
27002700
27012701
2702   flip_screen_set(videocontrol & 0x8000);
2702   flip_screen_set(screen->machine, videocontrol & 0x8000);
27032703
27042704   layercontrol = cps1_cps_b_regs[cps1_game_config->layer_control/2];
27052705
src/mame/video/yunsun16.c
r3957r3958
176176      x   +=   sprites_scrolldx;
177177      y   +=   sprites_scrolldy;
178178
179      if (flip_screen_get())   // not used?
179      if (flip_screen_get(machine))   // not used?
180180      {
181181         flipx = !flipx;      x = max_x - x - 16;
182182         flipy = !flipy;      y = max_y - y - 16;
src/mame/video/mermaid.c
r3957r3958
7474
7575WRITE8_HANDLER( mermaid_flip_screen_x_w )
7676{
77   flip_screen_x_set(data & 0x01);
77   flip_screen_x_set(space->machine, data & 0x01);
7878}
7979
8080WRITE8_HANDLER( mermaid_flip_screen_y_w )
8181{
82   flip_screen_y_set(data & 0x01);
82   flip_screen_y_set(space->machine, data & 0x01);
8383}
8484
8585WRITE8_HANDLER( mermaid_bg_scroll_w )
r3957r3958
187187      code |= rougien_gfxbank1 * 0x2800;
188188      code |= rougien_gfxbank2 * 0x2400;
189189
190      if (flip_screen_x_get())
190      if (flip_screen_x_get(machine))
191191      {
192192         flipx = !flipx;
193193         sx = 240 - sx;
194194      }
195195
196      if (flip_screen_y_get())
196      if (flip_screen_y_get(machine))
197197      {
198198         flipy = !flipy;
199199         sy = 240 - sy;
200200      }
201201
202202      drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy,
203         (flip_screen_x_get() ? &flip_spritevisiblearea : &spritevisiblearea),
203         (flip_screen_x_get(machine) ? &flip_spritevisiblearea : &spritevisiblearea),
204204         TRANSPARENCY_PEN, 0);
205205   }
206206}
r3957r3958
266266      code |= rougien_gfxbank1 * 0x2800;
267267      code |= rougien_gfxbank2 * 0x2400;
268268
269      if (flip_screen_x_get())
269      if (flip_screen_x_get(machine))
270270      {
271271         flipx = !flipx;
272272         sx = 240 - sx;
273273      }
274274
275      if (flip_screen_y_get())
275      if (flip_screen_y_get(machine))
276276      {
277277         flipy = !flipy;
278278         sy = 240 - sy;
r3957r3958
338338            code2 |= rougien_gfxbank1 * 0x2800;
339339            code2 |= rougien_gfxbank2 * 0x2400;
340340
341            if (flip_screen_x_get())
341            if (flip_screen_x_get(machine))
342342            {
343343               flipx2 = !flipx2;
344344               sx2 = 240 - sx2;
345345            }
346346
347            if (flip_screen_y_get())
347            if (flip_screen_y_get(machine))
348348            {
349349               flipy2 = !flipy2;
350350               sy2 = 240 - sy2;
r3957r3958
380380      code |= rougien_gfxbank1 * 0x2800;
381381      code |= rougien_gfxbank2 * 0x2400;
382382
383      if (flip_screen_x_get())
383      if (flip_screen_x_get(machine))
384384      {
385385         flipx = !flipx;
386386         sx = 240 - sx;
387387      }
388388
389      if (flip_screen_y_get())
389      if (flip_screen_y_get(machine))
390390      {
391391         flipy = !flipy;
392392         sy = 240 - sy;
r3957r3958
428428            code2 |= rougien_gfxbank1 * 0x2800;
429429            code2 |= rougien_gfxbank2 * 0x2400;
430430
431            if (flip_screen_x_get())
431            if (flip_screen_x_get(machine))
432432            {
433433               flipx2 = !flipx2;
434434               sx2 = 240 - sx2;
435435            }
436436
437            if (flip_screen_y_get())
437            if (flip_screen_y_get(machine))
438438            {
439439               flipy2 = !flipy2;
440440               sy2 = 240 - sy2;
r3957r3958
470470      code |= rougien_gfxbank1 * 0x2800;
471471      code |= rougien_gfxbank2 * 0x2400;
472472
473      if (flip_screen_x_get())
473      if (flip_screen_x_get(machine))
474474      {
475475         flipx = !flipx;
476476         sx = 240 - sx;
477477      }
478478
479      if (flip_screen_y_get())
479      if (flip_screen_y_get(machine))
480480      {
481481         flipy = !flipy;
482482         sy = 240 - sy;
r3957r3958
518518            code2 |= rougien_gfxbank1 * 0x2800;
519519            code2 |= rougien_gfxbank2 * 0x2400;
520520
521            if (flip_screen_x_get())
521            if (flip_screen_x_get(machine))
522522            {
523523               flipx2 = !flipx2;
524524               sx2 = 240 - sx2;
525525            }
526526
527            if (flip_screen_y_get())
527            if (flip_screen_y_get(machine))
528528            {
529529               flipy2 = !flipy2;
530530               sy2 = 240 - sy2;
src/mame/video/gaelco3d.c
r3957r3958
77**************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "eminline.h"
1211#include "gaelco3d.h"
1312#include "cpu/tms32031/tms32031.h"
r3957r3958
7776{
7877   int width, height;
7978
80   poly = poly_alloc(2000, sizeof(poly_extra_data), 0);
79   poly = poly_alloc(machine, 2000, sizeof(poly_extra_data), 0);
8180   add_exit_callback(machine, gaelco3d_exit);
8281
8382   screenbits = video_screen_auto_bitmap_alloc(machine->primary_screen);
r3957r3958
373372 *
374373 *************************************/
375374
376void gaelco3d_render(void)
375void gaelco3d_render(const device_config *screen)
377376{
378377   /* wait for any queued stuff to complete */
379378   poly_wait(poly, "Time to render");
380379
381380#if DISPLAY_STATS
382381{
383   int scan = video_screen_get_vpos(machine->primary_screen);
384   popmessage("Polys = %4d  Timeleft = %3d", polygons, (lastscan < scan) ? (scan - lastscan) : (scan + (lastscan - video_screen_get_visible_area(Machine->primary_screen)->max_y)));
382   int scan = video_screen_get_vpos(screen);
383   popmessage("Polys = %4d  Timeleft = %3d", polygons, (lastscan < scan) ? (scan - lastscan) : (scan + (lastscan - video_screen_get_visible_area(screen)->max_y)));
385384}
386385#endif
387386
src/mame/video/othldrby.c
r3957r3958
153153      sizex = (buf_spriteram[offs+2] & 0x000f) + 1;
154154      sizey = (buf_spriteram[offs+3] & 0x000f) + 1;
155155
156      if (flip_screen_get())
156      if (flip_screen_get(machine))
157157      {
158158         flipx = !flipx;
159159         flipy = !flipy;
r3957r3958
181181   int layer;
182182
183183
184   flip_screen_set(vreg[0x0f] & 0x80);
184   flip_screen_set(screen->machine, vreg[0x0f] & 0x80);
185185
186186   for (layer = 0;layer < 3;layer++)
187187   {
188      if (flip_screen_get())
188      if (flip_screen_get(screen->machine))
189189      {
190190         tilemap_set_scrollx(bg_tilemap[layer],0,vreg[2*layer]+59);
191191         tilemap_set_scrolly(bg_tilemap[layer],0,vreg[2*layer+1]+248);
src/mame/video/snk.c
r3957r3958
424424
425425WRITE8_HANDLER( marvins_flipscreen_w )
426426{
427   flip_screen_set(data & 0x80);
427   flip_screen_set(space->machine, data & 0x80);
428428
429429   // other bits unknown
430430}
431431
432432WRITE8_HANDLER( sgladiat_flipscreen_w )
433433{
434   flip_screen_set(data & 0x80);
434   flip_screen_set(space->machine, data & 0x80);
435435
436436   tilemap_set_palette_offset(bg_tilemap, ((data & 0xf) ^ 8) << 4);
437437
r3957r3958
440440
441441WRITE8_HANDLER( hal21_flipscreen_w )
442442{
443   flip_screen_set(data & 0x80);
443   flip_screen_set(space->machine, data & 0x80);
444444
445445   tilemap_set_palette_offset(bg_tilemap, ((data & 0xf) ^ 8) << 4);
446446   tilemap_set_pen_data_offset(bg_tilemap, ((data & 0x20) << 3) * space->machine->gfx[1]->char_modulo);
r3957r3958
483483        -------X    scrollx MSB (sprites)
484484    */
485485
486   flip_screen_set(data & 0x20);
486   flip_screen_set(space->machine, data & 0x20);
487487
488488   bg_scrolly =   (bg_scrolly   & 0xff) | ((data & 0x10) << 4);
489489   sp16_scrolly = (sp16_scrolly & 0xff) | ((data & 0x08) << 5);
r3957r3958
505505        -------X    scrollx MSB (sprites)
506506    */
507507
508   flip_screen_set(data & 0x80);
508   flip_screen_set(space->machine, data & 0x80);
509509
510510   tilemap_set_pen_data_offset(tx_tilemap, ((data & 0x40) << 2) * space->machine->gfx[0]->char_modulo);
511511
r3957r3958
560560
561561WRITE8_HANDLER( gwar_videoattrs_w )
562562{
563   flip_screen_set(data & 0x04);
563   flip_screen_set(space->machine, data & 0x04);
564564
565565   sp32_scrollx = (sp32_scrollx & 0xff) | ((data & 0x80) << 1);
566566   sp16_scrollx = (sp16_scrollx & 0xff) | ((data & 0x40) << 2);
r3957r3958
572572
573573WRITE8_HANDLER( gwara_videoattrs_w )
574574{
575   flip_screen_set(data & 0x10);
575   flip_screen_set(space->machine, data & 0x10);
576576
577577   bg_scrollx =   (bg_scrollx   & 0xff) | ((data & 0x02) << 7);
578578   bg_scrolly =   (bg_scrolly   & 0xff) | ((data & 0x01) << 8);
r3957r3958
627627      int flipy = (attributes&0x20);
628628      int flipx = 0;
629629
630      if (flip_screen_get())
630      if (flip_screen_get(machine))
631631      {
632632         sx = 89 - 16 - sx;
633633         sy = 262 - 16 - sy;
r3957r3958
692692         yflip = attributes & 0x20;
693693      }
694694
695      if (flip_screen_get())
695      if (flip_screen_get(machine))
696696      {
697697         sx = 89 - size - sx;   // this causes slight misalignment in tnk3 but is correct for athena and fitegolf
698698         sy = 262 - size - sy;
r3957r3958
825825      if (hw_xflip)
826826         sx = 495 - size - sx;
827827
828      if (flip_screen_get())
828      if (flip_screen_get(machine))
829829      {
830830         sx = 495 - size - sx;
831831         sy = 258 - size - sy;
src/mame/video/hyprduel.c
r3957r3958
460460
461461         gfxdata      =   base_gfx + (8*8*4/8) * (((attr & 0x000f) << 16) + code);
462462
463         if (flip_screen_get())
463         if (flip_screen_get(machine))
464464         {
465465            flipx = !flipx;      x = max_x - x - width;
466466            flipy = !flipy;      y = max_y - y - height;
r3957r3958
470470         {
471471            /* prepare GfxElement on the fly */
472472            gfx_element gfx;
473            gfx.machine = machine;
473474            gfx.width = width;
474475            gfx.height = height;
475476            gfx.total_elements = 1;
r3957r3958
482483            gfx.line_modulo = width;
483484            gfx.char_modulo = 0;   /* doesn't matter */
484485            gfx.flags = 0;
486            gfx.machine = machine;
485487
486488            /* Bounds checking */
487489            if ( (gfxdata + width * height - 1) >= gfx_max )
r3957r3958
500502         {
501503            /* prepare GfxElement on the fly */
502504            gfx_element gfx;
505            gfx.machine = machine;
503506            gfx.width = width;
504507            gfx.height = height;
505508            gfx.total_elements = 1;
r3957r3958
512515            gfx.line_modulo = width/2;
513516            gfx.char_modulo = 0;   /* doesn't matter */
514517            gfx.flags = GFX_ELEMENT_PACKED;
518            gfx.machine = machine;
515519
516520            /* Bounds checking */
517521            if ( (gfxdata + width/2 * height - 1) >= gfx_max )
r3957r3958
650654        ---- ---- ---- --1-     ? Blank Screen
651655        ---- ---- ---- ---0     Flip  Screen    */
652656   if (screenctrl & 2)   return 0;
653   flip_screen_set(screenctrl & 1);
657   flip_screen_set(screen->machine, screenctrl & 1);
654658
655659   /* If the game supports 16x16 tiles, make sure that the
656660       16x16 and 8x8 tilemaps of a given layer are not simultaneously
src/mame/video/flstory.c
r3957r3958
102102   }
103103   palette_bank = (data & 0x20) >> 5;
104104
105   flip_screen_set(flipscreen);
105   flip_screen_set(space->machine, flipscreen);
106106
107107//popmessage("%04x: gfxctrl = %02x\n",cpu_get_pc(space->cpu),data);
108108
r3957r3958
124124   if (data & 0x04)
125125   {
126126      flipscreen = (data & 0x01);
127      flip_screen_set(flipscreen);
127      flip_screen_set(space->machine, flipscreen);
128128   }
129129
130130//popmessage("%04x: gfxctrl = %02x\n",cpu_get_pc(space->cpu),data);
src/mame/video/strnskil.c
r3957r3958
5656{
5757   strnskil_scrl_ctrl = data >> 5;
5858
59   if (flip_screen_get() != (data & 0x08))
59   if (flip_screen_get(space->machine) != (data & 0x08))
6060   {
61      flip_screen_set(data & 0x08);
61      flip_screen_set(space->machine, data & 0x08);
6262      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
6363   }
6464}
r3957r3958
8888   {
8989      int code = spriteram[offs + 1];
9090      int color = spriteram[offs + 2] & 0x3f;
91      int flipx = flip_screen_x_get();
92      int flipy = flip_screen_y_get();
91      int flipx = flip_screen_x_get(machine);
92      int flipy = flip_screen_y_get(machine);
9393
9494      int sx = spriteram[offs + 3];
9595      int sy = spriteram[offs];
9696      int px, py;
9797
98      if (flip_screen_get())
98      if (flip_screen_get(machine))
9999      {
100100         px = 240 - sx + 0; /* +2 or +0 ? */
101101         py = sy;
src/mame/video/cosmic.c
r3957r3958
266266      {
267267         if (data & 0x80)
268268         {
269            if (flip_screen_get())
269            if (flip_screen_get(machine))
270270               *BITMAP_ADDR16(bitmap, 255-y, 255-x) = pen;
271271            else
272272               *BITMAP_ADDR16(bitmap, y, x) = pen;
r3957r3958
332332         UINT8 x1;
333333         int hc, hb_;
334334
335         if (flip_screen_get())
335         if (flip_screen_get(screen->machine))
336336            x1 = x - video_screen_get_frame_number(screen);
337337         else
338338            x1 = x + video_screen_get_frame_number(screen);
r3957r3958
403403            if (!(vert_data & horz_data & 0x80))   /* NAND gate */
404404            {
405405               /* blue */
406               if (flip_screen_get())
406               if (flip_screen_get(machine))
407407                  *BITMAP_ADDR16(bitmap, 255-y, 255-x) = 4;
408408               else
409409                  *BITMAP_ADDR16(bitmap, y, x) = 4;
r3957r3958
488488            if (!hd_ & hc_ & !hb_)
489489            {
490490               offs_t offs = ((x >> 3) & 0x03) | ((y & 0x1f) << 2) |
491                             (flip_screen_get() ? 0x80 : 0);
491                             (flip_screen_get(screen->machine) ? 0x80 : 0);
492492
493493               UINT8 plane1 = PROM[offs         ] << (x & 0x07);
494494               UINT8 plane2 = PROM[offs | 0x0400] << (x & 0x07);
r3957r3958
522522
523523         if (color != 0)
524524         {
525            if (flip_screen_get())
525            if (flip_screen_get(screen->machine))
526526               *BITMAP_ADDR16(bitmap, 255-y, 255-x) = color;
527527            else
528528               *BITMAP_ADDR16(bitmap, y, x) = color;
src/mame/video/shaolins.c
r3957r3958
124124{
125125   shaolins_nmi_enable = data;
126126
127   if (flip_screen_get() != (data & 0x01))
127   if (flip_screen_get(space->machine) != (data & 0x01))
128128   {
129      flip_screen_set(data & 0x01);
129      flip_screen_set(space->machine, data & 0x01);
130130      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
131131   }
132132}
r3957r3958
164164         int sx = 240 - spriteram[offs + 6];
165165         int sy = 248 - spriteram[offs + 4];
166166
167         if (flip_screen_get())
167         if (flip_screen_get(machine))
168168         {
169169            sx = 240 - sx;
170170            sy = 248 - sy;
src/mame/video/model2.c
r3957r3958
27032703   sys24_tile_vh_start(machine, 0x3fff);
27042704   sys24_bitmap = bitmap_alloc(width, height+4, BITMAP_FORMAT_INDEXED16);
27052705
2706   poly = poly_alloc(4000, sizeof(poly_extra_data), 0);
2706   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
27072707   add_exit_callback(machine, model2_exit);
27082708
27092709   /* initialize the geometry engine */
src/mame/video/sshangha.c
r3957r3958
8686
8787      sprite &= ~multi;
8888
89      if (flip_screen_get())
89      if (flip_screen_get(machine))
9090      {
9191         y=240-y;
9292         x=304-x;
r3957r3958
187187   static int last_pf1_bank,last_pf2_bank;
188188   int offs;
189189
190   flip_screen_set_no_update(sshangha_control_0[0]&0x80);
191   tilemap_set_flip(ALL_TILEMAPS,flip_screen_x_get() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
190   flip_screen_set_no_update(screen->machine, sshangha_control_0[0]&0x80);
191   tilemap_set_flip(ALL_TILEMAPS,flip_screen_x_get(screen->machine) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
192192
193193   tilemap_set_enable( pf2_tilemap, sshangha_control_0[5]&0x8000);
194194   tilemap_set_enable( pf1_8x8_tilemap, sshangha_control_0[5]&0x0080);
src/mame/video/popeye.c
r3957r3958
193193      sx = 8 * (offset % 128);
194194      sy = 8 * (offset / 128);
195195
196      if (flip_screen_get())
196      if (flip_screen_get(space->machine))
197197         sy = 512-8 - sy;
198198
199199      colour = data & 0x0f;
r3957r3958
210210      sx = 8 * (offset % 64);
211211      sy = 4 * (offset / 64);
212212
213      if (flip_screen_get())
213      if (flip_screen_get(space->machine))
214214         sy = 512-4 - sy;
215215
216216      colour = data & 0x0f;
r3957r3958
269269   static int lastflip = 0;
270270   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
271271
272   if (lastflip != flip_screen_get())
272   if (lastflip != flip_screen_get(machine))
273273   {
274274      for (offs = 0;offs < popeye_bitmapram_size;offs++)
275275         popeye_bitmap_w(space,offs,popeye_bitmapram[offs]);
276276
277      lastflip = flip_screen_get();
277      lastflip = flip_screen_get(machine);
278278   }
279279
280280   set_background_palette(machine, (*popeye_palettebank & 0x08) >> 3);
r3957r3958
290290      if (bitmap_type == TYPE_SKYSKIPR)
291291         scrollx = 2*scrollx - 512;
292292
293      if (flip_screen_get())
293      if (flip_screen_get(machine))
294294      {
295295         if (bitmap_type == TYPE_POPEYE)
296296            scrollx = -scrollx;
r3957r3958
336336      sx = 2*(spriteram[offs])-8;
337337      sy = 2*(256-spriteram[offs + 1]);
338338
339      if (flip_screen_get())
339      if (flip_screen_get(machine))
340340      {
341341         flipx = !flipx;
342342         flipy = !flipy;
src/mame/video/pushman.c
r3957r3958
9999      flipx=spriteram16[offs+1]&2;
100100      flipy=spriteram16[offs+1]&1;   /* flip y untested */
101101
102      if (flip_screen_get())
102      if (flip_screen_get(machine))
103103      {
104104         x = 240 - x;
105105         y = 240 - y;
src/mame/video/hyperspt.c
r3957r3958
105105
106106WRITE8_HANDLER( hyperspt_flipscreen_w )
107107{
108   if (flip_screen_get() != (data & 0x01))
108   if (flip_screen_get(space->machine) != (data & 0x01))
109109   {
110      flip_screen_set(data & 0x01);
110      flip_screen_set(space->machine, data & 0x01);
111111      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
112112   }
113113}
r3957r3958
141141      int flipx = ~spriteram[offs] & 0x40;
142142      int flipy = spriteram[offs] & 0x80;
143143
144      if (flip_screen_get())
144      if (flip_screen_get(machine))
145145      {
146146         sy = 240 - sy;
147147         flipy = !flipy;
148148      }
149149
150      /* Note that this adjustment must be done AFTER handling flip_screen_get(), thus */
150      /* Note that this adjustment must be done AFTER handling flip_screen_get(machine), thus */
151151      /* proving that this is a hardware related "feature" */
152152
153153      sy += 1;
r3957r3958
179179   for (row = 0; row < 32; row++)
180180   {
181181      int scrollx = hyperspt_scroll[row * 2] + (hyperspt_scroll[(row * 2) + 1] & 0x01) * 256;
182      if (flip_screen_get()) scrollx = -scrollx;
182      if (flip_screen_get(screen->machine)) scrollx = -scrollx;
183183      tilemap_set_scrollx(bg_tilemap, row, scrollx);
184184   }
185185
src/mame/video/zodiack.c
r3957r3958
4646
4747WRITE8_HANDLER( zodiack_flipscreen_w )
4848{
49   if (flip_screen_get() != (~data & 0x01))
49   if (flip_screen_get(space->machine) != (~data & 0x01))
5050   {
51      flip_screen_set(~data & 0x01);
51      flip_screen_set(space->machine, ~data & 0x01);
5252      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
5353   }
5454}
r3957r3958
131131   tilemap_set_scroll_cols(fg_tilemap, 32);
132132
133133   /* FIXME: flip_screen_x should not be written. */
134   flip_screen_set_no_update(0);
134   flip_screen_set_no_update(machine, 0);
135135}
136136
137137static void draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
r3957r3958
145145      x = zodiack_bulletsram[offs + 3] + 7;
146146      y = 255 - zodiack_bulletsram[offs + 1];
147147
148      if (flip_screen_get() && percuss_hardware)
148      if (flip_screen_get(machine) && percuss_hardware)
149149      {
150150         y = 255 - y;
151151      }
r3957r3958
175175      flipy = spriteram[offs + 1] & 0x80;
176176      spritecode = spriteram[offs + 1] & 0x3f;
177177
178      if (flip_screen_get() && percuss_hardware)
178      if (flip_screen_get(machine) && percuss_hardware)
179179      {
180180         sy = 240 - sy;
181181         flipy = !flipy;
src/mame/video/mole.c
r3957r3958
4848
4949WRITE8_HANDLER( mole_flipscreen_w )
5050{
51   flip_screen_set(data & 0x01);
51   flip_screen_set(space->machine, data & 0x01);
5252}
5353
5454VIDEO_UPDATE( mole )
src/mame/video/jagobj.c
r3957r3958
489489 *
490490 *************************************/
491491
492static UINT32 *process_bitmap(UINT32 *objdata, int vc, int logit)
492static UINT32 *process_bitmap(running_machine *machine, UINT32 *objdata, int vc, int logit)
493493{
494494   /* extract minimal data */
495495   UINT32 upper = objdata[0];
r3957r3958
498498   UINT32 height = (lower >> 14) & 0x3ff;
499499   UINT32 link = (lower >> 24) | ((upper & 0x7ff) << 8);
500500   UINT32 data = (upper >> 11);
501   UINT32 *src = (UINT32 *)get_jaguar_memory(data << 3);
501   UINT32 *src = (UINT32 *)get_jaguar_memory(machine, data << 3);
502502
503503   if (logit)
504504   {
r3957r3958
651651      objdata[1] = lower - (1 << 14);
652652   }
653653
654   return (UINT32 *)get_jaguar_memory(link << 3);
654   return (UINT32 *)get_jaguar_memory(machine, link << 3);
655655}
656656
657657
r3957r3958
662662 *
663663 *************************************/
664664
665static UINT32 *process_scaled_bitmap(UINT32 *objdata, int vc, int logit)
665static UINT32 *process_scaled_bitmap(running_machine *machine, UINT32 *objdata, int vc, int logit)
666666{
667667   /* extract data */
668668   UINT32 upper = objdata[0];
r3957r3958
671671   UINT32 height = (lower >> 14) & 0x3ff;
672672   UINT32 link = (lower >> 24) | ((upper & 0x7ff) << 8);
673673   UINT32 data = (upper >> 11);
674   UINT32 *src = (UINT32 *)get_jaguar_memory(data << 3);
674   UINT32 *src = (UINT32 *)get_jaguar_memory(machine, data << 3);
675675
676676   /* third phrase */
677677   UINT32 lower3 = objdata[5];
r3957r3958
824824      objdata[5] = (lower3 & ~0xff0000) | ((remainder & 0xff) << 16);
825825   }
826826
827   return (UINT32 *)get_jaguar_memory(link << 3);
827   return (UINT32 *)get_jaguar_memory(machine, link << 3);
828828}
829829
830830
r3957r3958
835835 *
836836 *************************************/
837837
838static UINT32 *process_branch(UINT32 *objdata, int vc, int logit)
838static UINT32 *process_branch(running_machine *machine, UINT32 *objdata, int vc, int logit)
839839{
840840   UINT32 upper = objdata[0];
841841   UINT32 lower = objdata[1];
r3957r3958
889889   }
890890
891891   /* handle the branch */
892   return taken ? (UINT32 *)get_jaguar_memory(link << 3) : (objdata + 2);
892   return taken ? (UINT32 *)get_jaguar_memory(machine, link << 3) : (objdata + 2);
893893}
894894
895895
r3957r3958
915915   logit = LOG_OBJECTS;
916916
917917   /* fetch the object pointer */
918   objdata = (UINT32 *)get_jaguar_memory((gpu_regs[OLP_H] << 16) | gpu_regs[OLP_L]);
918   objdata = (UINT32 *)get_jaguar_memory(machine, (gpu_regs[OLP_H] << 16) | gpu_regs[OLP_L]);
919919   while (!done && objdata && count++ < 100)
920920   {
921921      /* the low 3 bits determine the command */
r3957r3958
925925         case 0:
926926            if (logit)
927927               logerror("bitmap = %08X-%08X %08X-%08X\n", objdata[0], objdata[1], objdata[2], objdata[3]);
928            objdata = process_bitmap(objdata, vc, logit);
928            objdata = process_bitmap(machine, objdata, vc, logit);
929929            break;
930930
931931         /* scaled bitmap object */
932932         case 1:
933933            if (logit)
934934               logerror("scaled = %08X-%08X %08X-%08X %08X-%08X\n", objdata[0], objdata[1], objdata[2], objdata[3], objdata[4], objdata[5]);
935            objdata = process_scaled_bitmap(objdata, vc, logit);
935            objdata = process_scaled_bitmap(machine, objdata, vc, logit);
936936            break;
937937
938938         /* branch */
939939         case 3:
940940            if (logit)
941941               logerror("branch = %08X-%08X\n", objdata[0], objdata[1]);
942            objdata = process_branch(objdata, vc, logit);
942            objdata = process_branch(machine, objdata, vc, logit);
943943            break;
944944
945945         /* stop */
src/mame/video/taitojc.c
r3957r3958
198198
199199   taitojc_char_dirty = 1;
200200
201   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
201   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
202202   add_exit_callback(machine, taitojc_exit);
203203
204204    /* find first empty slot to decode gfx */
src/mame/video/pitnrun.c
r3957r3958
202202      flipy = (spriteram[offs+1]&0x80)>>7;
203203      flipx = (spriteram[offs+1]&0x40)>>6;
204204
205      if (flip_screen_x_get())
205      if (flip_screen_x_get(machine))
206206      {
207207         sx = 256 - sx;
208208         flipx = !flipx;
209209      }
210      if (flip_screen_y_get())
210      if (flip_screen_y_get(machine))
211211      {
212212         sy = 240 - sy;
213213         flipy = !flipy;
r3957r3958
257257      dx=128-pitnrun_h_heed+((pitnrun_ha&8)<<5)+3;
258258      dy=128-pitnrun_v_heed+((pitnrun_ha&0x10)<<4);
259259
260      if (flip_screen_x_get())
260      if (flip_screen_x_get(screen->machine))
261261         dx=128-dx+16;
262262
263      if (flip_screen_y_get())
263      if (flip_screen_y_get(screen->machine))
264264         dy=128-dy;
265265
266266      myclip.min_x=dx;
r3957r3958
281281   draw_sprites(screen->machine,bitmap,&myclip);
282282
283283   if(pitnrun_ha&4)
284      copybitmap_trans(bitmap,tmp_bitmap[pitnrun_ha&3],flip_screen_x_get(),flip_screen_y_get(),dx,dy,&myclip, 1);
284      copybitmap_trans(bitmap,tmp_bitmap[pitnrun_ha&3],flip_screen_x_get(screen->machine),flip_screen_y_get(screen->machine),dx,dy,&myclip, 1);
285285   tilemap_draw(bitmap,cliprect,fg, 0,0);
286286   return 0;
287287}
src/mame/video/midzeus2.c
r3957r3958
268268   waveram[1] = auto_malloc(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 12);
269269
270270   /* initialize polygon engine */
271   poly = poly_alloc(10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
271   poly = poly_alloc(machine, 10000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
272272
273273   /* we need to cleanup on exit */
274274   add_exit_callback(machine, exit_handler);
src/mame/video/tehkanwc.c
r3957r3958
4949
5050WRITE8_HANDLER( tehkanwc_flipscreen_x_w )
5151{
52   flip_screen_x_set(data & 0x40);
52   flip_screen_x_set(space->machine, data & 0x40);
5353}
5454
5555WRITE8_HANDLER( tehkanwc_flipscreen_y_w )
5656{
57   flip_screen_y_set(data & 0x40);
57   flip_screen_y_set(space->machine, data & 0x40);
5858}
5959
6060WRITE8_HANDLER( gridiron_led0_w )
r3957r3958
139139      int sx = spriteram[offs + 2] + ((attr & 0x20) << 3) - 128;
140140      int sy = spriteram[offs + 3];
141141
142      if (flip_screen_x_get())
142      if (flip_screen_x_get(machine))
143143      {
144144         sx = 240 - sx;
145145         flipx = !flipx;
146146      }
147147
148      if (flip_screen_y_get())
148      if (flip_screen_y_get(machine))
149149      {
150150         sy = 240 - sy;
151151         flipy = !flipy;
src/mame/video/bionicc.c
r3957r3958
177177{
178178   if (ACCESSING_BITS_8_15)
179179   {
180      flip_screen_set(data & 0x0100);
180      flip_screen_set(space->machine, data & 0x0100);
181181
182182      tilemap_set_enable(bg_tilemap,data & 0x2000);   /* guess */
183183      tilemap_set_enable(fg_tilemap,data & 0x1000);   /* guess */
r3957r3958
211211         int sx = (INT16)buffered_spriteram16[offs+3];   /* signed */
212212         int sy = (INT16)buffered_spriteram16[offs+2];   /* signed */
213213         if(sy>512-16) sy-=512;
214         if (flip_screen_get())
214         if (flip_screen_get(machine))
215215         {
216216            sx = 240 - sx;
217217            sy = 240 - sy;
src/mame/video/citycon.c
r3957r3958
9999
100100   /* bit 0 flips screen */
101101   /* it is also used to multiplex player 1 and player 2 controls */
102   flip_screen_set(data & 0x01);
102   flip_screen_set(space->machine, data & 0x01);
103103
104104   /* bits 1-3 are unknown */
105105//  if ((data & 0x0e) != 0) logerror("background register = %02x\n",data);
r3957r3958
119119      sx = spriteram[offs + 3];
120120      sy = 239 - spriteram[offs];
121121      flipx = ~spriteram[offs + 2] & 0x10;
122      if (flip_screen_get())
122      if (flip_screen_get(machine))
123123      {
124124         sx = 240 - sx;
125125         sy = 238 - sy;
r3957r3958
129129      drawgfx(bitmap,machine->gfx[spriteram[offs + 1] & 0x80 ? 2 : 1],
130130            spriteram[offs + 1] & 0x7f,
131131            spriteram[offs + 2] & 0x0f,
132            flipx,flip_screen_get(),
132            flipx,flip_screen_get(machine),
133133            sx,sy,
134134            cliprect,TRANSPARENCY_PEN,0);
135135   }
src/mame/video/psikyo.c
r3957r3958
359359      zoomy = 32 - zoomy;
360360
361361
362      if (flip_screen_get())
362      if (flip_screen_get(machine))
363363      {
364364         x = width  - x - (nx * zoomx)/2;
365365         y = height - y - (ny * zoomy)/2;
r3957r3958
434434
435435   tilemap *tmptilemap0, *tmptilemap1;
436436
437   flip_screen_set(~input_port_read(screen->machine, "DSW") & 0x00010000);      // hardwired to a DSW bit
437   flip_screen_set(screen->machine, ~input_port_read(screen->machine, "DSW") & 0x00010000);      // hardwired to a DSW bit
438438
439439   /* Layers enable (not quite right) */
440440
src/mame/video/esd16.c
r3957r3958
130130   esd16_tilemap0_color = data & 3;
131131   tilemap_mark_all_tiles_dirty(esdtilemap_0);
132132
133   flip_screen_set(data & 0x80);
133   flip_screen_set(space->machine, data & 0x80);
134134}
135135
136136
r3957r3958
233233      sy    =   0x100 - ((sy & 0xff)  - (sy & 0x100));
234234      sy   -=   dimy*16;
235235
236      if (flip_screen_get())
236      if (flip_screen_get(machine))
237237      {   flipx = !flipx;      sx = max_x - sx -    1 * 16 + 2;   // small offset
238238         flipy = !flipy;      sy = max_y - sy - dimy * 16;   }
239239
r3957r3958
292292
293293      sy = 0x1ff-sy;
294294
295      if (flip_screen_get())
295      if (flip_screen_get(machine))
296296      {   flipx = !flipx;      sx = max_x - sx -    1 * 16 + 2;   // small offset
297297         flipy = !flipy;      sy = max_y - sy - dimy * 16;   }
298298
src/mame/video/model3.c
r3957r3958
166166{
167167   int width, height;
168168
169   poly = poly_alloc(4000, sizeof(poly_extra_data), 0);
169   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
170170   add_exit_callback(machine, model3_exit);
171171
172172   width = video_screen_get_width(machine->primary_screen);
src/mame/video/sbasketb.c
r3957r3958
112112
113113WRITE8_HANDLER( sbasketb_flipscreen_w )
114114{
115   if (flip_screen_get() != data)
115   if (flip_screen_get(space->machine) != data)
116116   {
117      flip_screen_set(data);
117      flip_screen_set(space->machine, data);
118118      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
119119   }
120120}
r3957r3958
152152         int flipx =  spriteram[offs + 1] & 0x40;
153153         int flipy =  spriteram[offs + 1] & 0x80;
154154
155         if (flip_screen_get())
155         if (flip_screen_get(machine))
156156         {
157157            sx = 240 - sx;
158158            sy = 240 - sy;
src/mame/video/cchasm.c
r3957r3958
7979        case LENGTH:
8080            if (move)
8181            {
82                vector_add_point (currentx, currenty, 0, 0);
82                vector_add_point (machine, currentx, currenty, 0, 0);
8383                move = 0;
8484            }
8585
r3957r3958
8989            total_length += abs(data);
9090
9191            if (color)
92                vector_add_point (currentx, currenty, color, 0xff);
92                vector_add_point (machine, currentx, currenty, color, 0xff);
9393            else
9494                move = 1;
9595            break;
src/mame/video/funkyjet.c
r3957r3958
5353         inc = 1;
5454      }
5555
56      if (flip_screen_get())
56      if (flip_screen_get(machine))
5757      {
5858         y=240-y;
5959         x=304-x;
r3957r3958
7979
8080VIDEO_UPDATE( funkyjet )
8181{
82   flip_screen_set( deco16_pf12_control[0]&0x80 );
82   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
8383   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
8484
8585   bitmap_fill(bitmap,cliprect,768);
src/mame/video/qix.c
r3957r3958
430430static const mc6845_interface mc6845_intf =
431431{
432432   "main",               /* screen we are acting on */
433   QIX_CHARACTER_CLOCK,    /* the clock (pin 21) of the chip */
434433   8,                  /* number of pixels per video memory address */
435434   begin_update,         /* before pixel update callback */
436435   update_row,            /* row update callback */
r3957r3958
455454   MDRV_VIDEO_START(qix)
456455   MDRV_VIDEO_UPDATE(qix)
457456
458   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
459   MDRV_DEVICE_CONFIG(mc6845_intf)
457   MDRV_MC6845_ADD(MC6845_TAG, MC6845, QIX_CHARACTER_CLOCK, mc6845_intf)
460458
461459   MDRV_SCREEN_ADD("main", RASTER)
462460   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
src/mame/video/ironhors.c
r3957r3958
124124
125125WRITE8_HANDLER( ironhors_flipscreen_w )
126126{
127   if (flip_screen_get() != (~data & 0x08))
127   if (flip_screen_get(space->machine) != (~data & 0x08))
128128   {
129      flip_screen_set(~data & 0x08);
129      flip_screen_set(space->machine, ~data & 0x08);
130130      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
131131   }
132132
r3957r3958
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 * palettebank;
173   //  int mod = flip_screen_get() ? -8 : 8;
173   //  int mod = flip_screen_get(machine) ? -8 : 8;
174174
175      if (flip_screen_get())
175      if (flip_screen_get(machine))
176176      {
177177         sx = 240 - sx;
178178         sy = 240 - sy;
r3957r3958
193193
194194         case 0x04:   /* 16x8 */
195195            {
196               if (flip_screen_get()) sy += 8; // this fixes the train wheels' position
196               if (flip_screen_get(machine)) sy += 8; // this fixes the train wheels' position
197197
198198               drawgfx(bitmap,machine->gfx[2],
199199                     code & ~1,
src/mame/video/battlex.c
r3957r3958
6060
6161   /* bit 7 is flip screen */
6262
63   if (flip_screen_get() != (data & 0x80))
63   if (flip_screen_get(space->machine) != (data & 0x80))
6464   {
65      flip_screen_set(data & 0x80);
65      flip_screen_set(space->machine, data & 0x80);
6666      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
6767   }
6868}
r3957r3958
9696      int flipy = source[1] & 0x80;
9797      int flipx = source[1] & 0x40;
9898
99      if (flip_screen_get())
99      if (flip_screen_get(machine))
100100      {
101101         sx = 240 - sx;
102102         sy = 240 - sy;
src/mame/video/cinemat.c
r3957r3958
6363
6464   /* move to the starting position if we're not there already */
6565   if (sx != lastx || sy != lasty)
66      vector_add_point(sx << 16, sy << 16, 0, 0);
66      vector_add_point(device->machine, sx << 16, sy << 16, 0, 0);
6767
6868   /* draw the vector */
69   vector_add_point(ex << 16, ey << 16, vector_color, intensity);
69   vector_add_point(device->machine, ex << 16, ey << 16, vector_color, intensity);
7070
7171   /* remember the last point */
7272   lastx = ex;
src/mame/video/mjkjidai.c
r3957r3958
5959   interrupt_enable_w(space,0,data & 1);
6060
6161   /* bit 1 = flip screen */
62   flip_screen_set(data & 0x02);
62   flip_screen_set(space->machine, data & 0x02);
6363
6464   /* bit 2 =display enable */
6565   display_enable = data & 0x04;
r3957r3958
104104
105105      sx += (spriteram_2[offs] & 0x20) >> 5;   // not sure about this
106106
107      if (flip_screen_get())
107      if (flip_screen_get(machine))
108108      {
109109         sx = 496 - sx;
110110         sy = 240 - sy;
src/mame/video/jailbrek.c
r3957r3958
8080      int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
8181      int sy = spriteram[i + 3];
8282
83      if (flip_screen_get())
83      if (flip_screen_get(machine))
8484      {
8585         sx = 240 - sx;
8686         sy = 240 - sy;
src/mame/video/bankp.c
r3957r3958
127127   interrupt_enable_w(space,0,(data & 0x10)>>4);
128128
129129   /* bit 5 controls screen flip */
130   flip_screen_set(data & 0x20);
130   flip_screen_set(space->machine, data & 0x20);
131131
132132   /* bits 6-7 unknown */
133133}
r3957r3958
166166
167167VIDEO_UPDATE( bankp )
168168{
169   if (flip_screen_get())
169   if (flip_screen_get(screen->machine))
170170   {
171171      tilemap_set_scrollx(fg_tilemap, 0, -scroll_x);
172172      tilemap_set_scrollx(bg_tilemap, 0, 0);
src/mame/video/pastelg.c
r3957r3958
9595   }
9696}
9797
98
99WRITE8_HANDLER( threeds_romsel_w )
100{
101   if (data&0xfc) printf("%02x\n",data);
102   pastelg_gfxrom = (data & 0x3);
103}
104
105
98106WRITE8_HANDLER( pastelg_romsel_w )
99107{
100108   int gfxlen = memory_region_length(space->machine, "gfx1");
r3957r3958
153161   int dx, dy;
154162   int startx, starty;
155163   int sizex, sizey;
156   int skipx, skipy;
164   int incx, incy;
157165   int ctrx, ctry;
158166   int readflag;
159167   int gfxaddr, gfxlen;
168   int count;
160169   UINT8 color;
161170
162171   nb1413m3_busyctr = 0;
r3957r3958
164173   startx = blitter_destx + blitter_sizex;
165174   starty = blitter_desty + blitter_sizey;
166175
176
167177   if (blitter_direction_x)
168178   {
169      sizex = blitter_sizex ^ 0xff;
170      skipx = 1;
179      if (blitter_sizex&0x80) sizex = 0xff-blitter_sizex;
180      else sizex=blitter_sizex;
181      incx = 1;
171182   }
172183   else
173184   {
174185      sizex = blitter_sizex;
175      skipx = -1;
186      incx = -1;
176187   }
177188
178189   if (blitter_direction_y)
179190   {
180      sizey = blitter_sizey ^ 0xff;
181      skipy = 1;
191      if (blitter_sizey&0x80) sizey = 0xff-blitter_sizey;
192      else sizey=blitter_sizey;
193      incy = 1;
182194   }
183195   else
184196   {
185197      sizey = blitter_sizey;
186      skipy = -1;
198      incy = -1;
187199   }
188200
189201   gfxlen = memory_region_length(machine, "gfx1");
r3957r3958
191203
192204   readflag = 0;
193205
194   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
206   count = 0;
207   y = starty;
208
209   for (ctry = sizey; ctry >= 0; ctry--)
195210   {
196      for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--)
211      x = startx;
212
213      for (ctrx = sizex; ctrx >= 0; ctrx--)
197214      {
215         gfxaddr = (pastelg_gfxrom << 16) + ((blitter_src_addr + count));
216
198217         if ((gfxaddr > (gfxlen - 1)))
199218         {
200219#ifdef MAME_DEBUG
r3957r3958
223242         {
224243            // 2nd, 4th, 6th, ... read
225244            color = (color & 0xf0) >> 4;
226            gfxaddr++;
245            count++;
227246         }
228247
229248         readflag ^= 1;
r3957r3958
243262         }
244263
245264         nb1413m3_busyctr++;
265         x += incx;
246266      }
267
268      y += incy;
247269   }
248270
249271   nb1413m3_busyflag = 0;
src/mame/video/crbaloon.c
r3957r3958
108108   UINT8 *gfx = memory_region(machine, "gfx2") + (code << 7);
109109
110110
111   if (flip_screen_get())
111   if (flip_screen_get(machine))
112112      sy += 32;
113113
114114   /* assume no collision */
src/mame/video/bosco.c
r3957r3958
222222      int flipx = spriteram[offs] & 1;
223223      int flipy = spriteram[offs] & 2;
224224      int color = spriteram_2[offs + 1] & 0x3f;
225      if (flip_screen_get()) sx += 32-2;
225      if (flip_screen_get(machine)) sx += 32-2;
226226
227227      drawgfx(bitmap,machine->gfx[1],
228228            (spriteram[offs] & 0xfc) >> 2,
r3957r3958
245245
246246      x = bosco_radarx[offs] + ((~bosco_radarattr[offs] & 0x01) << 8);
247247      y = 253 - bosco_radary[offs];
248      if (flip_screen_get()) x -= 3;
248      if (flip_screen_get(machine)) x -= 3;
249249
250250      drawgfx(bitmap,machine->gfx[2],
251251            ((bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07,
r3957r3958
257257}
258258
259259
260static void draw_stars(bitmap_t *bitmap, const rectangle *cliprect)
260static void draw_stars(bitmap_t *bitmap, const rectangle *cliprect, int flip)
261261{
262262   if (1)
263263   {
r3957r3958
280280            /* dont draw the stars that are off the screen */
281281            if ( x < 224 && y < 224 )
282282            {
283               if (flip_screen_get()) x += 64;
283               if (flip) x += 64;
284284
285285               if (y >= cliprect->min_y && y <= cliprect->max_y)
286286                  *BITMAP_ADDR16(bitmap, y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col;
r3957r3958
297297       the screen, and clip it to only the position where it is supposed to be shown */
298298   rectangle fg_clip = *cliprect;
299299   rectangle bg_clip = *cliprect;
300   if (flip_screen_get())
300   if (flip_screen_get(screen->machine))
301301   {
302302      bg_clip.min_x = 8*8;
303303      fg_clip.max_x = 8*8-1;
r3957r3958
309309   }
310310
311311   bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
312   draw_stars(bitmap,cliprect);
312   draw_stars(bitmap,cliprect,flip_screen_get(screen->machine));
313313
314314   tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
315315   tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
src/mame/video/funkybee.c
r3957r3958
6565
6666WRITE8_HANDLER( funkybee_scroll_w )
6767{
68   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get() ? -data : data);
68   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get(space->machine) ? -data : data);
6969}
7070
7171WRITE8_HANDLER( funkybee_flipscreen_w )
7272{
73   flip_screen_set(data & 0x01);
73   flip_screen_set(space->machine, data & 0x01);
7474}
7575
7676static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
107107      int sx = videoram[offs2 + 0x10];
108108      int sy = 224 - colorram[offs2];
109109
110      if (flip_screen_get())
110      if (flip_screen_get(machine))
111111      {
112112         sy += 32;
113113         flipx = !flipx;
r3957r3958
127127
128128   for (offs = 0x1f;offs >= 0;offs--)
129129   {
130      int const flip = flip_screen_get();
130      int const flip = flip_screen_get(machine);
131131      int code = videoram[0x1c00 + offs];
132132      int color = colorram[0x1f10] & 0x03;
133133      int sx = flip ? videoram[0x1f1f] : videoram[0x1f10];
src/mame/video/galastrm.c
r3957r3958
5353   tmpbitmaps = video_screen_auto_bitmap_alloc(machine->primary_screen);
5454   polybitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
5555
56   poly = poly_alloc(16, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
56   poly = poly_alloc(machine, 16, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
5757   add_exit_callback(machine, galastrm_exit);
5858}
5959
src/mame/video/lastduel.c
r3957r3958
128128{
129129   if (ACCESSING_BITS_0_7)
130130   {
131      flip_screen_set(data & 0x01);
131      flip_screen_set(space->machine, data & 0x01);
132132
133133      coin_lockout_w(0,~data & 0x10);
134134      coin_lockout_w(1,~data & 0x20);
r3957r3958
234234      flipy = attr & sprite_flipy_mask;   /* 0x40 for lastduel, 0x80 for madgear */
235235      color = attr & 0x0f;
236236
237      if (flip_screen_get())
237      if (flip_screen_get(machine))
238238      {
239239         sx = 496 - sx;
240240         sy = 240 - sy;
src/mame/video/freekick.c
r3957r3958
4444      int flipy = 0;
4545      int color = spriteram[offs + 1] & 0x1f;
4646
47      if (flip_screen_x_get())
47      if (flip_screen_x_get(machine))
4848      {
4949         xpos = 240 - xpos;
5050         flipx = !flipx;
5151      }
52      if (flip_screen_y_get())
52      if (flip_screen_y_get(machine))
5353      {
5454         ypos = 256 - ypos;
5555         flipy = !flipy;
r3957r3958
7979      int flipy = 0;//spriteram[offs + 0] & 0x40;
8080      int color = spriteram[offs + 1] & 0x0f;
8181
82      if (flip_screen_x_get())
82      if (flip_screen_x_get(machine))
8383      {
8484         xpos = 240 - xpos;
8585         flipx = !flipx;
8686      }
87      if (flip_screen_y_get())
87      if (flip_screen_y_get(machine))
8888      {
8989         ypos = 256 - ypos;
9090         flipy = !flipy;
r3957r3958
115115      int flipy = spriteram[offs + 2] & 0x40;
116116      int color = spriteram[offs + 2] & 0x1f;
117117
118      if (flip_screen_x_get())
118      if (flip_screen_x_get(machine))
119119      {
120120         xpos = 240 - xpos;
121121         flipx = !flipx;
122122      }
123      if (flip_screen_y_get())
123      if (flip_screen_y_get(machine))
124124      {
125125         ypos = 256 - ypos;
126126         flipy = !flipy;
src/mame/video/namcos22.c
r3957r3958
3434*/
3535
3636#include "driver.h"
37#include "deprecat.h"
3837#include "eminline.h"
3938#include "video/rgbutil.h"
4039#include "namcos22.h"
r3957r3958
174173} /* Clamp256 */
175174
176175#ifdef MAME_DEBUG
177static void Dump( FILE *f, unsigned addr1, unsigned addr2, const char *name );
176static void Dump( const address_space *space, FILE *f, unsigned addr1, unsigned addr2, const char *name );
178177#endif
179178
180179static struct
r3957r3958
253252{
254253   rgbint fogColor;
255254   rgbint fadeColor;
256   int color;
255   const pen_t *pens;
257256   int bn;
258257   UINT16 flags;
259258   int cmode;
r3957r3958
280279   bitmap_t *bitmap = dest;
281280   const poly_extra_data *extra = extradata;
282281   int bn = extra->bn * 0x1000;
283   const pen_t *pens = &Machine->pens[(extra->color&0x7f)<<8];
282   const pen_t *pens = extra->pens;
284283   int fogFactor = 0xff - extra->fogFactor;
285284   int fadeFactor = 0xff - extra->fadeFactor;
286285   int transFactor = 0xff;
r3957r3958
437436
438437   extra = poly_get_extra_data(poly);
439438
440   extra->color = color;
439   extra->pens = &machine->pens[(color&0x7f)<<8];
441440   extra->bn = textureBank;
442441   extra->flags = flags;
443442   extra->cmode = cmode;
r3957r3958
491490   int dx = extent->param[0].dpdx * 65536.0f;
492491   const poly_extra_data *extra = extradata;
493492   bitmap_t *destmap = destbase;
494   const pen_t *pal = &Machine->pens[extra->color];
493   const pen_t *pal = extra->pens;
495494   int prioverchar = extra->prioverchar;
496495   int z = extra->z;
497496   int alpha = extra->alpha;
r3957r3958
597596      extra->alpha = alpha;
598597      extra->prioverchar = prioverchar;
599598      extra->line_modulo = gfx->line_modulo;
600      extra->color = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
599      extra->pens = &gfx->machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
601600      extra->source = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
602601#ifdef RENDER_AS_QUADS
603602      poly_render_quad_fan(poly, dest_bmp, clip, renderscanline_sprite, 2, 4, &vert[0]);
r3957r3958
608607} /* mydrawgfxzoom */
609608
610609static void
611ApplyGamma( bitmap_t *bitmap )
610ApplyGamma( running_machine *machine, bitmap_t *bitmap )
612611{
613612   int x,y;
614613   if( mbSuperSystem22 )
r3957r3958
636635   }
637636   else
638637   { /* system 22 */
639      const UINT8 *rlut = 0x000+(const UINT8 *)memory_region(Machine, "user1");
638      const UINT8 *rlut = 0x000+(const UINT8 *)memory_region(machine, "user1");
640639      const UINT8 *glut = 0x100+rlut;
641640      const UINT8 *blut = 0x200+rlut;
642641      for( y=0; y<bitmap->height; y++ )
r3957r3958
22462245   mpPolyH = mpPolyM + mPtRomSize;
22472246
22482247#ifdef RENDER_AS_QUADS
2249   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
2248   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
22502249#else
2251   poly = poly_alloc(4000, sizeof(poly_extra_data), 0);
2250   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
22522251#endif
22532252   add_reset_callback(machine, namcos22_reset);
22542253   add_exit_callback(machine, namcos22_exit);
r3957r3958
22752274   UINT32 bgColor;
22762275   UpdateVideoMixer();
22772276   bgColor = (mixer.rBackColor<<16)|(mixer.gBackColor<<8)|mixer.bBackColor;
2278   bitmap_fill( bitmap, cliprect , bgColor);
2279   UpdatePaletteS(screen->machine);
2280   DrawCharacterLayer(screen->machine, bitmap, cliprect );
2277   bitmap_fill( bitmap, cliprect , bgColor);
2278   UpdatePaletteS(screen->machine);
2279   DrawCharacterLayer(screen->machine, bitmap, cliprect );
22812280   DrawPolygons( bitmap );
2282   DrawSprites( bitmap, cliprect );
2283   RenderScene(screen->machine, bitmap );
2281   DrawSprites( bitmap, cliprect );
2282   RenderScene(screen->machine, bitmap );
22842283   DrawTranslucentCharacters( bitmap, cliprect );
2285   ApplyGamma( bitmap );
2284   ApplyGamma( screen->machine, bitmap );
22862285
22872286#ifdef MAME_DEBUG
22882287   if( input_code_pressed(KEYCODE_D) )
r3957r3958
22902289      FILE *f = fopen( "dump.txt", "wb" );
22912290      if( f )
22922291      {
2292         const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2293
22932294         {
22942295            int i,bank;
22952296            for( bank=0; bank<4; bank++ )
r3957r3958
23032304            }
23042305         }
23052306
2306         Dump(f,0x810000, 0x81000f, "cz attr" );
2307         Dump(f,0x820000, 0x8202ff, "unk_ac" );
2308         Dump(f,0x824000, 0x8243ff, "gamma");
2309         Dump(f,0x828000, 0x83ffff, "palette" );
2310         Dump(f,0x8a0000, 0x8a000f, "tilemap_attr");
2311         Dump(f,0x880000, 0x89ffff, "cgram/textram");
2312         Dump(f,0x900000, 0x90ffff, "vics_data");
2313         Dump(f,0x940000, 0x94007f, "vics_control");
2314         Dump(f,0x980000, 0x9affff, "sprite374" );
2315         Dump(f,0xc00000, 0xc1ffff, "polygonram");
2307         Dump(space, f,0x810000, 0x81000f, "cz attr" );
2308         Dump(space, f,0x820000, 0x8202ff, "unk_ac" );
2309         Dump(space, f,0x824000, 0x8243ff, "gamma");
2310         Dump(space, f,0x828000, 0x83ffff, "palette" );
2311         Dump(space, f,0x8a0000, 0x8a000f, "tilemap_attr");
2312         Dump(space, f,0x880000, 0x89ffff, "cgram/textram");
2313         Dump(space, f,0x900000, 0x90ffff, "vics_data");
2314         Dump(space, f,0x940000, 0x94007f, "vics_control");
2315         Dump(space, f,0x980000, 0x9affff, "sprite374" );
2316         Dump(space, f,0xc00000, 0xc1ffff, "polygonram");
23162317         fclose( f );
23172318      }
23182319      while( input_code_pressed(KEYCODE_D) ){}
r3957r3958
23242325VIDEO_UPDATE( namcos22 )
23252326{
23262327   UpdateVideoMixer();
2327   bitmap_fill( bitmap, cliprect , get_black_pen(screen->machine));
2328   bitmap_fill( bitmap, cliprect , get_black_pen(screen->machine));
23282329   UpdatePalette(screen->machine);
23292330   DrawCharacterLayer(screen->machine, bitmap, cliprect );
2330   DrawPolygons( bitmap );
2331   RenderScene(screen->machine, bitmap);
2331   DrawPolygons( bitmap );
2332   RenderScene(screen->machine, bitmap);
23322333   DrawTranslucentCharacters( bitmap, cliprect );
2333   ApplyGamma( bitmap );
2334   ApplyGamma( screen->machine, bitmap );
23342335
23352336#ifdef MAME_DEBUG
23362337   if( input_code_pressed(KEYCODE_D) )
r3957r3958
23382339      FILE *f = fopen( "dump.txt", "wb" );
23392340      if( f )
23402341      {
2341//        Dump(f,0x90000000, 0x90000003, "led?" );
2342//         Dump(f,0x90010000, 0x90017fff, "cz_ram");
2343//         Dump(f,0x900a0000, 0x900a000f, "tilemap_attr");
2344         Dump(f,0x90020000, 0x90027fff, "gamma");
2345             //   0x90020000, 0x90027fff
2346//         Dump(f,0x70000000, 0x7001ffff, "polygonram");
2342         const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2343
2344//         Dump(space, f,0x90000000, 0x90000003, "led?" );
2345//         Dump(space, f,0x90010000, 0x90017fff, "cz_ram");
2346//         Dump(space, f,0x900a0000, 0x900a000f, "tilemap_attr");
2347         Dump(space, f,0x90020000, 0x90027fff, "gamma");
2348//         Dump(space, f,0x70000000, 0x7001ffff, "polygonram");
23472349         fclose( f );
23482350      }
23492351      while( input_code_pressed(KEYCODE_D) ){}
r3957r3958
24092411
24102412#ifdef MAME_DEBUG
24112413static void
2412Dump( FILE *f, unsigned addr1, unsigned addr2, const char *name )
2414Dump( const address_space *space, FILE *f, unsigned addr1, unsigned addr2, const char *name )
24132415{
2414   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
24152416   unsigned addr;
24162417   fprintf( f, "%s:\n", name );
24172418   for( addr=addr1; addr<=addr2; addr+=16 )
src/mame/video/redclash.c
r3957r3958
119119
120120WRITE8_HANDLER( redclash_flipscreen_w )
121121{
122   flip_screen_set(data & 0x01);
122   flip_screen_set(space->machine, data & 0x01);
123123}
124124
125125void redclash_set_stars_enable( UINT8 on ); //temp
r3957r3958
260260   }
261261}
262262
263static void draw_bullets(bitmap_t *bitmap, const rectangle *cliprect )
263static void draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
264264{
265265   int offs;
266266
r3957r3958
270270      int sx = 8 * offs + (videoram[offs] & 0x07);   /* ?? */
271271      int sy = 0xff - videoram[offs + 0x20];
272272
273      if (flip_screen_get())
273      if (flip_screen_get(machine))
274274      {
275275         sx = 240 - sx;
276276      }
r3957r3958
424424   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
425425   redclash_draw_stars(bitmap, cliprect, 0x60, 0, 0x00, 0xff);
426426   draw_sprites(screen->machine, bitmap, cliprect);
427   draw_bullets(bitmap, cliprect);
427   draw_bullets(screen->machine, bitmap, cliprect);
428428   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
429429   return 0;
430430}
src/mame/video/rockola.c
r3957r3958
140140
141141   /* bit 7 flips screen */
142142
143   if (flip_screen_get() != (data & 0x80))
143   if (flip_screen_get(space->machine) != (data & 0x80))
144144   {
145      flip_screen_set(data & 0x80);
145      flip_screen_set(space->machine, data & 0x80);
146146      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
147147   }
148148}
r3957r3958
248248{
249249   /* bit 0 flips screen */
250250
251   if (flip_screen_get() != (data & 0x01))
251   if (flip_screen_get(space->machine) != (data & 0x01))
252252   {
253      flip_screen_set(data & 0x01);
253      flip_screen_set(space->machine, data & 0x01);
254254      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
255255   }
256256
src/mame/video/galaxold.c
r3957r3958
12451245{
12461246   int i, color;
12471247
1248   if (flip_screen_x_get())  x++;
1248   if (flip_screen_x_get(machine))  x++;
12491249
12501250   x = x - 6;
12511251
r3957r3958
14161416   int col1 = base + dambustr_bg_color_1;
14171417   int col2 = base + dambustr_bg_color_2;
14181418
1419   if (flip_screen_x_get())
1419   if (flip_screen_x_get(machine))
14201420   {
14211421      plot_box(bitmap,   0, 0, 256-dambustr_bg_split_line, 256, col2);
14221422      plot_box(bitmap, 256-dambustr_bg_split_line, 0, dambustr_bg_split_line, 256, col1);
r3957r3958
14291429
14301430}
14311431
1432static void dambustr_draw_upper_background(bitmap_t *bitmap, const rectangle *cliprect)
1432static void dambustr_draw_upper_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
14331433{
14341434   static rectangle clip = { 0, 0, 0, 0 };
14351435
1436   if (flip_screen_x_get())
1436   if (flip_screen_x_get(machine))
14371437   {
14381438      clip.min_x = 254 - dambustr_bg_split_line;
14391439      clip.max_x = dambustr_bg_split_line;
r3957r3958
18921892   if (dambustr_bg_priority)
18931893   {
18941894      /* draw the upper part of the background, as it has priority */
1895      dambustr_draw_upper_background(bitmap, cliprect);
1895      dambustr_draw_upper_background(screen->machine, bitmap, cliprect);
18961896
18971897      /* only rows with color code > 3 are stronger than the background */
18981898      memset(dambustr_videoram2, 0x20, 0x0400);
src/mame/video/welltris.c
r3957r3958
175175         tilemap_mark_all_tiles_dirty(char_tilemap);
176176      }
177177
178      flip_screen_set(data & 0x80);
178      flip_screen_set(space->machine, data & 0x80);
179179
180180      spritepalettebank = (data & 0x20) >> 5;
181181      pixelpalettebank = (data & 0x08) >> 3;
src/mame/video/dec0.c
r3957r3958
190190         inc = 1;
191191      }
192192
193      if (flip_screen_get()) {
193      if (flip_screen_get(machine)) {
194194         y=240-y;
195195         x=240-x;
196196         if (fx) fx=0; else fx=1;
r3957r3958
215215
216216/******************************************************************************/
217217
218static void custom_tilemap_draw(bitmap_t *bitmap,
218static void custom_tilemap_draw(running_machine *machine,
219                        bitmap_t *bitmap,
219220                        const rectangle *cliprect,
220221                        tilemap *tilemap_ptr,
221222                        const UINT16 *rowscroll_ptr,
r3957r3958
255256    doesn't affect any games.
256257    */
257258
258   if (flip_screen_get())
259   if (flip_screen_get(machine))
259260      src_y = (src_bitmap->height - 256) - scrolly;
260261   else
261262      src_y = scrolly;
r3957r3958
266267      else
267268         src_x=scrollx;
268269
269      if (flip_screen_get())
270      if (flip_screen_get(machine))
270271         src_x=(src_bitmap->width - 256) - src_x;
271272
272273      for (x=0; x<=cliprect->max_x; x++) {
r3957r3958
294295
295296/******************************************************************************/
296297
297static void dec0_pf1_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
298static void dec0_pf1_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
298299{
299300   switch (dec0_pf1_control_0[3]&0x3) {
300301      case 0:   /* 4x1 */
301         custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_0,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
302         custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_0,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
302303         break;
303304      case 1:   /* 2x2 */
304305      default:
305         custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_1,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
306         custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_1,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
306307         break;
307308      case 2:   /* 1x4 */
308         custom_tilemap_draw(bitmap,cliprect,pf1_tilemap_2,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
309         custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_2,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
309310         break;
310311   };
311312}
312313
313static void dec0_pf2_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
314static void dec0_pf2_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
314315{
315316   switch (dec0_pf2_control_0[3]&0x3) {
316317      case 0:   /* 4x1 */
317         custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_0,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
318         custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_0,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
318319         break;
319320      case 1:   /* 2x2 */
320321      default:
321         custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_1,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
322         custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_1,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
322323         break;
323324      case 2:   /* 1x4 */
324         custom_tilemap_draw(bitmap,cliprect,pf2_tilemap_2,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
325         custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_2,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
325326         break;
326327   };
327328}
328329
329static void dec0_pf3_draw(bitmap_t *bitmap,const rectangle *cliprect,int flags)
330static void dec0_pf3_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
330331{
331332   switch (dec0_pf3_control_0[3]&0x3) {
332333      case 0:   /* 4x1 */
333         custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_0,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
334         custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_0,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
334335         break;
335336      case 1:   /* 2x2 */
336337      default:
337         custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_1,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
338         custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_1,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
338339         break;
339340      case 2:   /* 1x4 */
340         custom_tilemap_draw(bitmap,cliprect,pf3_tilemap_2,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
341         custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_2,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
341342         break;
342343   };
343344}
r3957r3958
346347
347348VIDEO_UPDATE( hbarrel )
348349{
349   flip_screen_set(dec0_pf1_control_0[0]&0x80);
350   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
350351
351   dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
352   dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
352353   draw_sprites(screen->machine,bitmap,cliprect,0x08,0x08);
353   dec0_pf2_draw(bitmap,cliprect,0);
354   dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
354355
355356   /* HB always keeps pf2 on top of pf3, no need explicitly support priority register */
356357
357358   draw_sprites(screen->machine,bitmap,cliprect,0x08,0x00);
358   dec0_pf1_draw(bitmap,cliprect,0);
359   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
359360   return 0;
360361}
361362
r3957r3958
363364
364365VIDEO_UPDATE( baddudes )
365366{
366   flip_screen_set(dec0_pf1_control_0[0]&0x80);
367   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
367368
368369   /* WARNING: inverted wrt Midnight Resistance */
369370   if ((dec0_pri & 0x01) == 0)
370371   {
371      dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
372      dec0_pf3_draw(bitmap,cliprect,0);
372      dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
373      dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
373374
374375      if (dec0_pri & 2)
375         dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
376         dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
376377
377378      draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
378379
379380      if (dec0_pri & 4)
380         dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
381         dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
381382   }
382383   else
383384   {
384      dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
385      dec0_pf2_draw(bitmap,cliprect,0);
385      dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
386      dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
386387
387388      if (dec0_pri & 2)
388         dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
389         dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
389390
390391      draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
391392
392393      if (dec0_pri & 4)
393         dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
394         dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
394395   }
395396
396   dec0_pf1_draw(bitmap,cliprect,0);
397   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
397398   return 0;
398399}
399400
r3957r3958
403404{
404405   int trans;
405406
406   flip_screen_set(dec0_pf1_control_0[0]&0x80);
407   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
407408
408409   if (dec0_pri & 0x04)
409410      trans = 0x08;
r3957r3958
416417      /* Robocop uses it only for the title screen, so this might be just */
417418      /* completely wrong. The top 8 bits of the register might mean */
418419      /* something (they are 0x80 in midres, 0x00 here) */
419      dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER1|TILEMAP_DRAW_OPAQUE);
420      dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER1|TILEMAP_DRAW_OPAQUE);
420421
421422      if (dec0_pri & 0x02)
422423         draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
423424
424      dec0_pf3_draw(bitmap,cliprect,0);
425      dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
425426   }
426427   else
427428   {
428      dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
429      dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
429430
430431      if (dec0_pri & 0x02)
431432         draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
432433
433      dec0_pf2_draw(bitmap,cliprect,0);
434      dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
434435   }
435436
436437   if (dec0_pri & 0x02)
r3957r3958
438439   else
439440      draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
440441
441   dec0_pf1_draw(bitmap,cliprect,0);
442   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
442443   return 0;
443444}
444445
r3957r3958
446447
447448VIDEO_UPDATE( birdtry )
448449{
449   flip_screen_set(dec0_pf1_control_0[0]&0x80);
450   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
450451
451452   /* This game doesn't have the extra playfield chip on the game board, but
452453    the palette does show through. */
453454   bitmap_fill(bitmap,cliprect,screen->machine->pens[768]);
454   dec0_pf2_draw(bitmap,cliprect,0);
455   dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
455456   draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
456   dec0_pf1_draw(bitmap,cliprect,0);
457   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
457458   return 0;
458459}
459460
r3957r3958
461462
462463VIDEO_UPDATE( hippodrm )
463464{
464   flip_screen_set(dec0_pf1_control_0[0]&0x80);
465   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
465466
466467   if (dec0_pri & 0x01)
467468   {
468      dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
469      dec0_pf3_draw(bitmap,cliprect,0);
469      dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
470      dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
470471   }
471472   else
472473   {
473      dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
474      dec0_pf2_draw(bitmap,cliprect,0);
474      dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
475      dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
475476   }
476477
477478   draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
478   dec0_pf1_draw(bitmap,cliprect,0);
479   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
479480   return 0;
480481}
481482
r3957r3958
483484
484485VIDEO_UPDATE( slyspy )
485486{
486   flip_screen_set(dec0_pf1_control_0[0]&0x80);
487   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
487488
488   dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
489   dec0_pf2_draw(bitmap,cliprect,0);
489   dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
490   dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
490491
491492   draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
492493
493494   /* Redraw top 8 pens of top 8 palettes over sprites */
494495   if (dec0_pri&0x80)
495      dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_LAYER0);
496      dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0);
496497
497   dec0_pf1_draw(bitmap,cliprect,0);
498   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
498499   return 0;
499500}
500501
r3957r3958
504505{
505506   int trans;
506507
507   flip_screen_set(dec0_pf1_control_0[0]&0x80);
508   flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
508509
509510   if (dec0_pri & 0x04)
510511      trans = 0x00;
r3957r3958
512513
513514   if (dec0_pri & 0x01)
514515   {
515      dec0_pf2_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
516      dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
516517
517518      if (dec0_pri & 0x02)
518519         draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
519520
520      dec0_pf3_draw(bitmap,cliprect,0);
521      dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
521522   }
522523   else
523524   {
524      dec0_pf3_draw(bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
525      dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
525526
526527      if (dec0_pri & 0x02)
527528         draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
528529
529      dec0_pf2_draw(bitmap,cliprect,0);
530      dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
530531   }
531532
532533   if (dec0_pri & 0x02)
r3957r3958
534535   else
535536      draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
536537
537   dec0_pf1_draw(bitmap,cliprect,0);
538   dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
538539   return 0;
539540}
540541
src/mame/video/cop01.c
r3957r3958
154154   {
155155      coin_counter_w(0,data & 1);
156156      coin_counter_w(1,data & 2);
157      flip_screen_set(data & 4);
157      flip_screen_set(space->machine, data & 4);
158158   }
159159}
160160
r3957r3958
185185      sx = (spriteram[offs+3] - 0x80) + 256 * (attr & 0x01);
186186      sy = 240 - spriteram[offs];
187187
188      if (flip_screen_get())
188      if (flip_screen_get(machine))
189189      {
190190         sx = 240 - sx;
191191         sy = 240 - sy;
src/mame/video/hanaawas.c
r3957r3958
7575
7676   /* dirty both current and next offsets */
7777   tilemap_mark_tile_dirty(bg_tilemap, offset);
78   tilemap_mark_tile_dirty(bg_tilemap, (offset + (flip_screen_get() ? -1 : 1)) & 0x03ff);
78   tilemap_mark_tile_dirty(bg_tilemap, (offset + (flip_screen_get(space->machine) ? -1 : 1)) & 0x03ff);
7979}
8080
8181WRITE8_HANDLER( hanaawas_portB_w )
8282{
8383   /* bit 7 is flip screen */
84   if (flip_screen_get() != (~data & 0x80))
84   if (flip_screen_get(space->machine) != (~data & 0x80))
8585   {
86      flip_screen_set(~data & 0x80);
86      flip_screen_set(space->machine, ~data & 0x80);
8787      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
8888   }
8989}
r3957r3958
9191static TILE_GET_INFO( get_bg_tile_info )
9292{
9393   /* 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() ? 1 : -1)) & 0x3ff;
94   int offset = (tile_index + (flip_screen_get(machine) ? 1 : -1)) & 0x3ff;
9595   int attr = colorram[offset];
9696   int gfxbank = (attr & 0x40) >> 6;
9797   int code = videoram[tile_index] + ((attr & 0x20) << 3);
src/mame/video/metro.c
r3957r3958
681681
682682         gfxdata      =   base_gfx + (8*8*4/8) * (((attr & 0x000f) << 16) + code);
683683
684         if (flip_screen_get())
684         if (flip_screen_get(machine))
685685         {
686686            flipx = !flipx;      x = max_x - x - width;
687687            flipy = !flipy;      y = max_y - y - height;
r3957r3958
691691         {
692692            /* prepare GfxElement on the fly */
693693            gfx_element gfx;
694            gfx.machine = machine;
694695            gfx.width = width;
695696            gfx.height = height;
696697            gfx.total_elements = 1;
r3957r3958
703704            gfx.line_modulo = width;
704705            gfx.char_modulo = 0;   /* doesn't matter */
705706            gfx.flags = 0;
707            gfx.machine = machine;
706708
707709            /* Bounds checking */
708710            if ( (gfxdata + width * height - 1) >= gfx_max )
r3957r3958
721723         {
722724            /* prepare GfxElement on the fly */
723725            gfx_element gfx;
726            gfx.machine = machine;
724727            gfx.width = width;
725728            gfx.height = height;
726729            gfx.total_elements = 1;
r3957r3958
733736            gfx.line_modulo = width/2;
734737            gfx.char_modulo = 0;   /* doesn't matter */
735738            gfx.flags = GFX_ELEMENT_PACKED;
739            gfx.machine = machine;
736740
737741            /* Bounds checking */
738742            if ( (gfxdata + width/2 * height - 1) >= gfx_max )
r3957r3958
929933        ---- ---- ---- --1-     ? Blank Screen
930934        ---- ---- ---- ---0     Flip  Screen    */
931935   if (screenctrl & 2)   return 0;
932   flip_screen_set(screenctrl & 1);
936   flip_screen_set(screen->machine, screenctrl & 1);
933937
934938   /* If the game supports 16x16 tiles, make sure that the
935939       16x16 and 8x8 tilemaps of a given layer are not simultaneously
src/mame/video/circusc.c
r3957r3958
154154
155155WRITE8_HANDLER( circusc_flipscreen_w )
156156{
157   flip_screen_set(data & 1);
157   flip_screen_set(space->machine, data & 1);
158158}
159159
160160
r3957r3958
185185      int flipx = sr[offs + 1] & 0x40;
186186      int flipy = sr[offs + 1] & 0x80;
187187
188      if (flip_screen_get())
188      if (flip_screen_get(machine))
189189      {
190190         sx = 240 - sx;
191191         sy = 240 - sy;
src/mame/video/mikie.c
r3957r3958
113113
114114WRITE8_HANDLER( mikie_flipscreen_w )
115115{
116   if (flip_screen_get() != (data & 0x01))
116   if (flip_screen_get(space->machine) != (data & 0x01))
117117   {
118      flip_screen_set(data & 0x01);
118      flip_screen_set(space->machine, data & 0x01);
119119      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
120120   }
121121}
r3957r3958
149149      int flipx = ~spriteram[offs] & 0x10;
150150      int flipy = spriteram[offs] & 0x20;
151151
152      if (flip_screen_get())
152      if (flip_screen_get(machine))
153153      {
154154         sy = 242 - sy;
155155         flipy = !flipy;
src/mame/video/midvunit.c
r3957r3958
7777VIDEO_START( midvunit )
7878{
7979   scanline_timer = timer_alloc(machine, scanline_timer_cb, NULL);
80   poly = poly_alloc(4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
80   poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), POLYFLAG_ALLOW_QUADS);
8181   add_exit_callback(machine, midvunit_exit);
8282
8383   state_save_register_global_array(machine, video_regs);
src/mame/video/suna16.c
r3957r3958
6565{
6666   if (ACCESSING_BITS_0_7)
6767   {
68      flip_screen_set( data & 1 );
68      flip_screen_set(space->machine, data & 1 );
6969      color_bank =   ( data & 4 ) >> 2;
7070   }
7171   if (data & ~(1|4))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(space->cpu), data);
r3957r3958
7575{
7676   if (ACCESSING_BITS_0_7)
7777   {
78      flip_screen_set( data & 0x10 );
78      flip_screen_set(space->machine, data & 0x10 );
7979//      color_bank =   ( data & 0x07 );
8080   }
8181   if (data & ~(0x10))   logerror("CPU#0 PC %06X - Flip screen unknown bits: %04X\n", cpu_get_pc(space->cpu), data);
r3957r3958
182182
183183            if (flipx)   tile_flipx = !tile_flipx;
184184
185            if (flip_screen_get())
185            if (flip_screen_get(machine))
186186            {
187187               sx = max_x - sx;
188188               sy = max_y - sy;
src/mame/video/zaccaria.c
r3957r3958
188188
189189WRITE8_HANDLER( zaccaria_flip_screen_x_w )
190190{
191   flip_screen_x_set(data & 1);
191   flip_screen_x_set(space->machine, data & 1);
192192}
193193
194194WRITE8_HANDLER( zaccaria_flip_screen_y_w )
195195{
196   flip_screen_y_set(data & 1);
196   flip_screen_y_set(space->machine, data & 1);
197197}
198198
199199
r3957r3958
209209   int offs;
210210   rectangle clip = *cliprect;
211211
212   if (flip_screen_x_get())
212   if (flip_screen_x_get(machine))
213213      sect_rect(&clip, &spritevisiblearea_flipx);
214214   else
215215      sect_rect(&clip, &spritevisiblearea);
r3957r3958
235235      int flipx = spriteram_2[offs + 2] & 0x40;
236236      int flipy = spriteram_2[offs + 2] & 0x80;
237237
238      if (flip_screen_x_get())
238      if (flip_screen_x_get(machine))
239239      {
240240         sx = 240 - sx;
241241         flipx = !flipx;
242242      }
243      if (flip_screen_y_get())
243      if (flip_screen_y_get(machine))
244244      {
245245         sy = 240 - sy;
246246         flipy = !flipy;
r3957r3958
261261      int flipx = spriteram[offs + 1] & 0x40;
262262      int flipy = spriteram[offs + 1] & 0x80;
263263
264      if (flip_screen_x_get())
264      if (flip_screen_x_get(machine))
265265      {
266266         sx = 240 - sx;
267267         flipx = !flipx;
268268      }
269      if (flip_screen_y_get())
269      if (flip_screen_y_get(machine))
270270      {
271271         sy = 240 - sy;
272272         flipy = !flipy;
src/mame/video/speedbal.c
r3957r3958
102102
103103      flipx = flipy = 0;
104104
105      if(flip_screen_get())
105      if(flip_screen_get(machine))
106106      {
107107         x = 246 - x;
108108         y = 238 - y;
src/mame/video/tagteam.c
r3957r3958
112112
113113WRITE8_HANDLER( tagteam_flipscreen_w )
114114{
115   if (flip_screen_get() != (data &0x01))
115   if (flip_screen_get(space->machine) != (data &0x01))
116116   {
117      flip_screen_set(data & 0x01);
117      flip_screen_set(space->machine, data & 0x01);
118118      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
119119   }
120120}
r3957r3958
149149
150150      if (!(videoram[offs] & 0x01)) continue;
151151
152      if (flip_screen_get())
152      if (flip_screen_get(machine))
153153      {
154154         sx = 240 - sx;
155155         sy = 240 - sy;
r3957r3958
168168
169169      code = videoram[offs + 0x20] + 256 * spritebank;
170170      color = palettebank;
171      sy += (flip_screen_get() ? -256 : 256);
171      sy += (flip_screen_get(machine) ? -256 : 256);
172172
173173      drawgfx(bitmap, machine->gfx[1],
174174         code, color,
src/mame/video/gtia.c
r3957r3958
227227      case 30: return gtia.r.gtia1e;
228228
229229      case 31:
230         gtia.r.cons = gtia.intf.console_read ? (gtia.intf.console_read() & 0x0F) : 0x00;
230         gtia.r.cons = gtia.intf.console_read ? (gtia.intf.console_read(space) & 0x0F) : 0x00;
231231         return gtia.r.cons;
232232    }
233233    return 0xff;
r3957r3958
752752         break;
753753      gtia.w.cons  = data;
754754      if (gtia.intf.console_write)
755         gtia.intf.console_write(gtia.w.cons);
755         gtia.intf.console_write(space, gtia.w.cons);
756756      break;
757757    }
758758}
src/mame/video/bagman.c
r3957r3958
8686
8787WRITE8_HANDLER( bagman_flipscreen_w )
8888{
89   if (flip_screen_get() != (data & 0x01))
89   if (flip_screen_get(space->machine) != (data & 0x01))
9090   {
91      flip_screen_set(data & 0x01);
91      flip_screen_set(space->machine, data & 0x01);
9292      tilemap_mark_all_tiles_dirty(bg_tilemap);
9393   }
9494}
r3957r3958
121121      sy = 240 - spriteram[offs + 2];
122122      flipx = spriteram[offs] & 0x40;
123123      flipy = spriteram[offs] & 0x80;
124      if (flip_screen_x_get())
124      if (flip_screen_x_get(machine))
125125      {
126126         sx = 240 - sx +1;   /* compensate misplacement */
127127         flipx = !flipx;
128128      }
129      if (flip_screen_y_get())
129      if (flip_screen_y_get(machine))
130130      {
131131         sy = 240 - sy;
132132         flipy = !flipy;
src/mame/video/gtia.h
r3957r3958
1616typedef struct _gtia_interface gtia_interface;
1717struct _gtia_interface
1818{
19   UINT8 (*console_read)(void);
20   void (*console_write)(UINT8 data);
19   UINT8 (*console_read)(const address_space *space);
20   void (*console_write)(const address_space *space, UINT8 data);
2121};
2222
2323
src/mame/video/commando.c
r3957r3958
6262   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
6363
6464   // bit 7 flips screen
65   flip_screen_set(data & 0x80);
65   flip_screen_set(space->machine, data & 0x80);
6666}
6767
6868static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
112112      int sx = buffered_spriteram[offs + 3] - ((attr & 0x01) << 8);
113113      int sy = buffered_spriteram[offs + 2];
114114
115      if (flip_screen_get())
115      if (flip_screen_get(machine))
116116      {
117117         sx = 240 - sx;
118118         sy = 240 - sy;
src/mame/video/ninjakd2.c
r3957r3958
368368         int const big = (sprptr[2] & 0x04) >> 2;
369369         int x,y;
370370
371         if (flip_screen_get())
371         if (flip_screen_get(machine))
372372         {
373373            sx = 240 - 16*big - sx;
374374            sy = 240 - 16*big - sy;
src/mame/video/m52.c
r3957r3958
279279WRITE8_HANDLER( m52_flipscreen_w )
280280{
281281   /* screen flip is handled both by software and hardware */
282   flip_screen_set((data & 0x01) ^ (~input_port_read(space->machine, "DSW2") & 0x01));
282   flip_screen_set(space->machine, (data & 0x01) ^ (~input_port_read(space->machine, "DSW2") & 0x01));
283283
284284   coin_counter_w(0, data & 0x02);
285285   coin_counter_w(1, data & 0x20);
r3957r3958
287287
288288WRITE8_HANDLER( alpha1v_flipscreen_w )
289289{
290   flip_screen_set(data & 0x01);
290   flip_screen_set(space->machine, data & 0x01);
291291}
292292
293293
r3957r3958
303303   rectangle rect;
304304   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
305305
306   if (flip_screen_get())
306   if (flip_screen_get(machine))
307307   {
308308      xpos = 255 - xpos;
309309      ypos = 255 - ypos - BGHEIGHT;
r3957r3958
316316
317317   drawgfx(bitmap, machine->gfx[image],
318318      0, 0,
319      flip_screen_get(),
320      flip_screen_get(),
319      flip_screen_get(machine),
320      flip_screen_get(machine),
321321      xpos,
322322      ypos,
323323      cliprect,
r3957r3958
325325
326326   drawgfx(bitmap, machine->gfx[image],
327327      0, 0,
328      flip_screen_get(),
329      flip_screen_get(),
328      flip_screen_get(machine),
329      flip_screen_get(machine),
330330      xpos - 256,
331331      ypos,
332332      cliprect,
r3957r3958
335335   rect.min_x = visarea->min_x;
336336   rect.max_x = visarea->max_x;
337337
338   if (flip_screen_get())
338   if (flip_screen_get(machine))
339339   {
340340      rect.min_y = ypos - BGHEIGHT;
341341      rect.max_y = ypos - 1;
r3957r3958
375375         draw_background(screen->machine, bitmap, cliprect, bg1xpos, bg1ypos, 4); /* cityscape */
376376   }
377377
378   tilemap_set_flip(bg_tilemap, flip_screen_get() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
378   tilemap_set_flip(bg_tilemap, flip_screen_get(screen->machine) ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
379379
380380   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
381381
r3957r3958
399399         clip.min_y = 128, clip.max_y = 255;
400400
401401      /* adjust for flipping */
402      if (flip_screen_get())
402      if (flip_screen_get(screen->machine))
403403      {
404404         int temp = clip.min_y;
405405         clip.min_y = 255 - clip.max_y;
src/mame/video/cbuster.c
r3957r3958
110110         inc = 1;
111111      }
112112
113      if (flip_screen_get()) {
113      if (flip_screen_get(machine)) {
114114         y=240-y;
115115         x=240-x;
116116         if (fx) fx=0; else fx=1;
r3957r3958
137137
138138VIDEO_UPDATE( twocrude )
139139{
140   flip_screen_set( !(deco16_pf12_control[0]&0x80) );
140   flip_screen_set(screen->machine, !(deco16_pf12_control[0]&0x80) );
141141
142142   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
143143   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
src/mame/video/jaguar.c
r3957r3958
135135****************************************************************************/
136136
137137#include "driver.h"
138#include "deprecat.h"
139138#include "memconv.h"
140139#include "profiler.h"
141140#include "machine/atarigen.h"
r3957r3958
214213static void process_object_list(running_machine *machine, int vc, UINT16 *_scanline);
215214
216215/* from jagblit.c */
217static void generic_blitter(UINT32 command, UINT32 a1flags, UINT32 a2flags);
218static void blitter_09800001_010020_010020(UINT32 command, UINT32 a1flags, UINT32 a2flags);
219static void blitter_09800009_000020_000020(UINT32 command, UINT32 a1flags, UINT32 a2flags);
220static void blitter_01800009_000028_000028(UINT32 command, UINT32 a1flags, UINT32 a2flags);
221static void blitter_01800001_000018_000018(UINT32 command, UINT32 a1flags, UINT32 a2flags);
222static void blitter_01c00001_000018_000018(UINT32 command, UINT32 a1flags, UINT32 a2flags);
216static void generic_blitter(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
217static void blitter_09800001_010020_010020(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
218static void blitter_09800009_000020_000020(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
219static void blitter_01800009_000028_000028(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
220static void blitter_01800001_000018_000018(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
221static void blitter_01c00001_000018_000018(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
223222
224223#ifdef MESS
225static void blitter_00010000_xxxxxx_xxxxxx(UINT32 command, UINT32 a1flags, UINT32 a2flags);
226static void blitter_01800001_xxxxxx_xxxxxx(UINT32 command, UINT32 a1flags, UINT32 a2flags);
227static void blitter_x1800x01_xxxxxx_xxxxxx(UINT32 command, UINT32 a1flags, UINT32 a2flags);
224static void blitter_00010000_xxxxxx_xxxxxx(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
225static void blitter_01800001_xxxxxx_xxxxxx(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
226static void blitter_x1800x01_xxxxxx_xxxxxx(running_machine *machine, UINT32 command, UINT32 a1flags, UINT32 a2flags);
228227#endif
229228
230229
r3957r3958
478477 *
479478 *************************************/
480479
481static UINT8 *get_jaguar_memory(UINT32 offset)
480static UINT8 *get_jaguar_memory(running_machine *machine, UINT32 offset)
482481{
483   return memory_get_read_ptr(cpu_get_address_space(Machine->cpu[1], ADDRESS_SPACE_PROGRAM), offset);
482   return memory_get_read_ptr(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), offset);
484483}
485484
486485
r3957r3958
491490 *
492491 *************************************/
493492
494static void blitter_run(void)
493static void blitter_run(running_machine *machine)
495494{
496495   UINT32 command = blitter_regs[B_CMD] & STATIC_COMMAND_MASK;
497496   UINT32 a1flags = blitter_regs[A1_FLAGS] & STATIC_FLAGS_MASK;
r3957r3958
503502   {
504503      if (command == 0x09800001 && a1flags == 0x010020)
505504      {
506         blitter_09800001_010020_010020(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
505         blitter_09800001_010020_010020(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
507506         return;
508507      }
509508      if (command == 0x09800009 && a1flags == 0x000020)
510509      {
511         blitter_09800009_000020_000020(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
510         blitter_09800009_000020_000020(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
512511         return;
513512      }
514513      if (command == 0x01800009 && a1flags == 0x000028)
515514      {
516         blitter_01800009_000028_000028(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
515         blitter_01800009_000028_000028(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
517516         return;
518517      }
519518
520519      if (command == 0x01800001 && a1flags == 0x000018)
521520      {
522         blitter_01800001_000018_000018(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
521         blitter_01800001_000018_000018(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
523522         return;
524523      }
525524
526525      if (command == 0x01c00001 && a1flags == 0x000018)
527526      {
528         blitter_01c00001_000018_000018(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
527         blitter_01c00001_000018_000018(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
529528         return;
530529      }
531530   }
r3957r3958
533532#ifdef MESS
534533   if (command == 0x00010000)
535534   {
536      blitter_00010000_xxxxxx_xxxxxx(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
535      blitter_00010000_xxxxxx_xxxxxx(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
537536      return;
538537   }
539538
540539   if (command == 0x01800001)
541540   {
542      blitter_01800001_xxxxxx_xxxxxx(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
541      blitter_01800001_xxxxxx_xxxxxx(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
543542      return;
544543   }
545544
546545   if ((command & 0x0ffff0ff) == 0x01800001)
547546   {
548      blitter_x1800x01_xxxxxx_xxxxxx(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
547      blitter_x1800x01_xxxxxx_xxxxxx(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
549548      return;
550549   }
551550#endif
r3957r3958
585584}
586585}
587586
588   generic_blitter(blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
587   generic_blitter(machine, blitter_regs[B_CMD], blitter_regs[A1_FLAGS], blitter_regs[A2_FLAGS]);
589588   profiler_mark(PROFILER_END);
590589}
591590
r3957r3958
608607{
609608   COMBINE_DATA(&blitter_regs[offset]);
610609   if (offset == B_CMD)
611      blitter_run();
610      blitter_run(space->machine);
612611
613612   if (LOG_BLITTER_WRITE)
614613   logerror("%08X:Blitter write register @ F022%02X = %08X\n", cpu_get_previouspc(space->cpu), offset * 4, data);
src/mame/video/gng.c
r3957r3958
103103
104104WRITE8_HANDLER( gng_flipscreen_w )
105105{
106   flip_screen_set(~data & 1);
106   flip_screen_set(space->machine, ~data & 1);
107107}
108108
109109
r3957r3958
128128      int flipx = attributes & 0x04;
129129      int flipy = attributes & 0x08;
130130
131      if (flip_screen_get())
131      if (flip_screen_get(machine))
132132      {
133133         sx = 240 - sx;
134134         sy = 240 - sy;
src/mame/video/n8080.c
r3957r3958
2828   sheriff_color_mode = (data >> 3) & 3;
2929   sheriff_color_data = (data >> 0) & 7;
3030
31   flip_screen_set_no_update(data & 0x20);
31   flip_screen_set_no_update(space->machine, data & 0x20);
3232}
3333
3434
r3957r3958
7676}
7777
7878
79static void helifire_next_line(void)
79static void helifire_next_line(running_machine *machine)
8080{
8181   helifire_mv++;
8282
r3957r3958
8686   }
8787   else
8888   {
89      if (flip_screen_get())
89      if (flip_screen_get(machine))
9090      {
9191         helifire_mv %= 255;
9292      }
r3957r3958
107107{
108108   cannon_timer = timer_alloc(machine, spacefev_stop_red_cannon, NULL);
109109
110   flip_screen_set_no_update(0);
110   flip_screen_set_no_update(machine, 0);
111111
112112   spacefev_red_screen = 0;
113113   spacefev_red_cannon = 0;
r3957r3958
116116
117117VIDEO_START( sheriff )
118118{
119   flip_screen_set_no_update(0);
119   flip_screen_set_no_update(machine, 0);
120120
121121   sheriff_color_mode = 0;
122122   sheriff_color_data = 0;
r3957r3958
143143      helifire_LSFR[i] = data;
144144   }
145145
146   flip_screen_set_no_update(0);
146   flip_screen_set_no_update(machine, 0);
147147
148148   helifire_flash = 0;
149149}
r3957r3958
151151
152152VIDEO_UPDATE( spacefev )
153153{
154   UINT8 mask = flip_screen_get() ? 0xff : 0x00;
154   UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
155155
156156   int x;
157157   int y;
r3957r3958
222222
223223VIDEO_UPDATE( sheriff )
224224{
225   UINT8 mask = flip_screen_get() ? 0xff : 0x00;
225   UINT8 mask = flip_screen_get(screen->machine) ? 0xff : 0x00;
226226
227227   const UINT8* pPROM = memory_region(screen->machine, "proms");
228228
r3957r3958
339339
340340         for (n = 0; n < 8; n++)
341341         {
342            if (flip_screen_get())
342            if (flip_screen_get(screen->machine))
343343            {
344344               if ((videoram[offset ^ 0x1fff] << n) & 0x80)
345345               {
r3957r3958
358358
359359      /* next line */
360360
361      helifire_next_line();
361      helifire_next_line(screen->machine);
362362   }
363363
364364   helifire_mv = saved_mv;
r3957r3958
400400
401401   for (i = 0; i < 256; i++)
402402   {
403      helifire_next_line();
403      helifire_next_line(machine);
404404   }
405405}
src/mame/video/holeland.c
r3957r3958
9797
9898WRITE8_HANDLER( holeland_flipscreen_w )
9999{
100   if (offset) flip_screen_y_set(data);
101   else        flip_screen_x_set(data);
100   if (offset) flip_screen_y_set(space->machine, data);
101   else        flip_screen_x_set(space->machine, data);
102102}
103103
104104
r3957r3958
120120      flipx = spriteram[offs+3] & 0x04;
121121      flipy = spriteram[offs+3] & 0x08;
122122
123      if (flip_screen_x_get())
123      if (flip_screen_x_get(machine))
124124      {
125125         flipx = !flipx;
126126         sx = 240 - sx;
127127      }
128128
129      if (flip_screen_y_get())
129      if (flip_screen_y_get(machine))
130130      {
131131         flipy = !flipy;
132132         sy = 240 - sy;
r3957r3958
158158      flipx = spriteram[offs+3] & 0x04;
159159      flipy = spriteram[offs+3] & 0x08;
160160
161      if (flip_screen_x_get())
161      if (flip_screen_x_get(machine))
162162      {
163163         flipx = !flipx;
164164         sx = 240 - sx;
165165      }
166166
167      if (flip_screen_y_get())
167      if (flip_screen_y_get(machine))
168168      {
169169         flipy = !flipy;
170170         sy = 240 - sy;
src/mame/video/liberate.c
r3957r3958
9393            tilemap_mark_all_tiles_dirty(background_tilemap);
9494         }
9595         background_disable=data&0x4;
96         flip_screen_set(data&0x1);
96         flip_screen_set(space->machine, data&0x1);
9797         break;
9898      case 7: /* Background palette resistors? */
9999         /* Todo */
r3957r3958
214214
215215      if (multi && fy==0) sy-=16;
216216
217      if (flip_screen_get()) {
217      if (flip_screen_get(machine)) {
218218         sy=240-sy;
219219         sx=240-sx;
220220         if (fy)
r3957r3958
275275//      if (multi) sy-=16;
276276      if (fy && multi) { code2=code; code++; }
277277
278      if (flip_screen_get()) {
278      if (flip_screen_get(machine)) {
279279         sy=240-sy;
280280         sx=240-sx;
281281         if (fx) fx=0; else fx=1;
r3957r3958
331331//      if (multi) sy-=16;
332332      if (fy && multi) { code2=code; code++; }
333333
334      if (flip_screen_get()) {
334      if (flip_screen_get(machine)) {
335335         sy=240-sy;
336336         sx=240-sx;
337337         if (fx) fx=0; else fx=1;
src/mame/video/spdodgeb.c
r3957r3958
118118   UINT8 *rom = memory_region(space->machine, "main");
119119
120120   /* bit 0 = flip screen */
121   flip_screen_set(data & 0x01);
121   flip_screen_set(space->machine, data & 0x01);
122122
123123   /* bit 1 = ROM bank switch */
124124   memory_set_bankptr(space->machine, 1,rom + 0x10000 + 0x4000 * ((~data & 0x02) >> 1));
r3957r3958
179179      int dy = -16;
180180      int cy;
181181
182      if (flip_screen_get())
182      if (flip_screen_get(machine))
183183      {
184184         sx = 240 - sx;
185185         sy = 240 - sy;
r3957r3958
198198         break;
199199
200200         case 1: /* double y */
201         if (flip_screen_get()) { if (sy > 240) sy -= 256; } else { if (sy < 0) sy += 256; }
201         if (flip_screen_get(machine)) { if (sy > 240) sy -= 256; } else { if (sy < 0) sy += 256; }
202202         cy = sy + dy;
203203         which &= ~1;
204204         DRAW_SPRITE(0,sx,cy);
src/mame/video/gunsmoke.c
r3957r3958
8888   /* bit 5 resets the sound CPU? - we ignore it */
8989
9090   /* bit 6 flips screen */
91   flip_screen_set(data & 0x40);
91   flip_screen_set(space->machine, data & 0x40);
9292
9393   /* bit 7 enables characters? */
9494   chon = data & 0x80;
r3957r3958
167167      if (bank == 3) bank += sprite3bank;
168168      code += 256 * bank;
169169
170      if (flip_screen_get())
170      if (flip_screen_get(machine))
171171      {
172172         sx = 240 - sx;
173173         sy = 240 - sy;
src/mame/video/cvs.c
r3957r3958
361361
362362         if ((y & 1) ^ ((x >> 4) & 1))
363363         {
364            if (flip_screen_x_get())
364            if (flip_screen_x_get(screen->machine))
365365               x = ~x;
366366
367            if (flip_screen_y_get())
367            if (flip_screen_y_get(screen->machine))
368368               y = ~y;
369369
370370            if ((y >= cliprect->min_y) && (y <= cliprect->max_y) &&
src/mame/video/rohga.c
r3957r3958
123123         inc = 1;
124124      }
125125
126      if (flip_screen_get()) {
126      if (flip_screen_get(machine)) {
127127         x=304-x;
128128         y=240-y;
129129         if (fx) fx=0; else fx=1;
r3957r3958
216216         inc = 1;
217217      }
218218
219      if (flip_screen_get()) {
219      if (flip_screen_get(machine)) {
220220         x=304-x;
221221         y=240-y;
222222         if (fx) fx=0; else fx=1;
r3957r3958
394394      fx = (spriteptr[offs+0]&0x4000);
395395      fy = (spriteptr[offs+0]&0x8000);
396396
397      if (!flip_screen_get()) { /* Inverted from Mutant Fighter! */
397      if (!flip_screen_get(machine)) { /* Inverted from Mutant Fighter! */
398398         if (fx) fx=0; else fx=1;
399399         if (fy) fy=0; else fy=1;
400400
r3957r3958
439439static void update_rohga(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect, int is_schmeisr)
440440{
441441   /* Update playfields */
442   flip_screen_set( deco16_pf12_control[0]&0x80 );
442   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
443443   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
444444   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
445445
r3957r3958
496496VIDEO_UPDATE( wizdfire )
497497{
498498   /* Update playfields */
499   flip_screen_set( deco16_pf12_control[0]&0x80 );
499   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
500500   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
501501   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
502502
r3957r3958
525525VIDEO_UPDATE( nitrobal )
526526{
527527   /* Update playfields */
528   flip_screen_set( deco16_pf12_control[0]&0x80 );
528   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
529529   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
530530   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
531531
src/mame/video/vball.c
r3957r3958
136136      int flipy = 0;
137137      int dy = -16;
138138
139      if (flip_screen_get())
139      if (flip_screen_get(machine))
140140      {
141141         sx = 240 - sx;
142142         sy = 240 - sy;
src/mame/video/higemaru.c
r3957r3958
8080   coin_counter_w(1,data & 1);
8181
8282   /* bit 7 flips screen */
83   if (flip_screen_get() != (data & 0x80))
83   if (flip_screen_get(space->machine) != (data & 0x80))
8484   {
85      flip_screen_set(data & 0x80);
85      flip_screen_set(space->machine, data & 0x80);
8686      tilemap_mark_all_tiles_dirty(bg_tilemap);
8787   }
8888}
r3957r3958
114114      sy = spriteram[offs + 8];
115115      flipx = spriteram[offs + 4] & 0x10;
116116      flipy = spriteram[offs + 4] & 0x20;
117      if (flip_screen_get())
117      if (flip_screen_get(machine))
118118      {
119119         sx = 240 - sx;
120120         sy = 240 - sy;
src/mame/video/1942.c
r3957r3958
187187
188188   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
189189
190   flip_screen_set(data & 0x80);
190   flip_screen_set(space->machine, data & 0x80);
191191}
192192
193193
r3957r3958
213213      sx = spriteram[offs + 3] - 0x10 * (spriteram[offs + 1] & 0x10);
214214      sy = spriteram[offs + 2];
215215      dir = 1;
216      if (flip_screen_get())
216      if (flip_screen_get(machine))
217217      {
218218         sx = 240 - sx;
219219         sy = 240 - sy;
r3957r3958
228228      {
229229         drawgfx(bitmap,machine->gfx[2],
230230               code + i,col,
231               flip_screen_get(),flip_screen_get(),
231               flip_screen_get(machine),flip_screen_get(machine),
232232               sx,sy + 16 * i * dir,
233233               cliprect,TRANSPARENCY_PEN,15);
234234
src/mame/video/bombjack.c
r3957r3958
3535
3636WRITE8_HANDLER( bombjack_flipscreen_w )
3737{
38   if (flip_screen_get() != (data & 0x01))
38   if (flip_screen_get(space->machine) != (data & 0x01))
3939   {
40      flip_screen_set(data & 0x01);
40      flip_screen_set(space->machine, data & 0x01);
4141      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
4242   }
4343}
r3957r3958
106106         sy = 241-spriteram[offs+2];
107107      flipx = spriteram[offs+1] & 0x40;
108108      flipy =   spriteram[offs+1] & 0x80;
109      if (flip_screen_get())
109      if (flip_screen_get(machine))
110110      {
111111         if (spriteram[offs+1] & 0x20)
112112         {
src/mame/video/rallyx.c
r3957r3958
504504      x > cliprect->max_x)
505505      return;
506506
507   if (flip_screen_x_get())
507   if (flip_screen_x_get(machine))
508508      x = 255 - x;
509509
510   if (flip_screen_y_get())
510   if (flip_screen_y_get(machine))
511511      y = 255 - y;
512512
513513   if (colortable_entry_get_value(machine->colortable, *BITMAP_ADDR16(bitmap, y, x) % 0x144) == 0)
r3957r3958
540540      int color = spriteram_2[offs + 1] & 0x3f;
541541      int flipx = spriteram[offs] & 1;
542542      int flipy = spriteram[offs] & 2;
543      if (flip_screen_get()) sx -= 2*displacement;
543      if (flip_screen_get(machine)) sx -= 2*displacement;
544544
545545      pdrawgfx(bitmap,machine->gfx[1],
546546            (spriteram[offs] & 0xfc) >> 2,
r3957r3958
585585
586586      x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x01) << 8);
587587      y = 253 - rallyx_radary[offs];
588      if (flip_screen_get()) x -= 3;
588      if (flip_screen_get(machine)) x -= 3;
589589
590590      drawgfx(bitmap,machine->gfx[2],
591591            ((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
r3957r3958
651651       the screen, and clip it to only the position where it is supposed to be shown */
652652   rectangle fg_clip = *cliprect;
653653   rectangle bg_clip = *cliprect;
654   if (flip_screen_get())
654   if (flip_screen_get(screen->machine))
655655   {
656656      bg_clip.min_x = 8*8;
657657      fg_clip.max_x = 8*8-1;
r3957r3958
683683       the screen, and clip it to only the position where it is supposed to be shown */
684684   rectangle fg_clip = *cliprect;
685685   rectangle bg_clip = *cliprect;
686   if (flip_screen_get())
686   if (flip_screen_get(screen->machine))
687687   {
688688      bg_clip.min_x = 8*8;
689689      fg_clip.max_x = 8*8-1;
r3957r3958
719719       the screen, and clip it to only the position where it is supposed to be shown */
720720   rectangle fg_clip = *cliprect;
721721   rectangle bg_clip = *cliprect;
722   if (flip_screen_get())
722   if (flip_screen_get(screen->machine))
723723   {
724724      /* handle reduced visible area in some games */
725725      if (video_screen_get_visible_area(screen)->max_x == 32*8-1)
src/mame/video/realbrk.c
r3957r3958
3636      coin_counter_w(0,   data & 0x0001);
3737      coin_counter_w(1,   data & 0x0004);
3838
39      flip_screen_set(   data & 0x0080);
39      flip_screen_set(space->machine,    data & 0x0080);
4040   }
4141
4242   if (ACCESSING_BITS_8_15)
r3957r3958
262262      xdim   =      ((zoom & 0x00ff) >> 0) << (16-6+4);
263263      ydim   =      ((zoom & 0xff00) >> 8) << (16-6+4);
264264
265      if (flip_screen_x_get())   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
266      if (flip_screen_y_get())   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
265      if (flip_screen_x_get(machine))   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
266      if (flip_screen_y_get(machine))   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
267267
268268      if (flipx)   { xstart = xnum-1;  xend = -1;    xinc = -1; }
269269      else      { xstart = 0;       xend = xnum;  xinc = +1; }
r3957r3958
424424      xdim   =      ((zoom & 0x00ff) >> 0) << (16-6+4);
425425      ydim   =      ((zoom & 0xff00) >> 8) << (16-6+4);
426426
427      if (flip_screen_x_get())   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
428      if (flip_screen_y_get())   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
427      if (flip_screen_x_get(machine))   {   flipx = !flipx;      sx = (max_x << 16) - sx - xnum * xdim;   }
428      if (flip_screen_y_get(machine))   {   flipy = !flipy;      sy = (max_y << 16) - sy - ynum * ydim;   }
429429
430430      if (flipx)   { xstart = xnum-1;  xend = -1;    xinc = -1; }
431431      else      { xstart = 0;       xend = xnum;  xinc = +1; }
src/mame/video/segag80v.c
r3957r3958
179179         /* Add a starting point to the vector list. */
180180         clipped = adjust_xy(curx, cury, &adjx, &adjy);
181181         if (!clipped)
182            vector_add_point(adjx, adjy, 0, 0);
182            vector_add_point(machine, adjx, adjy, 0, 0);
183183
184184         /* Loop until we run out of time. */
185185         while (total_time > 0)
r3957r3958
287287               {
288288                  /* if we're just becoming unclipped, add an empty point */
289289                  if (!newclip)
290                     vector_add_point(adjx, adjy, 0, 0);
290                     vector_add_point(machine, adjx, adjy, 0, 0);
291291
292292                  /* otherwise, add a colored point */
293293                  else
294                     vector_add_point(adjx, adjy, color, intensity);
294                     vector_add_point(machine, adjx, adjy, color, intensity);
295295               }
296296               clipped = newclip;
297297
r3957r3958
301301
302302            /* We're done; if we are not clipped, add a final point. */
303303            if (!clipped)
304               vector_add_point(adjx, adjy, color, intensity);
304               vector_add_point(machine, adjx, adjy, color, intensity);
305305
306306            /* if the high bit of the attribute is set, we break out of   */
307307            /* this loop and fetch another symbol */
src/mame/video/flower.c
r3957r3958
8080      code |= ((source[2] & 0x01) << 6);
8181      code |= ((source[2] & 0x08) << 4);
8282
83      if(flip_screen_get())
83      if(flip_screen_get(machine))
8484      {
8585         flipx = !flipx;
8686         flipy = !flipy;
r3957r3958
174174
175175   draw_sprites(screen->machine,bitmap,cliprect);
176176
177   if(flip_screen_get())
177   if(flip_screen_get(screen->machine))
178178   {
179179      myclip.min_x = cliprect->min_x;
180180      myclip.max_x = cliprect->min_x + 15;
r3957r3958
211211
212212WRITE8_HANDLER( flower_flipscreen_w )
213213{
214   flip_screen_set(data);
214   flip_screen_set(space->machine, data);
215215}
src/mame/video/xain.c
r3957r3958
158158
159159WRITE8_HANDLER( xain_flipscreen_w )
160160{
161   flip_screen_set(data & 1);
161   flip_screen_set(space->machine, data & 1);
162162}
163163
164164
r3957r3958
184184      sy = 240 - spriteram[offs];
185185      if (sy <= -7) sy += 256;
186186      flipx = attr & 0x40;
187      if (flip_screen_get())
187      if (flip_screen_get(machine))
188188      {
189189         sx = 239 - sx;
190190         sy = 240 - sy;
r3957r3958
196196         drawgfx(bitmap,machine->gfx[3],
197197               numtile,
198198               color,
199               flipx,flip_screen_get(),
200               sx-1,flip_screen_get() ? sy+16:sy-16,
199               flipx,flip_screen_get(machine),
200               sx-1,flip_screen_get(machine) ? sy+16:sy-16,
201201               cliprect,TRANSPARENCY_PEN,0);
202202         drawgfx(bitmap,machine->gfx[3],
203203               numtile+1,
204204               color,
205               flipx,flip_screen_get(),
205               flipx,flip_screen_get(machine),
206206               sx-1,sy,
207207               cliprect,TRANSPARENCY_PEN,0);
208208      }
r3957r3958
211211         drawgfx(bitmap,machine->gfx[3],
212212               numtile,
213213               color,
214               flipx,flip_screen_get(),
214               flipx,flip_screen_get(machine),
215215               sx,sy,
216216               cliprect,TRANSPARENCY_PEN,0);
217217      }
src/mame/video/namcos1.c
r3957r3958
308308      sx += sprite_xoffs;
309309      sy -= sprite_yoffs;
310310
311      if (flip_screen_get())
311      if (flip_screen_get(machine))
312312      {
313313         sx = -sx - sizex;
314314         sy = -sy - sizey;
r3957r3958
343343   rectangle new_clip = *cliprect;
344344
345345   /* flip screen is embedded in the sprite control registers */
346   /* can't use flip_screen_set() because the visible area is asymmetrical */
347   flip_screen_set_no_update(spriteram[0x07f6] & 1);
348   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
346   /* can't use flip_screen_set(screen->machine, ) because the visible area is asymmetrical */
347   flip_screen_set_no_update(screen->machine, spriteram[0x07f6] & 1);
348   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get(screen->machine) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
349349
350350
351351   /* background color */
r3957r3958
377377      scrollx = ( namcos1_playfield_control[j+1] + (namcos1_playfield_control[j+0]<<8) ) - disp_x[i];
378378      scrolly = ( namcos1_playfield_control[j+3] + (namcos1_playfield_control[j+2]<<8) ) + 8;
379379
380      if (flip_screen_get())
380      if (flip_screen_get(screen->machine))
381381      {
382382         scrollx = -scrollx;
383383         scrolly = -scrolly;
src/mame/video/toki.c
r3957r3958
201201         flipy   = 0;
202202         tile    = (sprite_word[1] & 0xfff) + ((sprite_word[2] & 0x8000) >> 3);
203203
204         if (flip_screen_get()) {
204         if (flip_screen_get(machine)) {
205205            x=240-x;
206206            y=240-y;
207207            if (flipx) flipx=0; else flipx=1;
r3957r3958
283283   tilemap_set_scrollx( foreground_layer, 0, foreground_x_scroll );
284284   tilemap_set_scrolly( foreground_layer, 0, foreground_y_scroll );
285285
286   flip_screen_set((toki_scrollram16[0x28]&0x8000)==0);
286   flip_screen_set(screen->machine, (toki_scrollram16[0x28]&0x8000)==0);
287287
288288   if (toki_scrollram16[0x28]&0x100) {
289289      tilemap_draw(bitmap,cliprect,background_layer,TILEMAP_DRAW_OPAQUE,0);
src/mame/video/40love.c
r3957r3958
153153   if (fortyl_flipscreen != f)
154154   {
155155      fortyl_flipscreen = f;
156      flip_screen_set(fortyl_flipscreen);
156      flip_screen_set(space->machine, fortyl_flipscreen);
157157      fortyl_pix_redraw = 1;
158158
159159      for (offs=0;offs<32;offs++)
src/mame/video/renegade.c
r3957r3958
2727
2828WRITE8_HANDLER( renegade_flipscreen_w )
2929{
30   flip_screen_set(~data & 0x01);
30   flip_screen_set(space->machine, ~data & 0x01);
3131}
3232
3333WRITE8_HANDLER( renegade_scroll0_w )
r3957r3958
9494         if (sx > 248)
9595            sx -= 256;
9696
97         if (flip_screen_get())
97         if (flip_screen_get(machine))
9898         {
9999            sx = 240 - sx;
100100            sy = 240 - sy;
r3957r3958
107107            drawgfx(bitmap, machine->gfx[sprite_bank],
108108               sprite_number + 1,
109109               color,
110               xflip, flip_screen_get(),
111               sx, sy + (flip_screen_get() ? -16 : 16),
110               xflip, flip_screen_get(machine),
111               sx, sy + (flip_screen_get(machine) ? -16 : 16),
112112               cliprect, TRANSPARENCY_PEN, 0);
113113         }
114114         else
115115         {
116            sy += (flip_screen_get() ? -16 : 16);
116            sy += (flip_screen_get(machine) ? -16 : 16);
117117         }
118118         drawgfx(bitmap, machine->gfx[sprite_bank],
119119            sprite_number,
120120            color,
121            xflip, flip_screen_get(),
121            xflip, flip_screen_get(machine),
122122            sx, sy,
123123            cliprect, TRANSPARENCY_PEN, 0);
124124      }
src/mame/video/galaga.c
r3957r3958
424424    int color = galaga_videoram[tile_index + 0x400] & 0x3f;
425425   SET_TILE_INFO(
426426         0,
427         (galaga_videoram[tile_index] & 0x7f) | (flip_screen_get() ? 0x80 : 0) | (galaga_gfxbank << 8),
427         (galaga_videoram[tile_index] & 0x7f) | (flip_screen_get(machine) ? 0x80 : 0) | (galaga_gfxbank << 8),
428428         color,
429         flip_screen_get() ? TILE_FLIPX : 0);
429         flip_screen_get(machine) ? TILE_FLIPX : 0);
430430   tileinfo->group = color;
431431}
432432
r3957r3958
519519      sy -= 16 * sizey;
520520      sy = (sy & 0xff) - 32;   // fix wraparound
521521
522      if (flip_screen_get())
522      if (flip_screen_get(machine))
523523      {
524524         flipx ^= 1;
525525         flipy ^= 1;
src/mame/video/lasso.c
r3957r3958
231231static WRITE8_HANDLER( lasso_flip_screen_w )
232232{
233233   /* don't know which is which, but they are always set together */
234   flip_screen_x_set(data & 0x01);
235   flip_screen_y_set( data & 0x02);
234   flip_screen_x_set(space->machine, data & 0x01);
235   flip_screen_y_set(space->machine,  data & 0x02);
236236
237   tilemap_set_flip(ALL_TILEMAPS, (flip_screen_x_get() ? TILEMAP_FLIPX : 0) |
238                           (flip_screen_y_get() ? TILEMAP_FLIPY : 0));
237   tilemap_set_flip(ALL_TILEMAPS, (flip_screen_x_get(space->machine) ? TILEMAP_FLIPX : 0) |
238                           (flip_screen_y_get(space->machine) ? TILEMAP_FLIPY : 0));
239239}
240240
241241
r3957r3958
309309      flipx = source[1] & 0x40;
310310      flipy = source[1] & 0x80;
311311
312      if (flip_screen_x_get())
312      if (flip_screen_x_get(machine))
313313      {
314314         sx = 240 - sx;
315315         flipx = !flipx;
316316      }
317317
318      if (flip_screen_y_get())
318      if (flip_screen_y_get(machine))
319319      {
320320         flipy = !flipy;
321321      }
r3957r3958
340340}
341341
342342
343static void draw_lasso(bitmap_t *bitmap, const rectangle *cliprect)
343static void draw_lasso(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
344344{
345345   offs_t offs;
346346   pen_t pen = 0x3f;
r3957r3958
352352      UINT8 x;
353353      UINT8 y = offs >> 5;
354354
355      if (flip_screen_y_get())
355      if (flip_screen_y_get(machine))
356356         y = ~y;
357357
358358      if ((y < cliprect->min_y) || (y > cliprect->max_y))
r3957r3958
361361      x = (offs & 0x1f) << 3;
362362      data = lasso_bitmap_ram[offs];
363363
364      if (flip_screen_x_get())
364      if (flip_screen_x_get(machine))
365365         x = ~x;
366366
367367      for (bit = 0; bit < 8; bit++)
r3957r3958
369369         if ((data & 0x80) && (x >= cliprect->min_x) && (x <= cliprect->max_x))
370370            *BITMAP_ADDR16(bitmap, y, x) = pen;
371371
372         if (flip_screen_x_get())
372         if (flip_screen_x_get(machine))
373373            x = x - 1;
374374         else
375375            x = x + 1;
r3957r3958
386386   bitmap_fill(bitmap, cliprect, 0);
387387
388388   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
389   draw_lasso(bitmap, cliprect);
389   draw_lasso(screen->machine, bitmap, cliprect);
390390   draw_sprites(screen->machine, bitmap, cliprect, 0);
391391
392392   return 0;
src/mame/video/psychic5.c
r3957r3958
341341      if (attr & 0x01) sx -= 256;
342342      if (attr & 0x04) sy -= 256;
343343
344      if (flip_screen_get())
344      if (flip_screen_get(machine))
345345      {
346346         sx = 224 - sx;
347347         sy = 224 - sy;
r3957r3958
366366      }
367367      else
368368      {
369         if (flip_screen_get())
369         if (flip_screen_get(machine))
370370            DRAW_SPRITE(code, sx + 16, sy + 16)
371371         else
372372            DRAW_SPRITE(code, sx, sy)
r3957r3958
423423      case 11: case 13: clip.max_x = sx1; break;
424424      }
425425
426      if (flip_screen_get())
426      if (flip_screen_get(machine))
427427      {
428428         int min_x,max_x,min_y,max_y;
429429         min_x = 255 - clip.max_x;
src/mame/video/mrjong.c
r3957r3958
8080
8181WRITE8_HANDLER( mrjong_flipscreen_w )
8282{
83   if (flip_screen_get() != (data & 0x01))
83   if (flip_screen_get(space->machine) != (data & 0x01))
8484   {
85      flip_screen_set(data & 0x01);
85      flip_screen_set(space->machine, data & 0x01);
8686      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
8787   }
8888}
r3957r3958
119119
120120      sx = 224 - spriteram[offs + 2];
121121      sy = spriteram[offs + 0];
122      if (flip_screen_get())
122      if (flip_screen_get(machine))
123123      {
124124         sx = 208 - sx;
125125         sy = 240 - sy;
src/mame/video/vsnes.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "video/ppu2c0x.h"
43#include "includes/vsnes.h"
54
r3957r3958
1514   ppu2c0x_init_palette(machine, 8*4*16 );
1615}
1716
18static void ppu_irq( int num, int *ppu_regs )
17static void ppu_irq( running_machine *machine, int num, int *ppu_regs )
1918{
20   cpu_set_input_line(Machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
19   cpu_set_input_line(machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
2120}
2221
2322/* our ppu interface                                            */
src/mame/video/1943.c
r3957r3958
153153   /* bit 5 resets the sound CPU - we ignore it */
154154
155155   /* bit 6 flips screen */
156   flip_screen_set(data & 0x40);
156   flip_screen_set(space->machine, data & 0x40);
157157
158158   /* bit 7 enables characters */
159159   chon = data & 0x80;
r3957r3958
234234      int sx = spriteram[offs + 3] - ((attr & 0x10) << 4);
235235      int sy = spriteram[offs + 2];
236236
237      if (flip_screen_get())
237      if (flip_screen_get(machine))
238238      {
239239         sx = 240 - sx;
240240         sy = 240 - sy;
r3957r3958
245245      {
246246         if (color != 0x0a && color != 0x0b)
247247         {
248            drawgfx(bitmap, machine->gfx[3], code, color, flip_screen_get(), flip_screen_get(),
248            drawgfx(bitmap, machine->gfx[3], code, color, flip_screen_get(machine), flip_screen_get(machine),
249249               sx, sy, cliprect, TRANSPARENCY_PEN, 0);
250250         }
251251      }
r3957r3958
253253      {
254254         if (color == 0x0a || color == 0x0b)
255255         {
256            drawgfx(bitmap, machine->gfx[3], code, color, flip_screen_get(), flip_screen_get(),
256            drawgfx(bitmap, machine->gfx[3], code, color, flip_screen_get(machine), flip_screen_get(machine),
257257               sx, sy, cliprect, TRANSPARENCY_PEN, 0);
258258         }
259259      }
src/mame/video/pacland.c
r3957r3958
309309      sprite &= ~sizex;
310310      sprite &= ~(sizey << 1);
311311
312      if (flip_screen_get())
312      if (flip_screen_get(machine))
313313      {
314314         flipx ^= 1;
315315         flipy ^= 1;
r3957r3958
379379   int row;
380380
381381   for (row = 5; row < 29; row++)
382      tilemap_set_scrollx(fg_tilemap, row, flip_screen_get() ? scroll0-7 : scroll0);
383   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get() ? scroll1-4 : scroll1-3);
382      tilemap_set_scrollx(fg_tilemap, row, flip_screen_get(screen->machine) ? scroll0-7 : scroll0);
383   tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get(screen->machine) ? scroll1-4 : scroll1-3);
384384
385385   /* draw high priority sprite pixels, setting priority bitmap to non-zero
386386       wherever there is a high-priority pixel; note that we draw to the bitmap
src/mame/video/cninja.c
r3957r3958
196196         inc = 1;
197197      }
198198
199      if (flip_screen_get()) {
199      if (flip_screen_get(machine)) {
200200         y=240-y;
201201         x=240-x;
202202         if (fx) fx=0; else fx=1;
r3957r3958
264264         inc = 1;
265265      }
266266
267      if (flip_screen_get()) {
267      if (flip_screen_get(machine)) {
268268         y=240-y;
269269         x=304-x;
270270         if (fx) fx=0; else fx=1;
r3957r3958
354354      fx = (spriteptr[offs+0]&0x4000);
355355      fy = (spriteptr[offs+0]&0x8000);
356356
357      if (flip_screen_get()) {
357      if (flip_screen_get(machine)) {
358358         if (fx) fx=0; else fx=1;
359359         if (fy) fy=0; else fy=1;
360360
r3957r3958
397397
398398VIDEO_UPDATE( cninja )
399399{
400   flip_screen_set( deco16_pf12_control[0]&0x80 );
400   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
401401   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
402402   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
403403
r3957r3958
415415
416416VIDEO_UPDATE( edrandy )
417417{
418   flip_screen_set( deco16_pf12_control[0]&0x80 );
418   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
419419   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
420420   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
421421
r3957r3958
446446   }
447447
448448   /* Update playfields */
449   flip_screen_set( deco16_pf12_control[0]&0x80 );
449   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
450450   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
451451   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
452452
r3957r3958
482482
483483VIDEO_UPDATE( mutantf )
484484{
485   flip_screen_set( deco16_pf12_control[0]&0x80 );
485   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
486486   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
487487   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
488488
src/mame/video/sidearms.c
r3957r3958
7070   if (flipon != (data & 0x80))
7171   {
7272      flipon = data & 0x80;
73      flip_screen_set(flipon);
73      flip_screen_set(space->machine, flipon);
7474      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
7575   }
7676}
src/mame/video/jack.c
r3957r3958
3030
3131READ8_HANDLER( jack_flipscreen_r )
3232{
33   flip_screen_set(offset);
33   flip_screen_set(space->machine, offset);
3434   return 0;
3535}
3636
3737WRITE8_HANDLER( jack_flipscreen_w )
3838{
39   flip_screen_set(offset);
39   flip_screen_set(space->machine, offset);
4040}
4141
4242static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
7373      flipx = (spriteram[offs + 3] & 0x80);
7474      flipy = (spriteram[offs + 3] & 0x40);
7575
76      if (flip_screen_get())
76      if (flip_screen_get(machine))
7777      {
7878         sx = 248 - sx;
7979         sy = 248 - sy;
r3957r3958
154154      flipx = (spriteram[offs + 3] & 0x80);
155155      flipy = (spriteram[offs + 3] & 0x40);
156156
157      if (flip_screen_get())
157      if (flip_screen_get(machine))
158158      {
159159         sx = 248 - sx;
160160         sy = 248 - sy;
src/mame/video/tumblep.c
r3957r3958
5656         inc = 1;
5757      }
5858
59      if (flip_screen_get())
59      if (flip_screen_get(machine))
6060      {
6161         y=240-y;
6262         x=304-x;
r3957r3958
8787
8888VIDEO_UPDATE(tumblep)
8989{
90   flip_screen_set( deco16_pf12_control[0]&0x80 );
90   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
9191   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
9292
9393   bitmap_fill(bitmap,cliprect,256); /* not verified */
src/mame/video/dogfgt.c
r3957r3958
128128
129129      for (i = 0;i < 3;i++)
130130         color |= ((bitmapram[offset + BITMAPRAM_SIZE/3 * i] >> subx) & 1) << i;
131      if (flip_screen_get())
131      if (flip_screen_get(space->machine))
132132         *BITMAP_ADDR16(pixbitmap, y^0xff, (x+subx)^0xff) = PIXMAP_COLOR_BASE + 8*pixcolor + color;
133133      else
134134         *BITMAP_ADDR16(pixbitmap, y, x+subx) = PIXMAP_COLOR_BASE + 8*pixcolor + color;
r3957r3958
172172   coin_counter_w(1,data & 0x20);
173173
174174   /* bit 7 is screen flip */
175   flip_screen_set(data & 0x80);
175   flip_screen_set(space->machine, data & 0x80);
176176
177177   /* other bits unused? */
178178   logerror("PC %04x: 1800 = %02x\n",cpu_get_pc(space->cpu),data);
r3957r3958
199199         sy = (240 - spriteram[offs+2]) & 0xff;
200200         flipx = spriteram[offs] & 0x04;
201201         flipy = spriteram[offs] & 0x02;
202         if (flip_screen_get())
202         if (flip_screen_get(machine))
203203         {
204204            sx = 240 - sx;
205205            sy = 240 - sy;
r3957r3958
224224   int offs;
225225
226226
227   if (lastflip != flip_screen_get() || lastpixcolor != pixcolor)
227   if (lastflip != flip_screen_get(screen->machine) || lastpixcolor != pixcolor)
228228   {
229229      const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
230230
231      lastflip = flip_screen_get();
231      lastflip = flip_screen_get(screen->machine);
232232      lastpixcolor = pixcolor;
233233
234234      for (offs = 0;offs < BITMAPRAM_SIZE;offs++)
src/mame/video/dietgo.c
r3957r3958
4141         inc = 1;
4242      }
4343
44      if (flip_screen_get())
44      if (flip_screen_get(machine))
4545      {
4646         y=240-y;
4747         x=304-x;
r3957r3958
8080
8181VIDEO_UPDATE(dietgo)
8282{
83   flip_screen_set( deco16_pf12_control[0]&0x80 );
83   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
8484   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
8585
8686   bitmap_fill(bitmap,cliprect,256); /* not verified */
src/mame/video/avgdvg.c
r3957r3958
1212**************************************************************************/
1313
1414#include "driver.h"
15#include "deprecat.h"
1615#include "avgdvg.h"
1716#include "video/vector.h"
1817
r3957r3958
6968
7069typedef struct _vgdata
7170{
71   running_machine *machine;
72
7273   UINT16 pc;
7374   UINT8 sp;
7475   UINT16 dvx;
r3957r3958
167168 *
168169 *************************************/
169170
170static void vg_flush (void)
171static void vg_flush (running_machine *machine)
171172{
172173   int i;
173174
174175   for (i = 0; i < nvect; i++)
175176   {
176177      if (vectbuf[i].status == VGVECTOR)
177         vector_add_point(vectbuf[i].x, vectbuf[i].y, vectbuf[i].color, vectbuf[i].intensity);
178         vector_add_point(machine, vectbuf[i].x, vectbuf[i].y, vectbuf[i].color, vectbuf[i].intensity);
178179
179180      if (vectbuf[i].status == VGCLIP)
180181         vector_add_clip(vectbuf[i].x, vectbuf[i].y, vectbuf[i].arg1, vectbuf[i].arg2);
r3957r3958
475476
476477   if (vg->pc & 0x2000)
477478   {
478      bank = &memory_region(Machine, "alpha")[0x18000];
479      bank = &memory_region(vg->machine, "alpha")[0x18000];
479480      vg->data = bank[(vg->map << 13) | ((vg->pc ^ 1) & 0x1fff)];
480481   }
481482   else
r3957r3958
751752                 */
752753
753754            vector_clear_list();
754            vg_flush();
755            vg_flush(vg->machine);
755756         }
756757      }
757758      else
r3957r3958
804805               | ((vg->dvy >> 1) & 2)
805806               | ((vg->dvy << 1) & 4)
806807               | ((vg->dvy << 2) & 8)
807               | ((mame_rand(Machine) & 0x7) << 4);
808               | ((mame_rand(vg->machine) & 0x7) << 4);
808809         }
809810         else
810811         {
r3957r3958
12401241         */
12411242      vector_clear_list();
12421243   }
1243   vg_flush();
1244   vg_flush(space->machine);
12441245
12451246   vgc->vggo(vg);
12461247   vg_set_halt(0);
r3957r3958
14541455{
14551456   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
14561457
1458   vg = &vgd;
1459   vg->machine = machine;
1460
14571461   xmin = visarea->min_x;
14581462   ymin = visarea->min_y;
14591463   xmax = visarea->max_x;
r3957r3958
14851489
14861490   vgc = &dvg_default;
14871491   vg = &vgd;
1492   vg->machine = machine;
14881493
14891494   xmin = visarea->min_x;
14901495   ymin = visarea->min_y;
r3957r3958
14991504VIDEO_START( avg )
15001505{
15011506   vgc = &avg_default;
1502   vg = &vgd;
15031507   VIDEO_START_CALL(avg_common);
15041508}
15051509
15061510VIDEO_START( avg_starwars )
15071511{
15081512   vgc = &avg_starwars;
1509   vg = &vgd;
15101513   VIDEO_START_CALL(avg_common);
15111514}
15121515
15131516VIDEO_START( avg_tempest )
15141517{
15151518   vgc = &avg_tempest;
1516   vg = &vgd;
15171519   VIDEO_START_CALL(avg_common);
15181520}
15191521
15201522VIDEO_START( avg_mhavoc )
15211523{
15221524   vgc = &avg_mhavoc;
1523   vg = &vgd;
15241525   VIDEO_START_CALL(avg_common);
15251526}
15261527
15271528VIDEO_START( avg_bzone )
15281529{
15291530   vgc = &avg_bzone;
1530   vg = &vgd;
15311531   VIDEO_START_CALL(avg_common);
15321532}
15331533
15341534VIDEO_START( avg_quantum )
15351535{
15361536   vgc = &avg_quantum;
1537   vg = &vgd;
15381537   VIDEO_START_CALL(avg_common);
15391538}
15401539
src/mame/video/kingobox.c
r3957r3958
174174      tilemap_mark_all_tiles_dirty(bg_tilemap);
175175   }
176176
177   if (flip_screen_get() != (data & 0x80))
177   if (flip_screen_get(space->machine) != (data & 0x80))
178178   {
179      flip_screen_set(data & 0x80);
179      flip_screen_set(space->machine, data & 0x80);
180180      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
181181   }
182182}
r3957r3958
229229      sx = spriteram[roffs+1];
230230      sy = spriteram[roffs];
231231
232      if (flip_screen_get())
232      if (flip_screen_get(machine))
233233      {
234234         sx = 240 - sx;
235235         sy = 240 - sy;
r3957r3958
289289      int sx = spriteram[offs+2];
290290      int sy = spriteram[offs];
291291
292      if (flip_screen_get())
292      if (flip_screen_get(machine))
293293      {
294294         sx = 240 - sx;
295295         sy = 240 - sy;
src/mame/video/blockout.c
r3957r3958
9191
9292WRITE16_HANDLER( blockout_videoram_w )
9393{
94   UINT16 oldword = blockout_videoram[offset];
9594   COMBINE_DATA(&blockout_videoram[offset]);
9695
97   if (oldword != blockout_videoram[offset])
98      update_pixels(space->machine->primary_screen, (offset % 256)*2, (offset / 256) % 256);
96   update_pixels(space->machine->primary_screen, (offset % 256)*2, (offset / 256) % 256);
9997}
10098
10199
src/mame/video/tsamurai.c
r3957r3958
173173      /* So I'm using this specific check. -kal 11 jul 2002 */
174174//      if(sprite_type == 1) sy=sy+2;
175175
176      if( flip_screen_get() )
176      if( flip_screen_get(machine) )
177177      {
178178         drawgfx( bitmap,gfx,
179179            sprite_number&0x7f,
src/mame/video/kan_panb.c
r3957r3958
3030      x = dx;
3131      y = dy;
3232
33      if (flip_screen_get())
33      if (flip_screen_get(screen->machine))
3434      {
3535         sx = 240 - x;
3636         sy = 240 - y;
r3957r3958
6262      x = dx;
6363      y = dy;
6464
65      if (flip_screen_get())
65      if (flip_screen_get(screen->machine))
6666      {
6767         sx = 240 - x;
6868         sy = 240 - y;
r3957r3958
117117      x = dx;
118118      y = dy;
119119
120      if (flip_screen_get())
120      if (flip_screen_get(screen->machine))
121121      {
122122         sx = 240 - x;
123123         sy = 240 - y;
r3957r3958
165165
166166      if (wrapr == 8) xpos -= 256;
167167
168      if (flip_screen_get())
168      if (flip_screen_get(screen->machine))
169169      {
170170         xpos = 240 - xpos;
171171         ypos = 240 - ypos;
r3957r3958
245245      if (x > 511) x &= 0x1ff;
246246      if (y > 511) y &= 0x1ff;
247247
248      if (flip_screen_get())
248      if (flip_screen_get(screen->machine))
249249      {
250250         sx = 240 - x;
251251         sy = 240 - y;
src/mame/video/exzisus.c
r3957r3958
138138            x = (sx + (xc << 3)) & 0xff;
139139            y = (sy + (yc << 3)) & 0xff;
140140
141            if (flip_screen_get())
141            if (flip_screen_get(screen->machine))
142142            {
143143               x = 248 - x;
144144               y = 248 - y;
r3957r3958
147147            drawgfx(bitmap, screen->machine->gfx[0],
148148                  code & 0x3fff,
149149                  color,
150                  flip_screen_get(), flip_screen_get(),
150                  flip_screen_get(screen->machine), flip_screen_get(screen->machine),
151151                  x, y,
152152                  cliprect, TRANSPARENCY_PEN, 15);
153153            goffs += 2;
r3957r3958
208208            x = (sx + (xc << 3)) & 0xff;
209209            y = (sy + (yc << 3)) & 0xff;
210210
211            if (flip_screen_get())
211            if (flip_screen_get(screen->machine))
212212            {
213213               x = 248 - x;
214214               y = 248 - y;
r3957r3958
217217            drawgfx(bitmap, screen->machine->gfx[1],
218218                  code & 0x3fff,
219219                  color,
220                  flip_screen_get(), flip_screen_get(),
220                  flip_screen_get(screen->machine), flip_screen_get(screen->machine),
221221                  x, y,
222222                  cliprect, TRANSPARENCY_PEN, 15);
223223            goffs += 2;
src/mame/video/tx1.c
r3957r3958
66
77#include "driver.h"
88#include "render.h"
9#include "video/resnet.h"
910#include "cpu/i86/i86.h"
10#include "video/resnet.h"
1111#include "tx1.h"
1212
1313
src/mame/video/dassault.c
r3957r3958
7171            inc = 1;
7272         }
7373
74         if (flip_screen_get()) {
74         if (flip_screen_get(machine)) {
7575            y=240-y;
7676            x=304-x;
7777            if (fx) fx=0; else fx=1;
r3957r3958
166166VIDEO_UPDATE( dassault )
167167{
168168   /* Update tilemaps */
169   flip_screen_set( deco16_pf12_control[0]&0x80 );
169   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
170170   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
171171   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
172172
src/mame/video/gotya.c
r3957r3958
8787
8888   scroll_bit_8 = data & 0x01;
8989
90   if (flip_screen_get() != (data & 0x02))
90   if (flip_screen_get(space->machine) != (data & 0x02))
9191   {
92      flip_screen_set(data & 0x02);
92      flip_screen_set(space->machine, data & 0x02);
9393      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
9494   }
9595}
r3957r3958
120120{
121121   int row;
122122
123   if (flip_screen_get())
123   if (flip_screen_get(machine))
124124   {
125125      sx = 35 - sx;
126126   }
r3957r3958
129129   {
130130      int sy;
131131
132      if (flip_screen_get())
132      if (flip_screen_get(machine))
133133      {
134134         sy = row;
135135      }
r3957r3958
141141      drawgfx(bitmap,machine->gfx[0],
142142         gotya_videoram2[row * 32 + col],
143143         gotya_videoram2[row * 32 + col + 0x10] & 0x0f,
144         flip_screen_x_get(), flip_screen_y_get(),
144         flip_screen_x_get(machine), flip_screen_y_get(machine),
145145         8 * sx, 8 * sy,
146146         cliprect,
147147         TRANSPARENCY_NONE, 0);
r3957r3958
159159      int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256;
160160      int sy = spriteram[offs + 0x00];
161161
162      if (flip_screen_get())
162      if (flip_screen_get(machine))
163163      {
164164         sy = 240 - sy;
165165      }
166166
167167      drawgfx(bitmap,machine->gfx[1],
168168         code, color,
169         flip_screen_x_get(), flip_screen_y_get(),
169         flip_screen_x_get(machine), flip_screen_y_get(machine),
170170         sx, sy,
171171         cliprect,
172172         TRANSPARENCY_PEN, 0);
src/mame/video/aztarac.c
r3957r3958
88#include "video/vector.h"
99#include "aztarac.h"
1010
11#define AVECTOR(x, y, color, intensity) \
12vector_add_point (xcenter + ((x) << 16), ycenter - ((y) << 16), color, intensity)
11#define AVECTOR(m, x, y, color, intensity) \
12vector_add_point (m, xcenter + ((x) << 16), ycenter - ((y) << 16), color, intensity)
1313
1414UINT16 *aztarac_vectorram;
1515
r3957r3958
4444            if ((c & 0x2000) == 0)
4545            {
4646                defaddr = (c >> 1) & 0x7ff;
47                AVECTOR (xoffset, yoffset, 0, 0);
47                AVECTOR (space->machine, xoffset, yoffset, 0, 0);
4848
4949                read_vectorram (defaddr, &x, &ndefs, &c);
5050            ndefs++;
r3957r3958
5959                        defaddr++;
6060                        read_vectorram (defaddr, &x, &y, &c);
6161                        if ((c & 0xff00) == 0)
62                            AVECTOR (x + xoffset, y + yoffset, 0, 0);
62                            AVECTOR (space->machine, x + xoffset, y + yoffset, 0, 0);
6363                        else
64                            AVECTOR (x + xoffset, y + yoffset, color, intensity);
64                            AVECTOR (space->machine, x + xoffset, y + yoffset, color, intensity);
6565                    }
6666                }
6767                else
r3957r3958
7272                        defaddr++;
7373                        read_vectorram (defaddr, &x, &y, &c);
7474                  color = VECTOR_COLOR222(c & 0x3f);
75                        AVECTOR (x + xoffset, y + yoffset, color, c >> 8);
75                        AVECTOR (space->machine, x + xoffset, y + yoffset, color, c >> 8);
7676                    }
7777                }
7878            }
src/mame/video/supbtime.c
r3957r3958
5757         inc = 1;
5858      }
5959
60      if (flip_screen_get())
60      if (flip_screen_get(machine))
6161      {
6262         y=240-y;
6363         x=304-x;
r3957r3958
9090
9191VIDEO_UPDATE(supbtime)
9292{
93   flip_screen_set( deco16_pf12_control[0]&0x80 );
93   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
9494   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
9595
9696   bitmap_fill(bitmap,cliprect,768);
src/mame/video/retofinv.c
r3957r3958
147147   switch (offset)
148148   {
149149      case 0:
150         flip_screen_set(data & 1);
150         flip_screen_set(space->machine, data & 1);
151151         break;
152152
153153      case 1:
r3957r3958
206206      sprite &= ~sizex;
207207      sprite &= ~(sizey << 1);
208208
209      if (flip_screen_get())
209      if (flip_screen_get(machine))
210210      {
211211         flipx ^= 1;
212212         flipy ^= 1;
src/mame/video/bogeyman.c
r3957r3958
118118
119119         if (multi) sy -= 16;
120120
121         if (flip_screen_get())
121         if (flip_screen_get(machine))
122122         {
123123            sx = 240 - sx;
124124            sy = 240 - sy;
r3957r3958
138138            drawgfx(bitmap,machine->gfx[2],
139139               code + 1, color,
140140               flipx, flipy,
141               sx, sy + (flip_screen_get() ? -16 : 16),
141               sx, sy + (flip_screen_get(machine) ? -16 : 16),
142142               cliprect,
143143               TRANSPARENCY_PEN, 0);
144144         }
src/mame/video/m72.c
r3957r3958
348348      coin_counter_w(1,data & 0x02);
349349
350350      /* bit 2 is flip screen (handled both by software and hardware) */
351      flip_screen_set(((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1));
351      flip_screen_set(space->machine, ((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1));
352352
353353      /* bit 3 is display disable */
354354      video_off = data & 0x08;
r3957r3958
374374      coin_counter_w(1,data & 0x02);
375375
376376      /* bit 2 is flip screen (handled both by software and hardware) */
377      flip_screen_set(((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1));
377      flip_screen_set(space->machine, ((data & 0x04) >> 2) ^ ((~input_port_read(space->machine, "DSW") >> 8) & 1));
378378
379379      /* bit 3 is display disable */
380380      video_off = data & 0x08;
r3957r3958
424424      h = 1 << ((m72_spriteram[offs+2] & 0x3000) >> 12);
425425      sy -= 16 * h;
426426
427      if (flip_screen_get())
427      if (flip_screen_get(machine))
428428      {
429429         sx = 512 - 16*w - sx;
430430         sy = 284 - 16*h - sy;
r3957r3958
476476      h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12);
477477      sy -= 16 * h;
478478
479      if (flip_screen_get())
479      if (flip_screen_get(machine))
480480      {
481481         sx = 512 - 16*w - sx;
482482         sy = 256 - 16*h - sy;
src/mame/video/pokechmp.c
r3957r3958
1212
1313WRITE8_HANDLER( pokechmp_flipscreen_w )
1414{
15   if (flip_screen_get() != (data & 0x80))
15   if (flip_screen_get(space->machine) != (data & 0x80))
1616   {
17      flip_screen_set(data & 0x80);
17      flip_screen_set(space->machine, data & 0x80);
1818      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
1919   }
2020}
r3957r3958
4949
5050         flipx = spriteram[offs+1] & 0x04;
5151         flipy = spriteram[offs+1] & 0x02;
52         if (flip_screen_get()) {
52         if (flip_screen_get(machine)) {
5353            sx=240-sx;
5454            sy=240-sy;
5555            if (flipx) flipx=0; else flipx=1;
src/mame/video/madalien.c
r3957r3958
379379static const mc6845_interface mc6845_intf =
380380{
381381   "main",            /* screen we are acting on */
382   PIXEL_CLOCK / 8,  /* the clock of the chip  */
383382   8,                /* number of pixels per video memory address */
384383   NULL,             /* before pixel update callback */
385384   NULL,             /* row update callback */
r3957r3958
401400   MDRV_VIDEO_START(madalien)
402401   MDRV_VIDEO_UPDATE(madalien)
403402
404   MDRV_DEVICE_ADD("crtc", MC6845)
405   MDRV_DEVICE_CONFIG(mc6845_intf)
403   MDRV_MC6845_ADD("crtc", MC6845, PIXEL_CLOCK / 8, mc6845_intf)
406404MACHINE_DRIVER_END
src/mame/video/aeroboto.c
r3957r3958
7575
7676READ8_HANDLER( aeroboto_in0_r )
7777{
78   return input_port_read(space->machine, flip_screen_get() ? "P2" : "P1");
78   return input_port_read(space->machine, flip_screen_get(space->machine) ? "P2" : "P1");
7979}
8080
8181WRITE8_HANDLER( aeroboto_3000_w )
8282{
8383   /* bit 0 selects both flip screen and player1/player2 controls */
84   flip_screen_set(data & 0x01);
84   flip_screen_set(space->machine, data & 0x01);
8585
8686   /* bit 1 = char bank select */
8787   if (aeroboto_charbank != ((data & 0x02) >> 1))
r3957r3958
126126      int x = spriteram[offs+3];
127127      int y = 240 - spriteram[offs];
128128
129      if (flip_screen_get())
129      if (flip_screen_get(machine))
130130      {
131131         x = 248 - x;
132132         y = 240 - y;
r3957r3958
135135      drawgfx(bitmap, machine->gfx[1],
136136            spriteram[offs+1],
137137            spriteram[offs+2] & 0x07,
138            flip_screen_get(), flip_screen_get(),
138            flip_screen_get(machine), flip_screen_get(machine),
139139            ((x + 8) & 0xff) - 8, y,
140140            cliprect, TRANSPARENCY_PEN, 0);
141141   }
src/mame/video/firetrap.c
r3957r3958
227227      color = ((spriteram[offs + 1] & 0x08) >> 2) | (spriteram[offs + 1] & 0x01);
228228      flipx = spriteram[offs + 1] & 0x04;
229229      flipy = spriteram[offs + 1] & 0x02;
230      if (flip_screen_get())
230      if (flip_screen_get(machine))
231231      {
232232         sx = 240 - sx;
233233         sy = 240 - sy;
r3957r3958
237237
238238      if (spriteram[offs + 1] & 0x10)   /* double width */
239239      {
240         if (flip_screen_get()) sy -= 16;
240         if (flip_screen_get(machine)) sy -= 16;
241241
242242         drawgfx(bitmap,machine->gfx[3],
243243               code & ~1,
src/mame/video/thedeep.c
r3957r3958
176176      if (color & 1)   sx -= 256;
177177      if (attr  & 1)   sy -= 256;
178178
179      if (flip_screen_get())
179      if (flip_screen_get(machine))
180180      {
181181         flipx = !flipx;
182182         flipy = !flipy;
src/mame/video/amspdwy.c
r3957r3958
2929{
3030   static int flip = 0;
3131   flip ^= 1;
32   flip_screen_set( flip );
32   flip_screen_set(space->machine, flip );
3333}
3434
3535/***************************************************************************
r3957r3958
117117      int flipx   =   attr & 0x80;
118118      int flipy   =   attr & 0x40;
119119
120      if (flip_screen_get())
120      if (flip_screen_get(machine))
121121      {
122122         x = max_x - x - 8;   y = max_y - y - 8;
123123         flipx = !flipx;   flipy = !flipy;
src/mame/video/srumbler.c
r3957r3958
8484WRITE8_HANDLER( srumbler_4009_w )
8585{
8686   /* bit 0 flips screen */
87   flip_screen_set(data & 1);
87   flip_screen_set(space->machine, data & 1);
8888
8989   /* bits 4-5 used during attract mode, unknown */
9090
r3957r3958
142142      sx = buffered_spriteram[offs + 3] + 0x100 * ( attr & 0x01);
143143      flipy = attr & 0x02;
144144
145      if (flip_screen_get())
145      if (flip_screen_get(machine))
146146      {
147147         sx = 496 - sx;
148148         sy = 240 - sy;
r3957r3958
152152      drawgfx(bitmap,machine->gfx[2],
153153            code,
154154            colour,
155            flip_screen_get(),flipy,
155            flip_screen_get(machine),flipy,
156156            sx, sy,
157157            cliprect,TRANSPARENCY_PEN,15);
158158   }
src/mame/video/pbaction.c
r3957r3958
4141WRITE8_HANDLER( pbaction_scroll_w )
4242{
4343   scroll = data - 3;
44   if (flip_screen_get()) scroll = -scroll;
44   if (flip_screen_get(space->machine)) scroll = -scroll;
4545   tilemap_set_scrollx(bg_tilemap, 0, scroll);
4646   tilemap_set_scrollx(fg_tilemap, 0, scroll);
4747}
4848
4949WRITE8_HANDLER( pbaction_flipscreen_w )
5050{
51   flip_screen_set(data & 0x01);
51   flip_screen_set(space->machine, data & 0x01);
5252}
5353
5454static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
100100         sy = 241-spriteram[offs+2];
101101      flipx = spriteram[offs+1] & 0x40;
102102      flipy =   spriteram[offs+1] & 0x80;
103      if (flip_screen_get())
103      if (flip_screen_get(machine))
104104      {
105105         if (spriteram[offs] & 0x80)
106106         {
r3957r3958
120120            spriteram[offs],
121121            spriteram[offs + 1] & 0x0f,
122122            flipx,flipy,
123            sx + (flip_screen_get() ? scroll : -scroll), sy,
123            sx + (flip_screen_get(machine) ? scroll : -scroll), sy,
124124            cliprect,TRANSPARENCY_PEN,0);
125125   }
126126}
src/mame/video/funworld.c
r3957r3958
88    Written by Roberto Fresca.
99
1010
11    Games running in this hardware:
11    Games running on this hardware:
1212
1313    * Jolly Card (austrian),                            TAB-Austria,        1985.
1414    * Jolly Card (3x3 deal),                            TAB-Austria,        1985.
r3957r3958
1717    * Jolly Card (croatian, set 1),                     TAB-Austria,        1985.
1818    * Jolly Card (croatian, set 2),                     Soft Design,        1993.
1919    * Jolly Card (italian, blue TAB board, encrypted),  bootleg,            199?.
20    * Jolly Card (italian, encrypted bootleg),          bootleg,            1990.
2021    * Super Joly 2000 - 3x,                             M.P.                1985.
2122    * Jolly Card (austrian, Funworld, bootleg),         Inter Games,        1986.
2223    * Big Deal (hungarian, set 1),                      Funworld,           1986.
src/mame/video/spcforce.c
r3957r3958
1414
1515WRITE8_HANDLER( spcforce_flip_screen_w )
1616{
17   flip_screen_set(~data & 0x01);
17   flip_screen_set(space->machine, ~data & 0x01);
1818}
1919
2020
r3957r3958
3939      code = videoram[offs] + ((colorram[offs] & 0x01) << 8);
4040      col  = (~colorram[offs] >> 4) & 0x07;
4141
42      if (flip_screen_get())
42      if (flip_screen_get(screen->machine))
4343      {
4444         sx = 248 - sx;
4545         sy = 248 - sy;
r3957r3958
4747
4848      drawgfx(bitmap,screen->machine->gfx[0],
4949            code, col,
50            flip_screen_get(), flip_screen_get(),
50            flip_screen_get(screen->machine), flip_screen_get(screen->machine),
5151            sx, sy,
5252            cliprect,TRANSPARENCY_PEN,0);
5353   }
src/mame/video/exprraid.c
r3957r3958
1818
1919WRITE8_HANDLER( exprraid_flipscreen_w )
2020{
21   if (flip_screen_get() != (data & 0x01))
21   if (flip_screen_get(space->machine) != (data & 0x01))
2222   {
23      flip_screen_set(data & 0x01);
23      flip_screen_set(space->machine, data & 0x01);
2424      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
2525   }
2626}
r3957r3958
106106      int sx = ((248 - spriteram[offs + 2]) & 0xff) - 8;
107107      int sy = spriteram[offs];
108108
109      if (flip_screen_get())
109      if (flip_screen_get(machine))
110110      {
111111         sx = 240 - sx;
112112         sy = 240 - sy;
r3957r3958
127127         drawgfx(bitmap,machine->gfx[1],
128128            code + 1, color,
129129            flipx, flipy,
130            sx, sy + (flip_screen_get() ? -16 : 16),
130            sx, sy + (flip_screen_get(machine) ? -16 : 16),
131131            cliprect, TRANSPARENCY_PEN, 0);
132132      }
133133   }
src/mame/video/tecmo16.c
r3957r3958
170170WRITE16_HANDLER( tecmo16_flipscreen_w )
171171{
172172   flipscreen = data & 0x01;
173   flip_screen_set(flipscreen);
173   flip_screen_set(space->machine, flipscreen);
174174}
175175
176176/******************************************************************************/
src/mame/video/kchamp.c
r3957r3958
3838
3939WRITE8_HANDLER( kchamp_flipscreen_w )
4040{
41   flip_screen_set(data & 0x01);
41   flip_screen_set(space->machine, data & 0x01);
4242}
4343
4444static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
8080        int sx = spriteram[offs + 3] - 8;
8181        int sy = 247 - spriteram[offs];
8282
83      if (flip_screen_get())
83      if (flip_screen_get(machine))
8484      {
8585         sx = 240 - sx;
8686         sy = 240 - sy;
r3957r3958
108108        int sx = spriteram[offs + 3];
109109        int sy = 240 - spriteram[offs];
110110
111      if (flip_screen_get())
111      if (flip_screen_get(machine))
112112      {
113113         sx = 240 - sx;
114114         sy = 240 - sy;
src/mame/video/digdug.c
r3957r3958
134134       characters when screen is flipped, we have to flip them back. */
135135   SET_TILE_INFO(
136136         0,
137         (code & 0x7f) | (flip_screen_get() ? 0x80 : 0),
137         (code & 0x7f) | (flip_screen_get(machine) ? 0x80 : 0),
138138         color,
139         flip_screen_get() ? TILE_FLIPX : 0);
139         flip_screen_get(machine) ? TILE_FLIPX : 0);
140140}
141141
142142
r3957r3958
235235         break;
236236
237237      case 7:   /* FLIP */
238         flip_screen_set(data & 1);
238         flip_screen_set(space->machine, data & 1);
239239         break;
240240   }
241241}
r3957r3958
280280      sy -= 16 * size;
281281      sy = (sy & 0xff) - 32;   // fix wraparound
282282
283      if (flip_screen_get())
283      if (flip_screen_get(machine))
284284      {
285285         flipx ^= 1;
286286         flipy ^= 1;
src/mame/video/scotrsht.c
r3957r3958
108108      int sx = spriteram[i + 2] - ((attr & 0x80) << 1);
109109      int sy = spriteram[i + 3];
110110
111      if (flip_screen_get())
111      if (flip_screen_get(machine))
112112      {
113113         sx = 240 - sx;
114114         sy = 240 - sy;
src/mame/video/markham.c
r3957r3958
5151
5252WRITE8_HANDLER( markham_flipscreen_w )
5353{
54   if (flip_screen_get() != (data & 0x01))
54   if (flip_screen_get(space->machine) != (data & 0x01))
5555   {
56      flip_screen_set(data & 0x01);
56      flip_screen_set(space->machine, data & 0x01);
5757      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
5858   }
5959}
r3957r3958
8484      int chr = spriteram[offs+1];
8585      int col = spriteram[offs+2];
8686
87      int fx = flip_screen_get();
88      int fy = flip_screen_get();
87      int fx = flip_screen_get(machine);
88      int fy = flip_screen_get(machine);
8989
9090      int x = spriteram[offs+3];
9191      int y = spriteram[offs+0];
9292      int px,py;
9393      col &= 0x3f ;
9494
95      if (flip_screen_get()==0)
95      if (flip_screen_get(machine)==0)
9696      {
9797         px = x-2;
9898         py = 240-y;
src/mame/video/superqix.c
r3957r3958
138138   memory_set_bank(space->machine, 1, (data & 0x08) >> 3);
139139
140140   interrupt_enable_w(space,0,data & 0x10);
141   flip_screen_set(data & 0x20);
141   flip_screen_set(space->machine, data & 0x20);
142142}
143143
144144WRITE8_HANDLER( superqix_0410_w )
r3957r3958
180180      int sx = spriteram[offs + 1] + 256 * (spriteram[offs] & 0x01);
181181      int sy = spriteram[offs + 2];
182182
183      if (flip_screen_get())
183      if (flip_screen_get(machine))
184184      {
185185         sx = 240 - sx;
186186         sy = 240 - sy;
r3957r3958
189189      drawgfx(bitmap,machine->gfx[1],
190190            code,
191191            color,
192            flip_screen_get(), flip_screen_get(),
192            flip_screen_get(machine), flip_screen_get(machine),
193193            sx, sy,
194194            cliprect, TRANSPARENCY_PEN, 0);
195195   }
r3957r3958
209209      int sx = spriteram[offs + 1];
210210      int sy = spriteram[offs + 2];
211211
212      if (flip_screen_get())
212      if (flip_screen_get(machine))
213213      {
214214         sx = 240 - sx;
215215         sy = 240 - sy;
r3957r3958
255255VIDEO_UPDATE( superqix )
256256{
257257   tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_LAYER1, 0);
258   copybitmap_trans(bitmap,fg_bitmap[show_bitmap],flip_screen_get(),flip_screen_get(),0,0,cliprect,0);
258   copybitmap_trans(bitmap,fg_bitmap[show_bitmap],flip_screen_get(screen->machine),flip_screen_get(screen->machine),0,0,cliprect,0);
259259   superqix_draw_sprites(screen->machine, bitmap,cliprect);
260260   tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_LAYER0, 0);
261261   return 0;
src/mame/video/playch10.c
r3957r3958
11#include "driver.h"
2#include "deprecat.h"
32#include "video/ppu2c0x.h"
43#include "includes/playch10.h"
54
r3957r3958
5857   ppu2c0x_init_palette(machine, 256 );
5958}
6059
61static void ppu_irq( int num, int *ppu_regs )
60static void ppu_irq( running_machine *machine, int num, int *ppu_regs )
6261{
63   cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE );
62   cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE );
6463   pc10_int_detect = 1;
6564}
6665
src/mame/video/lockon.c
r3957r3958
66
77#include "driver.h"
88#include "lockon.h"
9#include "cpu/nec/nec.h"
910#include "video/resnet.h"
10#include "cpu/nec/nec.h"
1111
1212#define CURSOR_XPOS         168
1313#define CURSOR_YPOS         239
src/mame/video/mappy.c
r3957r3958
377377
378378WRITE8_HANDLER( superpac_flipscreen_w )
379379{
380   flip_screen_set(data & 1);
380   flip_screen_set(space->machine, data & 1);
381381}
382382
383383READ8_HANDLER( superpac_flipscreen_r )
384384{
385   flip_screen_set(1);
385   flip_screen_set(space->machine, 1);
386386   return 0xff;
387387}
388388
r3957r3958
430430         sy -= 16 * sizey;
431431         sy = (sy & 0xff) - 32;   // fix wraparound
432432
433         if (flip_screen_get())
433         if (flip_screen_get(machine))
434434         {
435435            flipx ^= 1;
436436            flipy ^= 1;
r3957r3958
506506         sy -= 8 * sizey;
507507         sy = (sy & 0xff) - 32;   // fix wraparound
508508
509         if (flip_screen_get())
509         if (flip_screen_get(machine))
510510         {
511511            flipx ^= 1;
512512            flipy ^= 1;
r3957r3958
562562VIDEO_UPDATE( phozon )
563563{
564564   /* flip screen control is embedded in RAM */
565   flip_screen_set(mappy_spriteram[0x1f7f-0x800] & 1);
565   flip_screen_set(screen->machine, mappy_spriteram[0x1f7f-0x800] & 1);
566566
567567   tilemap_set_scrolldx(bg_tilemap, 0, 96);
568568   tilemap_set_scrolldy(bg_tilemap, 0, 0);
src/mame/video/tigeroad.c
r3957r3958
1919
2020      /* bit 1 flips screen */
2121
22      if (flip_screen_get() != (data & 0x02))
22      if (flip_screen_get(space->machine) != (data & 0x02))
2323      {
24         flip_screen_set(data & 0x02);
24         flip_screen_set(space->machine, data & 0x02);
2525         tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
2626      }
2727
r3957r3958
8888         if (sx > 0x100) sx -= 0x200;
8989         if (sy > 0x100) sy -= 0x200;
9090
91         if (flip_screen_get())
91         if (flip_screen_get(machine))
9292         {
9393            sx = 240 - sx;
9494            sy = 240 - sy;
src/mame/video/atari.c
r3957r3958
77******************************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1110#include "includes/atari.h"
1211#include "video/gtia.h"
1312
r3957r3958
12431242
12441243
12451244
1246INLINE void LMS(int new_cmd)
1245INLINE void LMS(running_machine *machine, int new_cmd)
12471246{
12481247    /**************************************************************
12491248     * If the LMS bit (load memory scan) of the current display
r3957r3958
12531252     **************************************************************/
12541253    if( new_cmd & ANTIC_LMS )
12551254    {
1256       const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1255       const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
12571256      int addr = RDANTIC(space);
12581257        antic.doffs = ++antic.doffs & DOFFS;
12591258        addr += 256 * RDANTIC(space);
r3957r3958
13791378               }
13801379               break;
13811380            case 0x02:
1382               LMS(new_cmd);
1381               LMS(machine, new_cmd);
13831382               antic.chbase = (antic.w.chbash & 0xfc) << 8;
13841383               antic.modelines = 8 - (vscrol_subtract & 7);
13851384               if( antic.w.chactl & 4 )   /* decrement chbasl? */
13861385                  antic.w.chbasl = antic.modelines - 1;
13871386               break;
13881387            case 0x03:
1389               LMS(new_cmd);
1388               LMS(machine, new_cmd);
13901389               antic.chbase = (antic.w.chbash & 0xfc) << 8;
13911390               antic.modelines = 10 - (vscrol_subtract & 9);
13921391               if( antic.w.chactl & 4 )   /* decrement chbasl? */
13931392                  antic.w.chbasl = antic.modelines - 1;
13941393               break;
13951394            case 0x04:
1396               LMS(new_cmd);
1395               LMS(machine, new_cmd);
13971396               antic.chbase = (antic.w.chbash & 0xfc) << 8;
13981397               antic.modelines = 8 - (vscrol_subtract & 7);
13991398               if( antic.w.chactl & 4 )   /* decrement chbasl? */
14001399                  antic.w.chbasl = antic.modelines - 1;
14011400               break;
14021401            case 0x05:
1403               LMS(new_cmd);
1402               LMS(machine, new_cmd);
14041403               antic.chbase = (antic.w.chbash & 0xfc) << 8;
14051404               antic.modelines = 16 - (vscrol_subtract & 15);
14061405               if( antic.w.chactl & 4 )   /* decrement chbasl? */
14071406                  antic.w.chbasl = antic.modelines - 1;
14081407               break;
14091408            case 0x06:
1410               LMS(new_cmd);
1409               LMS(machine, new_cmd);
14111410               antic.chbase = (antic.w.chbash & 0xfe) << 8;
14121411               antic.modelines = 8 - (vscrol_subtract & 7);
14131412               if( antic.w.chactl & 4 )   /* decrement chbasl? */
14141413                  antic.w.chbasl = antic.modelines - 1;
14151414               break;
14161415            case 0x07:
1417               LMS(new_cmd);
1416               LMS(machine, new_cmd);
14181417               antic.chbase = (antic.w.chbash & 0xfe) << 8;
14191418               antic.modelines = 16 - (vscrol_subtract & 15);
14201419               if( antic.w.chactl & 4 )   /* decrement chbasl? */
14211420                  antic.w.chbasl = antic.modelines - 1;
14221421               break;
14231422            case 0x08:
1424               LMS(new_cmd);
1423               LMS(machine, new_cmd);
14251424               antic.modelines = 8 - (vscrol_subtract & 7);
14261425               break;
14271426            case 0x09:
1428               LMS(new_cmd);
1427               LMS(machine, new_cmd);
14291428               antic.modelines = 4 - (vscrol_subtract & 3);
14301429               break;
14311430            case 0x0a:
1432               LMS(new_cmd);
1431               LMS(machine, new_cmd);
14331432               antic.modelines = 4 - (vscrol_subtract & 3);
14341433               break;
14351434            case 0x0b:
1436               LMS(new_cmd);
1435               LMS(machine, new_cmd);
14371436               antic.modelines = 2 - (vscrol_subtract & 1);
14381437               break;
14391438            case 0x0c:
1440               LMS(new_cmd);
1439               LMS(machine, new_cmd);
14411440               antic.modelines = 1;
14421441                    break;
14431442            case 0x0d:
1444               LMS(new_cmd);
1443               LMS(machine, new_cmd);
14451444               antic.modelines = 2 - (vscrol_subtract & 1);
14461445               break;
14471446            case 0x0e:
1448               LMS(new_cmd);
1447               LMS(machine, new_cmd);
14491448               antic.modelines = 1;
14501449                    break;
14511450            case 0x0f:
1452               LMS(new_cmd);
1451               LMS(machine, new_cmd);
14531452               /* bits 6+7 of the priority select register determine */
14541453               /* if newer GTIA or plain graphics modes are used */
14551454               switch (gtia.w.prior >> 6)
src/mame/video/quizdna.c
r3957r3958
119119
120120   quizdna_flipscreen = tmp;
121121
122   flip_screen_set(tmp);
122   flip_screen_set(space->machine, tmp);
123123   tilemap_set_scrolldx( quizdna_fg_tilemap, 64, -64 +16);
124124}
125125
src/mame/video/kan_pand.c
r3957r3958
119119         y = dy;
120120      }
121121
122      if (flip_screen_get())
122      if (flip_screen_get(machine))
123123      {
124124         sx = 240 - x;
125125         sy = 240 - y;
src/mame/video/boogwing.c
r3957r3958
44static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, UINT16* spriteram_base, int gfx_region)
55{
66   int offs;
7   int flipscreen=!flip_screen_get();
7   int flipscreen=!flip_screen_get(machine);
88
99   for (offs = 0x400-4;offs >= 0;offs -= 4)
1010   {
r3957r3958
158158
159159VIDEO_UPDATE(boogwing)
160160{
161   flip_screen_set( deco16_pf12_control[0]&0x80 );
161   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
162162   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
163163   deco16_pf34_update(deco16_pf3_rowscroll,deco16_pf4_rowscroll);
164164
src/mame/video/equites.c
r3957r3958
212212
213213WRITE16_HANDLER(equites_flip0_w)
214214{
215   flip_screen_set(0);
215   flip_screen_set(space->machine, 0);
216216}
217217
218218WRITE16_HANDLER(equites_flip1_w)
219219{
220   flip_screen_set(1);
220   flip_screen_set(space->machine, 1);
221221}
222222
223223WRITE16_HANDLER(splndrbt_flip0_w)
224224{
225225   if (ACCESSING_BITS_0_7)
226      flip_screen_set(0);
226      flip_screen_set(space->machine, 0);
227227
228228   if (ACCESSING_BITS_8_15)
229229      bgcolor = data >> 8;
r3957r3958
232232WRITE16_HANDLER(splndrbt_flip1_w)
233233{
234234   if (ACCESSING_BITS_0_7)
235      flip_screen_set(1);
235      flip_screen_set(space->machine, 1);
236236}
237237
238238WRITE16_HANDLER(splndrbt_bg_scrollx_w)
r3957r3958
269269         int sy = (spriteram16[offs] & 0x00ff);
270270         int transmask = colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0);
271271
272         if (flip_screen_get())
272         if (flip_screen_get(machine))
273273         {
274274            sx = 240 - sx;
275275            sy = 240 - sy;
r3957r3958
357357
358358      sy += 16;
359359
360      if (flip_screen_get())
360      if (flip_screen_get(machine))
361361      {
362362         // sx NOT inverted
363363         fx = fx ^ 1;
r3957r3958
409409   const UINT8 * const yrom = xrom + 0x2000;
410410   int scroll_x = splndrbt_bg_scrollx;
411411   int scroll_y = splndrbt_bg_scrolly;
412   int const dinvert = flip_screen_get() ? 0xff : 0x00;
412   int const dinvert = flip_screen_get(machine) ? 0xff : 0x00;
413413   int src_y = 0;
414414   int dst_y;
415415
416   if (flip_screen_get())
416   if (flip_screen_get(machine))
417417   {
418418      scroll_x = -scroll_x - 8;
419419      scroll_y = -scroll_y;
src/mame/video/decocass.c
r3957r3958
427427      flipx = sprite_ram[offs + 0] & 0x04;
428428      flipy = sprite_ram[offs + 0] & 0x02;
429429
430      if (flip_screen_get())
430      if (flip_screen_get(machine))
431431      {
432432         sx = 240 - sx;
433433         sy = 240 - sy + sprite_y_adjust_flip_screen;
r3957r3958
445445            sx,sy,
446446            cliprect, TRANSPARENCY_PEN, 0);
447447
448      sy += (flip_screen_get() ? -256 : 256);
448      sy += (flip_screen_get(machine) ? -256 : 256);
449449
450450      // Wrap around
451451      drawgfx(bitmap,machine->gfx[1],
r3957r3958
458458}
459459
460460
461static void draw_missiles(bitmap_t *bitmap, const rectangle *cliprect,
461static void draw_missiles(running_machine *machine,bitmap_t *bitmap, const rectangle *cliprect,
462462                  int missile_y_adjust, int missile_y_adjust_flip_screen,
463463                  UINT8 *missile_ram, int interleave)
464464{
r3957r3958
472472
473473      sy = 255 - missile_ram[offs + 0*interleave];
474474      sx = 255 - missile_ram[offs + 2*interleave];
475      if (flip_screen_get())
475      if (flip_screen_get(machine))
476476      {
477477         sx = 240 - sx;
478478         sy = 240 - sy + missile_y_adjust_flip_screen;
r3957r3958
488488
489489      sy = 255 - missile_ram[offs + 1*interleave];
490490      sx = 255 - missile_ram[offs + 3*interleave];
491      if (flip_screen_get())
491      if (flip_screen_get(machine))
492492      {
493493         sx = 240 - sx;
494494         sy = 240 - sy + missile_y_adjust_flip_screen;
r3957r3958
708708   }
709709   tilemap_draw(bitmap,cliprect, fg_tilemap, 0, 0);
710710   draw_sprites(screen->machine,bitmap,cliprect, (color_center_bot >> 1) & 1, 0, 0, decocass_fgvideoram, 0x20);
711   draw_missiles(bitmap,cliprect, 1, 0, decocass_colorram, 0x20);
711   draw_missiles(screen->machine,bitmap,cliprect, 1, 0, decocass_colorram, 0x20);
712712   return 0;
713713}
714714
src/mame/video/skykid.c
r3957r3958
8383       characters when screen is flipped, we have to flip them back. */
8484   SET_TILE_INFO(
8585         0,
86         skykid_textram[tile_index] | (flip_screen_get() ? 0x100 : 0),
86         skykid_textram[tile_index] | (flip_screen_get(machine) ? 0x100 : 0),
8787         skykid_textram[tile_index + 0x400] & 0x3f,
88         flip_screen_get() ? (TILE_FLIPY | TILE_FLIPX) : 0);
88         flip_screen_get(machine) ? (TILE_FLIPY | TILE_FLIPX) : 0);
8989}
9090
9191
r3957r3958
124124   state_save_register_global(machine, scroll_x);
125125   state_save_register_global(machine, scroll_y);
126126   //FIXME: flip_screen
127   //state_save_register_global(machine, flip_screen_x_get());
127   //state_save_register_global(machine, flip_screen_x_get(machine));
128128}
129129
130130
r3957r3958
170170WRITE8_HANDLER( skykid_flipscreen_priority_w )
171171{
172172   priority = data;
173   flip_screen_set(offset & 1);
173   flip_screen_set(space->machine, offset & 1);
174174}
175175
176176
r3957r3958
206206      sprite &= ~sizex;
207207      sprite &= ~(sizey << 1);
208208
209      if (flip_screen_get())
209      if (flip_screen_get(machine))
210210      {
211211         flipx ^= 1;
212212         flipy ^= 1;
r3957r3958
234234
235235VIDEO_UPDATE( skykid )
236236{
237   if (flip_screen_get())
237   if (flip_screen_get(screen->machine))
238238   {
239239      tilemap_set_scrollx(bg_tilemap, 0, 189 - (scroll_x ^ 1));
240240      tilemap_set_scrolly(bg_tilemap, 0, 7 - scroll_y);
src/mame/video/mustache.c
r3957r3958
5252
5353WRITE8_HANDLER (mustache_video_control_w)
5454{
55   if (flip_screen_get() != (data & 0x01))
55   if (flip_screen_get(space->machine) != (data & 0x01))
5656   {
57      flip_screen_set(data & 0x01);
57      flip_screen_set(space->machine, data & 0x01);
5858      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
5959   }
6060
r3957r3958
116116      if ((control_byte & 0xa))
117117         clip.max_y = visarea->max_y;
118118      else
119         if (flip_screen_get())
119         if (flip_screen_get(machine))
120120            clip.min_y = visarea->min_y + 56;
121121         else
122122            clip.max_y = visarea->max_y - 56;
123123
124      if (flip_screen_get())
124      if (flip_screen_get(machine))
125125      {
126126         sx = 240 - sx;
127127         sy = 240 - sy;
r3957r3958
130130      drawgfx(bitmap,gfx,
131131            code,
132132            color,
133            flip_screen_get(),flip_screen_get(),
133            flip_screen_get(machine),flip_screen_get(machine),
134134            sx,sy,
135135            &clip,TRANSPARENCY_PEN,0);
136136   }
src/mame/video/ladybug.c
r3957r3958
161161
162162WRITE8_HANDLER( ladybug_flipscreen_w )
163163{
164   if (flip_screen_get() != (data & 0x01))
164   if (flip_screen_get(space->machine) != (data & 0x01))
165165   {
166      flip_screen_set(data & 0x01);
166      flip_screen_set(space->machine, data & 0x01);
167167      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
168168   }
169169}
r3957r3958
250250   // bit3 = enable stars
251251   // bit210 = stars speed/dir
252252
253   if (flip_screen_get() != (data & 0x80))
253   if (flip_screen_get(space->machine) != (data & 0x80))
254254   {
255      flip_screen_set(data & 0x80);
255      flip_screen_set(space->machine, data & 0x80);
256256      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
257257   }
258258
r3957r3958
370370      int sx = offs % 4;
371371      int sy = offs / 4;
372372
373      if (flip_screen_get())
373      if (flip_screen_get(screen->machine))
374374         tilemap_set_scrollx(bg_tilemap, offs, -videoram[32 * sx + sy]);
375375      else
376376         tilemap_set_scrollx(bg_tilemap, offs, videoram[32 * sx + sy]);
r3957r3958
399399      int sx = offs % 4;
400400      int sy = offs / 4;
401401
402      if (flip_screen_get())
402      if (flip_screen_get(screen->machine))
403403         tilemap_set_scrollx(bg_tilemap, offs, -videoram[32 * sx + sy]);
404404      else
405405         tilemap_set_scrollx(bg_tilemap, offs, videoram[32 * sx + sy]);
r3957r3958
409409   bitmap_fill(bitmap,cliprect,0);
410410
411411   // draw the stars
412   if (flip_screen_get())
412   if (flip_screen_get(screen->machine))
413413      redclash_draw_stars(bitmap,cliprect,0x60,1,0x27,0xff);
414414   else
415415      redclash_draw_stars(bitmap,cliprect,0x60,1,0x00,0xd8);
r3957r3958
418418   colortable_palette_set_color(screen->machine->colortable, 0x40, MAKE_RGB(sraider_grid_color & 0x40 ? 0xff : 0,
419419                                                                 sraider_grid_color & 0x20 ? 0xff : 0,
420420                                                                 sraider_grid_color & 0x10 ? 0xff : 0));
421   tilemap_draw(bitmap, cliprect, grid_tilemap, 0, flip_screen_get());
421   tilemap_draw(bitmap, cliprect, grid_tilemap, 0, flip_screen_get(screen->machine));
422422
423423   for (i = 0; i < 0x100; i++)
424424   {
r3957r3958
428428
429429         int height = cliprect->max_y - cliprect->min_y + 1;
430430
431         if (flip_screen_get())
431         if (flip_screen_get(screen->machine))
432432            x = ~x;
433433
434434         plot_box(bitmap, x, cliprect->min_y, 1, height, 0x81);
r3957r3958
436436   }
437437
438438   // now the chars
439   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, flip_screen_get());
439   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, flip_screen_get(screen->machine));
440440
441441   // now the sprites
442442   draw_sprites(screen->machine, bitmap, cliprect);
src/mame/video/blueprnt.c
r3957r3958
5656
5757WRITE8_HANDLER( blueprnt_flipscreen_w )
5858{
59   flip_screen_set(~data & 0x02);
59   flip_screen_set(space->machine, ~data & 0x02);
6060
6161   if (gfx_bank != ((data & 0x04) >> 2))
6262   {
r3957r3958
9797      int flipx = spriteram[offs + 2] & 0x40;
9898      int flipy = spriteram[offs + 2 - 4] & 0x80;   // -4? Awkward, isn't it?
9999
100      if (flip_screen_get())
100      if (flip_screen_get(machine))
101101      {
102102         sx = 248 - sx;
103103         sy = 240 - sy;
r3957r3958
115115{
116116   int i;
117117
118   if (flip_screen_get())
118   if (flip_screen_get(screen->machine))
119119      for (i = 0; i < 32; i++)
120120         tilemap_set_scrolly(bg_tilemap, i, blueprnt_scrollram[32 - i]);
121121   else
src/mame/video/buggychl.c
r3957r3958
7070    bit0 = VINV
7171*/
7272
73   flip_screen_y_set(data & 0x01);
74   flip_screen_x_set(data & 0x02);
73   flip_screen_y_set(space->machine, data & 0x01);
74   flip_screen_x_set(space->machine, data & 0x02);
7575
7676   bg_on = data & 0x04;
7777   sky_on = data & 0x08;
r3957r3958
112112      int sx = offs % 32;
113113      int sy = offs / 32;
114114
115      if (flip_screen_x_get()) sx = 31 - sx;
116      if (flip_screen_y_get()) sy = 31 - sy;
115      if (flip_screen_x_get(machine)) sx = 31 - sx;
116      if (flip_screen_y_get(machine)) sy = 31 - sy;
117117
118118      drawgfx(tmpbitmap1,machine->gfx[0],
119119            code,
120120            2,
121            flip_screen_x_get(),flip_screen_y_get(),
121            flip_screen_x_get(machine),flip_screen_y_get(machine),
122122            8*sx,8*sy,
123123            NULL,TRANSPARENCY_NONE,0);
124124   }
r3957r3958
151151
152152      int code = videoram[offs];
153153
154      if (flip_screen_x_get()) sx = 31 - sx;
155      if (flip_screen_y_get()) sy = 31 - sy;
154      if (flip_screen_x_get(machine)) sx = 31 - sx;
155      if (flip_screen_y_get(machine)) sy = 31 - sy;
156156
157157      drawgfx(bitmap,machine->gfx[0],
158158            code,
159159            0,
160            flip_screen_x_get(),flip_screen_y_get(),
160            flip_screen_x_get(machine),flip_screen_y_get(machine),
161161            8*sx,8*sy,
162162            cliprect,transp,0);
163163   }
r3957r3958
190190
191191      for (y = 0;y < 64;y++)
192192      {
193         int dy = flip_screen_y_get() ? (255 - sy - y) : (sy + y);
193         int dy = flip_screen_y_get(machine) ? (255 - sy - y) : (sy + y);
194194
195195         if ((dy & ~0xff) == 0)
196196         {
r3957r3958
219219                  col = pendata[x];
220220                  if (col)
221221                  {
222                     int dx = flip_screen_x_get() ? (255 - sx - px) : (sx + px);
222                     int dx = flip_screen_x_get(machine) ? (255 - sx - px) : (sx + px);
223223                     if ((dx & ~0xff) == 0)
224224                        *BITMAP_ADDR16(bitmap, dy, dx) = sprite_color_base + col;
225225                  }
src/mame/video/n64.c
r3957r3958
33*/
44
55#include "driver.h"
6#include "deprecat.h"
76#include "includes/n64.h"
87
98#define LOG_RDP_EXECUTION       0
r3957r3958
28662865// RDP COMMANDS
28672866////////////////////////
28682867
2869static void rdp_invalid(UINT32 w1, UINT32 w2)
2868typedef void (*rdp_command_func)(running_machine *machine, UINT32 w1, UINT32 w2);
2869#define RDP_COMMAND(name) void name(running_machine *machine, UINT32 w1, UINT32 w2)
2870
2871static RDP_COMMAND( rdp_invalid )
28702872{
28712873   fatalerror("RDP: invalid command  %d, %08X %08X\n", (w1 >> 24) & 0x3f, w1, w2);
28722874}
28732875
2874static void rdp_noop(UINT32 w1, UINT32 w2)
2876static RDP_COMMAND( rdp_noop )
28752877{
28762878
28772879}
28782880
2879static void rdp_tri_noshade(UINT32 w1, UINT32 w2)
2881static RDP_COMMAND( rdp_tri_noshade )
28802882{
28812883   //fatalerror("RDP: unhandled command tri_noshade, %08X %08X\n", w1, w2);
28822884   triangle(w1, w2, 0, 0, 0);
28832885}
28842886
2885static void rdp_tri_noshade_z(UINT32 w1, UINT32 w2)
2887static RDP_COMMAND( rdp_tri_noshade_z )
28862888{
28872889   //fatalerror("RDP: unhandled command tri_noshade_z, %08X %08X\n", w1, w2);
28882890   triangle(w1, w2, 0, 0, 1);
28892891}
28902892
2891static void rdp_tri_tex(UINT32 w1, UINT32 w2)
2893static RDP_COMMAND( rdp_tri_tex )
28922894{
28932895   //osd_die("RDP: unhandled command tri_tex, %08X %08X\n", w1, w2);
28942896
28952897   triangle(w1, w2, 0, 1, 0);
28962898}
28972899
2898static void rdp_tri_tex_z(UINT32 w1, UINT32 w2)
2900static RDP_COMMAND( rdp_tri_tex_z )
28992901{
29002902   //osd_die("RDP: unhandled command tri_tex_z, %08X %08X\n", w1, w2);
29012903
29022904   triangle(w1, w2, 0, 1, 1);
29032905}
29042906
2905static void rdp_tri_shade(UINT32 w1, UINT32 w2)
2907static RDP_COMMAND( rdp_tri_shade )
29062908{
29072909   //osd_die("RDP: unhandled command tri_shade, %08X %08X\n", w1, w2);
29082910
29092911   triangle(w1, w2, 1, 0, 0);
29102912}
29112913
2912static void rdp_tri_shade_z(UINT32 w1, UINT32 w2)
2914static RDP_COMMAND( rdp_tri_shade_z )
29132915{
29142916   //osd_die("RDP: unhandled command tri_shade_z, %08X %08X\n", w1, w2);
29152917
29162918   triangle(w1, w2, 1, 0, 1);
29172919}
29182920
2919static void rdp_tri_texshade(UINT32 w1, UINT32 w2)
2921static RDP_COMMAND( rdp_tri_texshade )
29202922{
29212923   //osd_die("RDP: unhandled command tri_texshade, %08X %08X\n", w1, w2);
29222924
29232925   triangle(w1, w2, 1, 1, 0);
29242926}
29252927
2926static void rdp_tri_texshade_z(UINT32 w1, UINT32 w2)
2928static RDP_COMMAND( rdp_tri_texshade_z )
29272929{
29282930   //osd_die("RDP: unhandled command tri_texshade_z, %08X %08X\n", w1, w2);
29292931
29302932   triangle(w1, w2, 1, 1, 1);
29312933}
29322934
2933static void rdp_tex_rect(UINT32 w1, UINT32 w2)
2935static RDP_COMMAND( rdp_tex_rect )
29342936{
29352937   UINT32 w3, w4;
29362938   TEX_RECTANGLE rect;
r3957r3958
29552957   }
29562958}
29572959
2958static void rdp_tex_rect_flip(UINT32 w1, UINT32 w2)
2960static RDP_COMMAND( rdp_tex_rect_flip )
29592961{
29602962   UINT32 w3, w4;
29612963   TEX_RECTANGLE rect;
r3957r3958
29802982   }
29812983}
29822984
2983static void rdp_sync_load(UINT32 w1, UINT32 w2)
2985static RDP_COMMAND( rdp_sync_load )
29842986{
29852987   // Nothing to do?
29862988}
29872989
2988static void rdp_sync_pipe(UINT32 w1, UINT32 w2)
2990static RDP_COMMAND( rdp_sync_pipe )
29892991{
29902992   // Nothing to do?
29912993}
29922994
2993static void rdp_sync_tile(UINT32 w1, UINT32 w2)
2995static RDP_COMMAND( rdp_sync_tile )
29942996{
29952997   // Nothing to do?
29962998}
29972999
2998static void rdp_sync_full(UINT32 w1, UINT32 w2)
3000static RDP_COMMAND( rdp_sync_full )
29993001{
3000   dp_full_sync(Machine);
3002   dp_full_sync(machine);
30013003}
30023004
3003static void rdp_set_key_gb(UINT32 w1, UINT32 w2)
3005static RDP_COMMAND( rdp_set_key_gb )
30043006{
30053007   //osd_die("RDP: unhandled command set_key_gb, %08X %08X\n", w1, w2);
30063008}
30073009
3008static void rdp_set_key_r(UINT32 w1, UINT32 w2)
3010static RDP_COMMAND( rdp_set_key_r )
30093011{
30103012   //osd_die("RDP: unhandled command set_key_r, %08X %08X\n", w1, w2);
30113013}
30123014
3013static void rdp_set_convert(UINT32 w1, UINT32 w2)
3015static RDP_COMMAND( rdp_set_convert )
30143016{
30153017   //osd_die("RDP: unhandled command set_convert, %08X %08X\n", w1, w2);
30163018}
30173019
3018static void rdp_set_scissor(UINT32 w1, UINT32 w2)
3020static RDP_COMMAND( rdp_set_scissor )
30193021{
30203022   clip.xh = (w1 >> 12) & 0xfff;
30213023   clip.yh = (w1 >>  0) & 0xfff;
r3957r3958
30253027   // TODO: handle f & o?
30263028}
30273029
3028static void rdp_set_prim_depth(UINT32 w1, UINT32 w2)
3030static RDP_COMMAND( rdp_set_prim_depth )
30293031{
30303032   primitive_z = (UINT16)(w2 >> 16);
30313033   primitive_delta_z = (UINT16)(w1);
30323034}
30333035
3034static void rdp_set_other_modes(UINT32 w1, UINT32 w2)
3036static RDP_COMMAND( rdp_set_other_modes )
30353037{
30363038   other_modes.cycle_type         = (w1 >> 20) & 0x3;
30373039   other_modes.persp_tex_en       = (w1 & 0x80000) ? 1 : 0;
r3957r3958
30903092   }
30913093}
30923094
3093static void rdp_load_tlut(UINT32 w1, UINT32 w2)
3095static RDP_COMMAND( rdp_load_tlut )
30943096{
30953097   int i;
30963098   UINT16 sl, sh;
r3957r3958
31273129
31283130}
31293131
3130static void rdp_set_tile_size(UINT32 w1, UINT32 w2)
3132static RDP_COMMAND( rdp_set_tile_size )
31313133{
31323134   int tilenum = (w2 >> 24) & 0x7;
31333135
r3957r3958
31373139   tile[tilenum].th = (w2 >>  0) & 0xfff;
31383140}
31393141
3140static void rdp_load_block(UINT32 w1, UINT32 w2)
3142static RDP_COMMAND( rdp_load_block )
31413143{
31423144   int i, width;
31433145   UINT16 sl, sh, tl, dxt;
r3957r3958
31903192   }
31913193}
31923194
3193static void rdp_load_tile(UINT32 w1, UINT32 w2)
3195static RDP_COMMAND( rdp_load_tile )
31943196{
31953197   int i, j;
31963198   UINT16 sl, sh, tl, th;
r3957r3958
32853287
32863288}
32873289
3288static void rdp_set_tile(UINT32 w1, UINT32 w2)
3290static RDP_COMMAND( rdp_set_tile )
32893291{
32903292   int tilenum = (w2 >> 24) & 0x7;
32913293
r3957r3958
33053307   // TODO: clamp & mirror parameters
33063308}
33073309
3308static void rdp_fill_rect(UINT32 w1, UINT32 w2)
3310static RDP_COMMAND( rdp_fill_rect )
33093311{
33103312   RECTANGLE rect;
33113313   rect.xl = (w1 >> 12) & 0xfff;
r3957r3958
33203322   }
33213323}
33223324
3323static void rdp_set_fill_color(UINT32 w1, UINT32 w2)
3325static RDP_COMMAND( rdp_set_fill_color )
33243326{
33253327   fill_color = w2;
33263328}
33273329
3328static void rdp_set_fog_color(UINT32 w1, UINT32 w2)
3330static RDP_COMMAND( rdp_set_fog_color )
33293331{
33303332   fog_color.r = (w2 >> 24) & 0xff;
33313333   fog_color.g = (w2 >> 16) & 0xff;
r3957r3958
33333335   fog_color.a = (w2 >>  0) & 0xff;
33343336}
33353337
3336static void rdp_set_blend_color(UINT32 w1, UINT32 w2)
3338static RDP_COMMAND( rdp_set_blend_color )
33373339{
33383340   blend_color.r = (w2 >> 24) & 0xff;
33393341   blend_color.g = (w2 >> 16) & 0xff;
r3957r3958
33413343   blend_color.a = (w2 >>  0) & 0xff;
33423344}
33433345
3344static void rdp_set_prim_color(UINT32 w1, UINT32 w2)
3346static RDP_COMMAND( rdp_set_prim_color )
33453347{
33463348   // TODO: prim min level, prim_level
33473349   prim_color.r = (w2 >> 24) & 0xff;
r3957r3958
33503352   prim_color.a = (w2 >>  0) & 0xff;
33513353}
33523354
3353static void rdp_set_env_color(UINT32 w1, UINT32 w2)
3355static RDP_COMMAND( rdp_set_env_color )
33543356{
33553357   env_color.r = (w2 >> 24) & 0xff;
33563358   env_color.g = (w2 >> 16) & 0xff;
r3957r3958
33583360   env_color.a = (w2 >>  0) & 0xff;
33593361}
33603362
3361static void rdp_set_combine(UINT32 w1, UINT32 w2)
3363static RDP_COMMAND( rdp_set_combine )
33623364{
33633365   combine.sub_a_rgb0   = (w1 >> 20) & 0xf;
33643366   combine.mul_rgb0   = (w1 >> 15) & 0x1f;
r3957r3958
33973399   SET_SUB_ALPHA_INPUT(&combiner_alphaadd[1], combine.add_a1);
33983400}
33993401
3400static void rdp_set_texture_image(UINT32 w1, UINT32 w2)
3402static RDP_COMMAND( rdp_set_texture_image )
34013403{
34023404   ti_format   = (w1 >> 21) & 0x7;
34033405   ti_size      = (w1 >> 19) & 0x3;
r3957r3958
34053407   ti_address   = w2 & 0x01ffffff;
34063408}
34073409
3408static void rdp_set_mask_image(UINT32 w1, UINT32 w2)
3410static RDP_COMMAND( rdp_set_mask_image )
34093411{
34103412   zb_address   = w2 & 0x01ffffff;
34113413}
34123414
3413static void rdp_set_color_image(UINT32 w1, UINT32 w2)
3415static RDP_COMMAND( rdp_set_color_image )
34143416{
34153417   fb_format    = (w1 >> 21) & 0x7;
34163418   fb_size      = (w1 >> 19) & 0x3;
r3957r3958
34233425
34243426/*****************************************************************************/
34253427
3426static void (*const rdp_command_table[64])(UINT32 w1, UINT32 w2) =
3428static const rdp_command_func rdp_command_table[64] =
34273429{
34283430   /* 0x00 */
34293431   rdp_noop,         rdp_invalid,         rdp_invalid,         rdp_invalid,
r3957r3958
34473449   rdp_set_combine,   rdp_set_texture_image,   rdp_set_mask_image,      rdp_set_color_image
34483450};
34493451
3450void rdp_process_list(void)
3452void rdp_process_list(running_machine *machine)
34513453{
34523454   int i;
34533455   UINT32 cmd, length, cmd_length;
r3957r3958
34983500      }
34993501
35003502      // execute the command
3501      rdp_command_table[cmd](rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1]);
3503      rdp_command_table[cmd](machine, rdp_cmd_data[rdp_cmd_cur+0], rdp_cmd_data[rdp_cmd_cur+1]);
35023504
35033505      rdp_cmd_cur += rdp_command_length[cmd] / 4;
35043506   };
src/mame/video/gberet.c
r3957r3958
153153         int flipx = attr & 0x10;
154154         int flipy = attr & 0x20;
155155
156         if (flip_screen_get())
156         if (flip_screen_get(machine))
157157         {
158158            sx = 240 - sx;
159159            sy = 240 - sy;
r3957r3958
205205         int flipx = attr & 0x10;
206206         int flipy = attr & 0x20;
207207
208         if (flip_screen_get())
208         if (flip_screen_get(machine))
209209         {
210210            sx = 240 - sx;
211211            sy = 240 - sy;
src/mame/video/stfight.c
r3957r3958
235235         /* 0x40 = sprites */
236236         tilemap_set_enable(bg_tilemap,data & 0x20);
237237         tilemap_set_enable(fg_tilemap,data & 0x10);
238         flip_screen_set(data & 0x01);
238         flip_screen_set(space->machine, data & 0x01);
239239         break;
240240   }
241241}
r3957r3958
272272                sx -= 0x100;
273273         }
274274
275         if (flip_screen_get())
275         if (flip_screen_get(machine))
276276         {
277277            sx = 240 - sx;
278278            sy = 240 - sy;
r3957r3958
284284         pdrawgfx(bitmap,machine->gfx[4],
285285                 code,
286286                color,
287                flipx,flip_screen_get(),
287                flipx,flip_screen_get(machine),
288288                sx,sy,
289289                 cliprect,TRANSPARENCY_PEN,0x0f,
290290                pri ? 0x02 : 0);
src/mame/video/gottlieb.c
r3957r3958
6464   background_priority = data & 0x01;
6565
6666   /* bit 1 controls horizonal flip screen */
67   if (flip_screen_x_get() != (data & 0x02))
67   if (flip_screen_x_get(space->machine) != (data & 0x02))
6868   {
69      flip_screen_x_set(data & 0x02);
69      flip_screen_x_set(space->machine, data & 0x02);
7070      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
7171   }
7272
7373   /* bit 2 controls horizonal flip screen */
74   if (flip_screen_y_get() != (data & 0x04))
74   if (flip_screen_y_get(space->machine) != (data & 0x04))
7575   {
76      flip_screen_y_set(data & 0x04);
76      flip_screen_y_set(space->machine, data & 0x04);
7777      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
7878   }
7979
r3957r3958
194194      int sy = (spriteram[offs]) - 13;
195195      int code = (255 ^ spriteram[offs + 2]) + 256 * spritebank;
196196
197      if (flip_screen_x_get()) sx = 233 - sx;
198      if (flip_screen_y_get()) sy = 244 - sy;
197      if (flip_screen_x_get(machine)) sx = 233 - sx;
198      if (flip_screen_y_get(machine)) sy = 244 - sy;
199199
200200      drawgfx(bitmap, machine->gfx[2],
201201         code, 0,
202         flip_screen_x_get(), flip_screen_y_get(),
202         flip_screen_x_get(machine), flip_screen_y_get(machine),
203203         sx,sy,
204204         &clip,
205205         TRANSPARENCY_PEN, 0);
src/mame/video/ddragon.c
r3957r3958
203203            which = src[i+3] + ( ( src[i+2] & 0x0f ) << 8 );
204204         }
205205
206         if (flip_screen_get())
206         if (flip_screen_get(machine))
207207         {
208208            sx = 240 - sx;
209209            sy = 256 - sy;
src/mame/video/pcktgal.c
r3957r3958
3838
3939WRITE8_HANDLER( pcktgal_flipscreen_w )
4040{
41   if (flip_screen_get() != (data & 0x80))
41   if (flip_screen_get(space->machine) != (data & 0x80))
4242   {
43      flip_screen_set(data & 0x80);
43      flip_screen_set(space->machine, data & 0x80);
4444      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
4545   }
4646}
r3957r3958
7575
7676         flipx = spriteram[offs+1] & 0x04;
7777         flipy = spriteram[offs+1] & 0x02;
78         if (flip_screen_get()) {
78         if (flip_screen_get(machine)) {
7979            sx=240-sx;
8080            sy=240-sy;
8181            if (flipx) flipx=0; else flipx=1;
src/mame/video/solomon.c
r3957r3958
3131
3232WRITE8_HANDLER( solomon_flipscreen_w )
3333{
34   if (flip_screen_get() != (data & 0x01))
34   if (flip_screen_get(space->machine) != (data & 0x01))
3535   {
36      flip_screen_set(data & 0x01);
36      flip_screen_set(space->machine, data & 0x01);
3737      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
3838   }
3939}
r3957r3958
8181      int sx = spriteram[offs + 3];
8282      int sy = 241 - spriteram[offs + 2];
8383
84      if (flip_screen_get())
84      if (flip_screen_get(machine))
8585      {
8686         sx = 240 - sx;
8787         sy = 242 - sy;
src/mame/video/gladiatr.c
r3957r3958
221221      int color = src[1] & 0x1f;
222222      int x,y;
223223
224      if (flip_screen_get())
224      if (flip_screen_get(machine))
225225      {
226226         xflip = !xflip;
227227         yflip = !yflip;
r3957r3958
291291      int scroll;
292292
293293      scroll = bg_scrollx + ((video_attributes & 0x04) << 6);
294      tilemap_set_scrollx(bg_tilemap, 0, scroll ^ (flip_screen_get() ? 0x0f : 0));
294      tilemap_set_scrollx(bg_tilemap, 0, scroll ^ (flip_screen_get(screen->machine) ? 0x0f : 0));
295295      scroll = fg_scrollx + ((video_attributes & 0x08) << 5);
296      tilemap_set_scrollx(fg_tilemap, 0, scroll ^ (flip_screen_get() ? 0x0f : 0));
296      tilemap_set_scrollx(fg_tilemap, 0, scroll ^ (flip_screen_get(screen->machine) ? 0x0f : 0));
297297
298298      // always 0 anyway
299299      tilemap_set_scrolly(bg_tilemap, 0, bg_scrolly);
src/mame/video/goindol.c
r3957r3958
100100      sx = sprite_ram[offs];
101101      sy = 240-sprite_ram[offs+1];
102102
103      if (flip_screen_get())
103      if (flip_screen_get(machine))
104104      {
105105         sx = 248 - sx;
106106         sy = 248 - sy;
r3957r3958
115115         drawgfx(bitmap,machine->gfx[gfxbank],
116116                  tile,
117117                  palette,
118                  flip_screen_get(),flip_screen_get(),
118                  flip_screen_get(machine),flip_screen_get(machine),
119119                  sx,sy,
120120                  cliprect,
121121                  TRANSPARENCY_PEN, 0);
122122         drawgfx(bitmap,machine->gfx[gfxbank],
123123                  tile+1,
124124                  palette,
125                  flip_screen_get(),flip_screen_get(),
126                  sx,sy + (flip_screen_get() ? -8 : 8),
125                  flip_screen_get(machine),flip_screen_get(machine),
126                  sx,sy + (flip_screen_get(machine) ? -8 : 8),
127127                  cliprect,
128128                  TRANSPARENCY_PEN, 0);
129129      }
src/mame/video/cabal.c
r3957r3958
6060      tilemap_set_flip(background_layer,flip);
6161      tilemap_set_flip(text_layer,flip);
6262
63      flip_screen_set(data & 0x20);
63      flip_screen_set(space->machine, data & 0x20);
6464   }
6565}
6666
r3957r3958
119119
120120         if ( sx>256 )   sx -= 512;
121121
122         if (flip_screen_get())
122         if (flip_screen_get(machine))
123123         {
124124            sx = 240 - sx;
125125            sy = 240 - sy;
src/mame/video/cidelsa.c
r3957r3958
156156
157157static CDP1869_INTERFACE( destryer_cdp1869_intf )
158158{
159   SCREEN_TAG,
160   MAIN_CPU_TAG,
161   DESTRYER_CHR2,
162   0,
163159   CDP1869_PAL,
164160   cidelsa_pageram_r,
165161   cidelsa_pageram_w,
r3957r3958
171167
172168static CDP1869_INTERFACE( altair_cdp1869_intf )
173169{
174   SCREEN_TAG,
175   MAIN_CPU_TAG,
176   ALTAIR_CHR2,
177   0,
178170   CDP1869_PAL,
179171   cidelsa_pageram_r,
180172   cidelsa_pageram_w,
r3957r3958
186178
187179static CDP1869_INTERFACE( draco_cdp1869_intf )
188180{
189   SCREEN_TAG,
190   MAIN_CPU_TAG,
191   DRACO_CHR2,
192   0,
193181   CDP1869_PAL,
194182   draco_pageram_r,
195183   draco_pageram_w,
r3957r3958
272260   MDRV_SCREEN_RAW_PARAMS(DESTRYER_CHR2, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL)
273261   MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044)
274262
275   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
276   MDRV_DEVICE_CONFIG(destryer_cdp1869_intf)
263   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, DESTRYER_CHR2, 0, MAIN_CPU_TAG, destryer_cdp1869_intf)
277264MACHINE_DRIVER_END
278265
279266MACHINE_DRIVER_START( altair_video )
r3957r3958
288275   MDRV_SCREEN_RAW_PARAMS(ALTAIR_CHR2, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL)
289276   MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044)
290277
291   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
292   MDRV_DEVICE_CONFIG(altair_cdp1869_intf)
278   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, ALTAIR_CHR2, 0, MAIN_CPU_TAG, altair_cdp1869_intf)
293279MACHINE_DRIVER_END
294280
295281MACHINE_DRIVER_START( draco_video )
r3957r3958
304290   MDRV_SCREEN_RAW_PARAMS(DRACO_CHR2, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL)
305291   MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.360, 0.024)
306292
307   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
308   MDRV_DEVICE_CONFIG(draco_cdp1869_intf)
293   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, DRACO_CHR2, 0, MAIN_CPU_TAG, draco_cdp1869_intf)
309294MACHINE_DRIVER_END
src/mame/video/suprloco.c
r3957r3958
119119
120120WRITE8_HANDLER( suprloco_scrollram_w )
121121{
122   int adj = flip_screen_get() ? -8 : 8;
122   int adj = flip_screen_get(space->machine) ? -8 : 8;
123123
124124   suprloco_scrollram[offset] = data;
125125   tilemap_set_scrollx(bg_tilemap,offset, data - adj);
r3957r3958
145145   coin_counter_w(0, data & 0x01);
146146   coin_counter_w(1, data & 0x02);
147147
148   flip_screen_set(data & 0x80);
148   flip_screen_set(space->machine, data & 0x80);
149149
150150   control = data;
151151}
r3957r3958
158158
159159
160160
161INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color)
161INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color,int flip)
162162{
163   if (flip_screen_get())
163   if (flip)
164164   {
165165      x = bitmap->width - x - 1;
166166      y = bitmap->height - y - 1;
r3957r3958
178178
179179static void draw_sprite(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int spr_number)
180180{
181   int flip = flip_screen_get(machine);
181182   int sx,sy,col,row,height,src,adjy,dy;
182183   UINT8 *spr_reg;
183184   UINT8 *gfx2;
r3957r3958
195196   sx = spr_reg[SPR_X];
196197   sy = spr_reg[SPR_Y_TOP] + 1;
197198
198   if (!flip_screen_get())
199   if (!flip_screen_get(machine))
199200   {
200201      adjy = sy;
201202      dy = 1;
r3957r3958
238239
239240         if (color1 == 15) break;
240241         if (color1)
241            draw_pixel(bitmap,cliprect,sx+col,  adjy,pen_base + color1);
242            draw_pixel(bitmap,cliprect,sx+col,  adjy,pen_base + color1, flip);
242243
243244         if (color2 == 15) break;
244245         if (color2)
245            draw_pixel(bitmap,cliprect,sx+col+1,adjy,pen_base + color2);
246            draw_pixel(bitmap,cliprect,sx+col+1,adjy,pen_base + color2, flip);
246247
247248         col += 2;
248249      }
src/mame/video/m92.c
r3957r3958
339339            x &= 0x1ff;
340340            for (i=0; i<y_multi; i++)
341341            {
342               if (flip_screen_get()) {
342               if (flip_screen_get(machine)) {
343343                  pdrawgfx(bitmap,machine->gfx[1],
344344                        sprite + s_ptr,
345345                        colour,
r3957r3958
463463
464464   /* Flipscreen appears hardwired to the dipswitch - strange */
465465   if (input_port_read(screen->machine, "DSW") & 0x100)
466      flip_screen_set(0);
466      flip_screen_set(screen->machine, 0);
467467   else
468      flip_screen_set(1);
468      flip_screen_set(screen->machine, 1);
469469   return 0;
470470}
src/mame/video/m58.c
r3957r3958
202202WRITE8_HANDLER( yard_flipscreen_w )
203203{
204204   /* screen flip is handled both by software and hardware */
205   flip_screen_set((data & 0x01) ^ (~input_port_read(space->machine, "DSW2") & 0x01));
205   flip_screen_set(space->machine, (data & 0x01) ^ (~input_port_read(space->machine, "DSW2") & 0x01));
206206
207207   coin_counter_w(0, data & 0x02);
208208   coin_counter_w(1, data & 0x20);
r3957r3958
246246         code2 = code1 + 0x40;
247247      }
248248
249      if (flip_screen_get())
249      if (flip_screen_get(machine))
250250      {
251251         sx = 240 - sx;
252252         sy2 = 192 - sy1;
r3957r3958
286286         0*8, 6*8-1,
287287         1*8, 31*8-1
288288      };
289      rectangle clip = flip_screen_get() ? clippanelflip : clippanel;
289      rectangle clip = flip_screen_get(machine) ? clippanelflip : clippanel;
290290      const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
291      int sx = flip_screen_get() ? cliprect->min_x - 8 : cliprect->max_x + 1 - SCROLL_PANEL_WIDTH;
292      int yoffs = flip_screen_get() ? -40 : -16;
291      int sx = flip_screen_get(machine) ? cliprect->min_x - 8 : cliprect->max_x + 1 - SCROLL_PANEL_WIDTH;
292      int yoffs = flip_screen_get(machine) ? -40 : -16;
293293
294294      clip.min_y += visarea->min_y + yoffs;
295295      clip.max_y += visarea->max_y + yoffs;
296296
297      copybitmap(bitmap, scroll_panel_bitmap, flip_screen_get(), flip_screen_get(),
297      copybitmap(bitmap, scroll_panel_bitmap, flip_screen_get(machine), flip_screen_get(machine),
298298               sx, visarea->min_y + yoffs, &clip);
299299   }
300300}
src/mame/video/wwfwfest.c
r3957r3958
189189         number = (source[2] & 0x00ff) | (source[3] & 0x00ff) << 8;
190190         colourbank = (source[4] & 0x000f);
191191
192         if (flip_screen_get()) {
192         if (flip_screen_get(machine)) {
193193            if (flipy) flipy=0; else flipy=1;
194194            if (flipx) flipx=0; else flipx=1;
195195            ypos=240-ypos-sprite_xoff;
r3957r3958
197197         }
198198
199199         for (count=0;count<chain;count++) {
200            if (flip_screen_get()) {
200            if (flip_screen_get(machine)) {
201201               if (!flipy) {
202202                  drawgfx(bitmap,gfx,number+count,colourbank,flipx,flipy,xpos,ypos+(16*(chain-1))-(16*count),cliprect,TRANSPARENCY_PEN,0);
203203               } else {
src/mame/video/pktgaldx.c
r3957r3958
88static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
99{
1010   int offs;
11   int flipscreen=!flip_screen_get();
11   int flipscreen=!flip_screen_get(machine);
1212
1313   for (offs = 0;offs < 0x400;offs += 4)
1414   {
r3957r3958
8585
8686VIDEO_UPDATE(pktgaldx)
8787{
88   flip_screen_set( deco16_pf12_control[0]&0x80 );
88   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
8989   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
9090
9191   bitmap_fill(bitmap,cliprect,0); /* not Confirmed */
src/mame/video/timeplt.c
r3957r3958
140140
141141WRITE8_HANDLER( timeplt_flipscreen_w )
142142{
143   flip_screen_set(~data & 1);
143   flip_screen_set(space->machine, ~data & 1);
144144}
145145
146146
src/mame/video/fuukifg2.c
r3957r3958
187187      sx = (sx & 0x1ff) - (sx & 0x200);
188188      sy = (sy & 0x1ff) - (sy & 0x200);
189189
190      if (flip_screen_get())
190      if (flip_screen_get(screen->machine))
191191      {   flipx = !flipx;      sx = max_x - sx - xnum * 16;
192192         flipy = !flipy;      sy = max_y - sy - ynum * 16;   }
193193
r3957r3958
310310   tm_middle = pri_table[ fuuki16_priority[0] & 0x0f ][1];
311311   tm_back   = pri_table[ fuuki16_priority[0] & 0x0f ][2];
312312
313   flip_screen_set(fuuki16_vregs[0x1e/2] & 1);
313   flip_screen_set(screen->machine, fuuki16_vregs[0x1e/2] & 1);
314314
315315   /* Layers scrolling */
316316
317   scrolly_offs = fuuki16_vregs[0xc/2] - (flip_screen_get() ? 0x103 : 0x1f3);
318   scrollx_offs = fuuki16_vregs[0xe/2] - (flip_screen_get() ? 0x2a7 : 0x3f6);
317   scrolly_offs = fuuki16_vregs[0xc/2] - (flip_screen_get(screen->machine) ? 0x103 : 0x1f3);
318   scrollx_offs = fuuki16_vregs[0xe/2] - (flip_screen_get(screen->machine) ? 0x2a7 : 0x3f6);
319319
320320   layer0_scrolly = fuuki16_vregs[0x0/2] + scrolly_offs;
321321   layer0_scrollx = fuuki16_vregs[0x2/2] + scrollx_offs;
src/mame/video/vulgus.c
r3957r3958
150150   coin_counter_w(1, data & 0x02);
151151
152152   /* bit 7 flips screen */
153   flip_screen_set(data & 0x80);
153   flip_screen_set(space->machine, data & 0x80);
154154}
155155
156156
r3957r3958
185185      sx = spriteram[offs + 3];
186186      sy = spriteram[offs + 2];
187187      dir = 1;
188      if (flip_screen_get())
188      if (flip_screen_get(machine))
189189      {
190190         sx = 240 - sx;
191191         sy = 240 - sy;
r3957r3958
200200         drawgfx(bitmap,machine->gfx[2],
201201               code + i,
202202               col,
203               flip_screen_get(),flip_screen_get(),
203               flip_screen_get(machine),flip_screen_get(machine),
204204               sx, sy + 16 * i * dir,
205205               cliprect,TRANSPARENCY_PEN,15);
206206
r3957r3958
208208         drawgfx(bitmap,machine->gfx[2],
209209               code + i,
210210               col,
211               flip_screen_get(),flip_screen_get(),
211               flip_screen_get(machine),flip_screen_get(machine),
212212               sx, sy + 16 * i * dir -  dir * 256,
213213               cliprect,TRANSPARENCY_PEN,15);
214214         i--;
src/mame/video/shangha3.c
r3957r3958
9696   if (ACCESSING_BITS_0_7)
9797   {
9898      /* bit 7 flips screen, the rest seems to always be set to 0x7e */
99      flip_screen_set(data & 0x80);
99      flip_screen_set(space->machine, data & 0x80);
100100
101101      if ((data & 0x7f) != 0x7e) popmessage("flipscreen_w %02x",data);
102102   }
r3957r3958
133133      zoomx = shangha3_ram[offs+10];
134134      zoomy = shangha3_ram[offs+13];
135135
136      if (flip_screen_get())
136      if (flip_screen_get(space->machine))
137137      {
138138         sx = 383 - sx - sizex;
139139         sy = 255 - sy - sizey;
src/mame/video/vastar.c
r3957r3958
146146      flipx = spriteram_3[offs] & 0x02;
147147      flipy = spriteram_3[offs] & 0x01;
148148
149      if (flip_screen_get())
149      if (flip_screen_get(machine))
150150      {
151151         flipx = !flipx;
152152         flipy = !flipy;
r3957r3958
154154
155155      if (spriteram_2[offs] & 0x08)   /* double width */
156156      {
157         if (!flip_screen_get())
157         if (!flip_screen_get(machine))
158158            sy = 224 - sy;
159159
160160         drawgfx(bitmap,machine->gfx[2],
r3957r3958
173173      }
174174      else
175175      {
176         if (!flip_screen_get())
176         if (!flip_screen_get(machine))
177177            sy = 240 - sy;
178178
179179         drawgfx(bitmap,machine->gfx[1],
src/mame/video/champbas.c
r3957r3958
191191
192192WRITE8_HANDLER( champbas_flipscreen_w )
193193{
194   flip_screen_set(~data & 1);
194   flip_screen_set(space->machine, ~data & 1);
195195}
196196
197197
src/mame/video/baraduke.c
r3957r3958
261261
262262         sy -= 16 * sizey;
263263
264         if (flip_screen_get())
264         if (flip_screen_get(machine))
265265         {
266266            sx = 496+3 - 16 * sizex - sx;
267267            sy = 240 - 16 * sizey - sy;
r3957r3958
289289}
290290
291291
292static void set_scroll(int layer)
292static void set_scroll(running_machine *machine, int layer)
293293{
294294   static const int xdisp[2] = { 26, 24 };
295295   int scrollx, scrolly;
296296
297297   scrollx = xscroll[layer] + xdisp[layer];
298298   scrolly = yscroll[layer] + 9;
299   if (flip_screen_get())
299   if (flip_screen_get(machine))
300300   {
301301      scrollx = -scrollx + 3;
302302      scrolly = -scrolly;
r3957r3958
312312   int back;
313313
314314   /* flip screen is embedded in the sprite control registers */
315   /* can't use flip_screen_set() because the visible area is asymmetrical */
316   flip_screen_set_no_update(spriteram[0x07f6] & 0x01);
317   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
318   set_scroll(0);
319   set_scroll(1);
315   /* can't use flip_screen_set(screen->machine, ) because the visible area is asymmetrical */
316   flip_screen_set_no_update(screen->machine, spriteram[0x07f6] & 0x01);
317   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get(screen->machine) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
318   set_scroll(screen->machine, 0);
319   set_scroll(screen->machine, 1);
320320
321321   if (((xscroll[0] & 0x0e00) >> 9) == 6)
322322      back = 1;
src/mame/video/ssozumo.c
r3957r3958
108108
109109WRITE8_HANDLER( ssozumo_flipscreen_w )
110110{
111   flip_screen_set(data & 0x80);
111   flip_screen_set(space->machine, data & 0x80);
112112}
113113
114114static TILE_GET_INFO( get_bg_tile_info )
r3957r3958
154154         int sx = 239 - spriteram[offs + 3];
155155         int sy = (240 - spriteram[offs + 2]) & 0xff;
156156
157         if (flip_screen_get())
157         if (flip_screen_get(machine))
158158         {
159159            sx = 240 - sx;
160160            sy = 240 - sy;
src/mame/video/arkanoid.c
r3957r3958
2424   int bank;
2525
2626   /* bits 0 and 1 flip X and Y, I don't know which is which */
27   if (flip_screen_x_get() != (data & 0x01)) {
28      flip_screen_x_set(data & 0x01);
27   if (flip_screen_x_get(space->machine) != (data & 0x01)) {
28      flip_screen_x_set(space->machine, data & 0x01);
2929      tilemap_mark_all_tiles_dirty(bg_tilemap);
3030   }
3131
32   if (flip_screen_y_get() != (data & 0x02)) {
33      flip_screen_y_set(data & 0x02);
32   if (flip_screen_y_get(space->machine) != (data & 0x02)) {
33      flip_screen_y_set(space->machine, data & 0x02);
3434      tilemap_mark_all_tiles_dirty(bg_tilemap);
3535   }
3636
r3957r3958
9797
9898      sx = spriteram[offs];
9999      sy = 248 - spriteram[offs + 1];
100      if (flip_screen_x_get()) sx = 248 - sx;
101      if (flip_screen_y_get()) sy = 248 - sy;
100      if (flip_screen_x_get(machine)) sx = 248 - sx;
101      if (flip_screen_y_get(machine)) sy = 248 - sy;
102102
103103      code = spriteram[offs + 3] + ((spriteram[offs + 2] & 0x03) << 8) + 1024 * gfxbank;
104104
105105      drawgfx(bitmap,machine->gfx[0],
106106            2 * code,
107107            ((spriteram[offs + 2] & 0xf8) >> 3) + 32 * palettebank,
108            flip_screen_x_get(),flip_screen_y_get(),
109            sx,sy + (flip_screen_y_get() ? 8 : -8),
108            flip_screen_x_get(machine),flip_screen_y_get(machine),
109            sx,sy + (flip_screen_y_get(machine) ? 8 : -8),
110110            cliprect,TRANSPARENCY_PEN,0);
111111      drawgfx(bitmap,machine->gfx[0],
112112            2 * code + 1,
113113            ((spriteram[offs + 2] & 0xf8) >> 3) + 32 * palettebank,
114            flip_screen_x_get(),flip_screen_y_get(),
114            flip_screen_x_get(machine),flip_screen_y_get(machine),
115115            sx,sy,
116116            cliprect,TRANSPARENCY_PEN,0);
117117   }
src/mame/video/twin16.c
r3957r3958
5959      case 0:
6060         COMBINE_DATA( &video_register );
6161
62         flip_screen_x_set(video_register & TWIN16_SCREEN_FLIPX);
62         flip_screen_x_set(space->machine, video_register & TWIN16_SCREEN_FLIPX);
6363
6464         if (twin16_custom_video)
65            flip_screen_y_set(video_register & TWIN16_SCREEN_FLIPY);
65            flip_screen_y_set(space->machine, video_register & TWIN16_SCREEN_FLIPY);
6666         else
67            flip_screen_y_set(~video_register & TWIN16_SCREEN_FLIPY);
67            flip_screen_y_set(space->machine, ~video_register & TWIN16_SCREEN_FLIPY);
6868
6969         break;
7070
src/mame/video/clshroad.c
r3957r3958
4848
4949WRITE8_HANDLER( clshroad_flipscreen_w )
5050{
51   flip_screen_set( data & 1 );
51   flip_screen_set(space->machine, data & 1 );
5252}
5353
5454
r3957r3958
305305      int flipy   =   0;
306306
307307      x -= 0x4a/2;
308      if (flip_screen_get())
308      if (flip_screen_get(machine))
309309      {
310310         y = 240 - y;
311311         flipx = !flipx;
src/mame/video/sf.c
r3957r3958
109109   if (ACCESSING_BITS_0_7)
110110   {
111111      sf_active = data & 0xff;
112      flip_screen_set(data & 0x04);
112      flip_screen_set(space->machine, data & 0x04);
113113      tilemap_set_enable(tx_tilemap,data & 0x08);
114114      tilemap_set_enable(bg_tilemap,data & 0x20);
115115      tilemap_set_enable(fg_tilemap,data & 0x40);
r3957r3958
148148      {
149149         int c1,c2,c3,c4,t;
150150
151         if (flip_screen_get())
151         if (flip_screen_get(machine))
152152         {
153153            sx = 480 - sx;
154154            sy = 224 - sy;
r3957r3958
203203      }
204204      else
205205      {
206         if (flip_screen_get())
206         if (flip_screen_get(machine))
207207         {
208208            sx = 496 - sx;
209209            sy = 240 - sy;
src/mame/video/lsasquad.c
r3957r3958
1919
2020      base = 64 * scrollram[offs+1];
2121      sx = 8*(offs/4) + scrollx;
22      if (flip_screen_get()) sx = 248 - sx;
22      if (flip_screen_get(machine)) sx = 248 - sx;
2323      sx &= 0xff;
2424
2525      for (y = 0;y < 32;y++)
r3957r3958
2727         int attr;
2828
2929         sy = 8*y + scrolly;
30         if (flip_screen_get()) sy = 248 - sy;
30         if (flip_screen_get(machine)) sy = 248 - sy;
3131         sy &= 0xff;
3232
3333         attr = videoram[base + 2*y + 1];
r3957r3958
3737         drawgfx(bitmap,machine->gfx[0],
3838               code,
3939               color,
40               flip_screen_get(),flip_screen_get(),
40               flip_screen_get(machine),flip_screen_get(machine),
4141               sx,sy,
4242               cliprect,TRANSPARENCY_PEN,15);
4343         if (sx > 248)   /* wraparound */
4444            drawgfx(bitmap,machine->gfx[0],
4545                  code,
4646                  color,
47                  flip_screen_get(),flip_screen_get(),
47                  flip_screen_get(machine),flip_screen_get(machine),
4848                  sx-256,sy,
4949                  cliprect,TRANSPARENCY_PEN,15);
5050      }
r3957r3958
104104      base = 64 * lsasquad_scrollram[offs+1];
105105      sx = scrollx+stepx;
106106
107      if (flip_screen_get()) sx = 248 - sx;
107      if (flip_screen_get(machine)) sx = 248 - sx;
108108      sx &= 0xff;
109109
110110      for (y = 0;y < 32;y++)
r3957r3958
112112         int attr;
113113
114114         sy = 8*y + scrolly;
115         if (flip_screen_get()) sy = 248 - sy;
115         if (flip_screen_get(machine)) sy = 248 - sy;
116116         sy &= 0xff;
117117
118118         attr = videoram[base + 2*y + 1];
r3957r3958
125125         drawgfx(bitmap,machine->gfx[0],
126126               code,
127127               color,
128               flip_screen_get(),flip_screen_get(),
128               flip_screen_get(machine),flip_screen_get(machine),
129129               sx,sy,
130130               cliprect,TRANSPARENCY_PEN,15);
131131         if (sx > 248)   /* wraparound */
132132            drawgfx(bitmap,machine->gfx[0],
133133                  code,
134134                  color,
135                  flip_screen_get(),flip_screen_get(),
135                  flip_screen_get(machine),flip_screen_get(machine),
136136                  sx-256,sy,
137137                  cliprect,TRANSPARENCY_PEN,15);
138138               }
r3957r3958
176176      flipx = attr & 0x40;
177177      flipy = attr & 0x80;
178178
179      if (flip_screen_get())
179      if (flip_screen_get(machine))
180180      {
181181         sx = 240 - sx;
182182         sy = 240 - sy;
src/mame/video/dooyong.c
r3957r3958
141141   sprites_disabled = data & 0x10;
142142
143143   /* bit 6 is flip screen */
144   flip_screen_set(data & 0x40);
144   flip_screen_set(space->machine, data & 0x40);
145145}
146146
147147WRITE8_HANDLER( pollux_ctrl_w )
148148{
149149   /* bit 0 is flip screen */
150   flip_screen_set(data & 0x01);
150   flip_screen_set(space->machine, data & 0x01);
151151
152152   /* bits 6 and 7 are coin counters */
153153   coin_counter_w(0, data & 0x80);
r3957r3958
169169   tx_pri = data & 0x08;
170170
171171   /* bit 4 flips screen */
172   flip_screen_set(data & 0x10);
172   flip_screen_set(space->machine, data & 0x10);
173173
174174   /* bit 5 used but unknown */
175175
r3957r3958
179179WRITE8_HANDLER( flytiger_ctrl_w )
180180{
181181   /* bit 0 is flip screen */
182   flip_screen_set(data & 0x01);
182   flip_screen_set(space->machine, data & 0x01);
183183
184184   /* bits 1, 2, 3 used but unknown */
185185
r3957r3958
192192   if (ACCESSING_BITS_0_7)
193193   {
194194      /* bit 0 flips screen */
195      flip_screen_set(data & 0x0001);
195      flip_screen_set(space->machine, data & 0x0001);
196196
197197      /* bit 4 changes tilemaps priority */
198198      rshark_pri = data & 0x0010;
r3957r3958
414414         }
415415      }
416416
417      if (flip_screen_get())
417      if (flip_screen_get(machine))
418418      {
419419         sx = 498 - sx;
420420         sy = 240 - (16 * height) - sy;
r3957r3958
476476         width = buffered_spriteram16[offs+1] & 0x000f;
477477         height = (buffered_spriteram16[offs+1] & 0x00f0) >> 4;
478478
479         if (flip_screen_get())
479         if (flip_screen_get(machine))
480480         {
481481            sx = 498 - (16 * width) - sx;
482482            sy = 240 - (16 * height) - sy;
src/mame/video/dec8.c
r3957r3958
276276      y=(y+16)%0x200;
277277      x=256 - x;
278278      y=256 - y;
279      if (flip_screen_get()) {
279      if (flip_screen_get(machine)) {
280280         y=240-y;
281281         x=240-x;
282282         if (fx) fx=0; else fx=1;
r3957r3958
348348         inc = 1;
349349      }
350350
351      if (flip_screen_get()) {
351      if (flip_screen_get(machine)) {
352352         y=240-y;
353353         x=240-x;
354354         if (fx) fx=0; else fx=1;
r3957r3958
394394      fx = buffered_spriteram[offs+1] & 0x04;
395395      multi = buffered_spriteram[offs+1] & 0x10;
396396
397      if (flip_screen_get()) {
397      if (flip_screen_get(machine)) {
398398         sy=240-sy;
399399         sx=240-sx;
400400         if (fx) fx=0; else fx=1;
r3957r3958
405405       drawgfx(bitmap,machine->gfx[1],
406406              code,
407407            color,
408            fx,flip_screen_get(),
408            fx,flip_screen_get(machine),
409409            sx,sy,
410410            cliprect,TRANSPARENCY_PEN,0);
411411        if (multi)
412412          drawgfx(bitmap,machine->gfx[1],
413413            code+1,
414414            color,
415            fx,flip_screen_get(),
415            fx,flip_screen_get(machine),
416416            sx,sy2,
417417            cliprect,TRANSPARENCY_PEN,0);
418418   }
r3957r3958
448448   tilemap_set_scrolly( dec8_pf0_tilemap,0, (dec8_pf0_control[0x12]<<8)+dec8_pf0_control[0x13] );
449449   tilemap_set_scrollx( dec8_pf1_tilemap,0, (dec8_pf1_control[0x10]<<8)+dec8_pf1_control[0x11] );
450450   tilemap_set_scrolly( dec8_pf1_tilemap,0, (dec8_pf1_control[0x12]<<8)+dec8_pf1_control[0x13] );
451   flip_screen_set(dec8_pf0_control[0]>>7);
451   flip_screen_set(screen->machine, dec8_pf0_control[0]>>7);
452452
453453   tilemap_draw(bitmap,cliprect,dec8_pf0_tilemap,0,0);
454454   draw_sprites2(screen->machine,bitmap,cliprect,1);
r3957r3958
573573{
574574   tilemap_set_scrollx( dec8_pf0_tilemap,0, (dec8_pf0_control[0x10]<<8)+dec8_pf0_control[0x11] );
575575   tilemap_set_scrolly( dec8_pf0_tilemap,0, (dec8_pf0_control[0x12]<<8)+dec8_pf0_control[0x13] );
576   flip_screen_set(dec8_pf0_control[1]>>7);
576   flip_screen_set(screen->machine, dec8_pf0_control[1]>>7);
577577
578578   tilemap_draw(bitmap,cliprect,dec8_pf0_tilemap,TILEMAP_DRAW_LAYER1 | 0,0);
579579   tilemap_draw(bitmap,cliprect,dec8_pf0_tilemap,TILEMAP_DRAW_LAYER1 | 1,0);
src/mame/video/fuukifg3.c
r3957r3958
211211      sx = (sx & 0x1ff) - (sx & 0x200);
212212      sy = (sy & 0x1ff) - (sy & 0x200);
213213
214      if (flip_screen_get())
214      if (flip_screen_get(screen->machine))
215215      {   flipx = !flipx;      sx = max_x - sx - xnum * 16;
216216         flipy = !flipy;      sy = max_y - sy - ynum * 16;   }
217217
r3957r3958
341341   tm_middle = pri_table[ (fuuki32_priority[0]>>16) & 0x0f ][1];
342342   tm_back   = pri_table[ (fuuki32_priority[0]>>16) & 0x0f ][2];
343343
344   flip_screen_set((fuuki32_vregs[0x1e/4]&0x0000ffff) & 1);
344   flip_screen_set(screen->machine, (fuuki32_vregs[0x1e/4]&0x0000ffff) & 1);
345345
346346   /* Layers scrolling */
347347
348   scrolly_offs = ((fuuki32_vregs[0xc/4]&0xffff0000)>>16) - (flip_screen_get() ? 0x103 : 0x1f3);
349   scrollx_offs =  (fuuki32_vregs[0xc/4]&0x0000ffff) - (flip_screen_get() ? 0x2c7 : 0x3f6);
348   scrolly_offs = ((fuuki32_vregs[0xc/4]&0xffff0000)>>16) - (flip_screen_get(screen->machine) ? 0x103 : 0x1f3);
349   scrollx_offs =  (fuuki32_vregs[0xc/4]&0x0000ffff) - (flip_screen_get(screen->machine) ? 0x2c7 : 0x3f6);
350350
351351   layer0_scrolly = ((fuuki32_vregs[0x0/4]&0xffff0000)>>16) + scrolly_offs;
352352   layer0_scrollx = ((fuuki32_vregs[0x0/4]&0x0000ffff)) + scrollx_offs;
src/mame/video/battlane.c
r3957r3958
182182         flipx = attr & 0x04;
183183         flipy = attr & 0x02;
184184
185         if (!flip_screen_get())
185         if (!flip_screen_get(machine))
186186            {
187187            sx = 240 - sx;
188188            sy = 240 - sy;
r3957r3958
226226
227227         if (data)
228228         {
229            if (flip_screen_get())
229            if (flip_screen_get(machine))
230230               *BITMAP_ADDR16(bitmap, 255 - y, 255 - x) = data;
231231            else
232232               *BITMAP_ADDR16(bitmap, y, x) = data;
src/mame/video/pooyan.c
r3957r3958
147147
148148WRITE8_HANDLER( pooyan_flipscreen_w )
149149{
150   flip_screen_set(~data & 0x01);
150   flip_screen_set(space->machine, ~data & 0x01);
151151}
152152
153153
src/mame/video/wrally.c
r3957r3958
126126
127127      if (high_priority != priority) continue;
128128
129      if (flip_screen_get()) {
129      if (flip_screen_get(machine)) {
130130         sy = sy + 248;
131131      }
132132
r3957r3958
181181VIDEO_UPDATE( wrally )
182182{
183183   /* set scroll registers */
184   if (!flip_screen_get()) {
184   if (!flip_screen_get(screen->machine)) {
185185      tilemap_set_scrolly(wrally_pant[0], 0, wrally_vregs[0]);
186186      tilemap_set_scrollx(wrally_pant[0], 0, wrally_vregs[1]+4);
187187      tilemap_set_scrolly(wrally_pant[1], 0, wrally_vregs[2]);
src/mame/video/shisen.c
r3957r3958
6363   // on Irem boards, screen flip is handled in both hardware and software.
6464   // this game doesn't have cocktail mode so if there's software control we don't
6565   // know where it is mapped.
66   flip_screen_set(~input_port_read(screen->machine, "DSW2") & 1);
66   flip_screen_set(screen->machine, ~input_port_read(screen->machine, "DSW2") & 1);
6767
6868
6969   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
src/mame/video/nmk16.c
r3957r3958
370370WRITE16_HANDLER( nmk_flipscreen_w )
371371{
372372   if (ACCESSING_BITS_0_7)
373      flip_screen_set(data & 0x01);
373      flip_screen_set(space->machine, data & 0x01);
374374}
375375
376376WRITE16_HANDLER( nmk_tilebank_w )
r3957r3958
434434         if(pri != priority)
435435            continue;
436436
437         if (flip_screen_get())
437         if (flip_screen_get(machine))
438438         {
439439            sx = 368 - sx;
440440            sy = 240 - sy;
r3957r3958
451451               drawgfx(bitmap,machine->gfx[2],
452452                     code,
453453                     color,
454                     flip_screen_get(), flip_screen_get(),
454                     flip_screen_get(machine), flip_screen_get(machine),
455455                     ((x + 16) & 0x1ff) - 16,sy & 0x1ff,
456456                     cliprect,TRANSPARENCY_PEN,15);
457457               code++;
r3957r3958
488488         if(pri != priority)
489489            continue;
490490
491         flipx ^= flip_screen_get();
492         flipy ^= flip_screen_get();
491         flipx ^= flip_screen_get(machine);
492         flipy ^= flip_screen_get(machine);
493493
494         if (flip_screen_get())
494         if (flip_screen_get(machine))
495495         {
496496            sx = 368 - sx;
497497            sy = 240 - sy;
r3957r3958
10681068   if (dsw_flipscreen)
10691069   {
10701070
1071      flip_screen_x_set(~input_port_read(machine, "DSW1") & 0x0100);
1072      flip_screen_y_set(~input_port_read(machine, "DSW1") & 0x0200);
1071      flip_screen_x_set(machine, ~input_port_read(machine, "DSW1") & 0x0100);
1072      flip_screen_y_set(machine, ~input_port_read(machine, "DSW1") & 0x0200);
10731073   }
10741074
10751075   tilemap_set_scrollx(tilemap_0, 0, afega_scroll_0[1] + xoffset);
src/mame/drivers/bfcobra.c
r3957r3958
17401740   MDRV_VIDEO_UPDATE(bfcobra)
17411741
17421742   /* ACIAs */
1743   MDRV_DEVICE_ADD("acia6850_0", ACIA6850)
1744   MDRV_DEVICE_CONFIG(z80_acia_if)
1745   MDRV_DEVICE_ADD("acia6850_1", ACIA6850)
1746   MDRV_DEVICE_CONFIG(m6809_acia_if)
1747   MDRV_DEVICE_ADD("acia6850_2", ACIA6850)
1748   MDRV_DEVICE_CONFIG(data_acia_if)
1743   MDRV_ACIA6850_ADD("acia6850_0", z80_acia_if)
1744   MDRV_ACIA6850_ADD("acia6850_1", m6809_acia_if)
1745   MDRV_ACIA6850_ADD("acia6850_2", data_acia_if)
17491746MACHINE_DRIVER_END
17501747
17511748/***************************************************************************
src/mame/drivers/rcasino.c
r3957r3958
3535*/
3636
3737#include "driver.h"
38#include "cpu/z80/z80.h"
3839#include "sound/ay8910.h"
3940
4041static tilemap *bg_tilemap;
src/mame/drivers/sbugger.c
r3957r3958
9898*/
9999
100100#include "driver.h"
101#include "cpu/i8085/i8085.h"
101102#include "deprecat.h"
102103#include "sound/sn76496.h"
103104
src/mame/drivers/intrscti.c
r3957r3958
1212*/
1313
1414#include "driver.h"
15#include "cpu/z80/z80.h"
1516
1617static READ8_HANDLER( unk_r )
1718{
src/mame/drivers/nycaptor.c
r3957r3958
784784   MDRV_CPU_ADD("mcu", M68705,2000000)
785785   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
786786
787   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
787   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
788788
789789   /* synchronization of the CPUs */
790790   MDRV_MACHINE_RESET(ta7630)
r3957r3958
848848   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
849849#endif
850850
851   MDRV_INTERLEAVE(1)
851   MDRV_QUANTUM_TIME(HZ(60))
852852   MDRV_MACHINE_RESET(ta7630)
853853
854854   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
906906   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
907907   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
908908
909   MDRV_INTERLEAVE(2)
909   MDRV_QUANTUM_TIME(HZ(120))
910910   MDRV_MACHINE_RESET(ta7630)
911911
912912   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/mitchell.c
r3957r3958
7878
7979
8080#include "driver.h"
81#include "cpu/z80/z80.h"
8182#include "deprecat.h"
8283#include "machine/eeprom.h"
8384#include "includes/cps1.h"
src/mame/drivers/rainbow.c
r3957r3958
237237***************************************************************************/
238238
239239#include "driver.h"
240#include "cpu/z80/z80.h"
241#include "cpu/m68000/m68000.h"
240242#include "taitoipt.h"
241243#include "video/taitoic.h"
242244#include "audio/taitosnd.h"
r3957r3958
616618   MDRV_CPU_ADD("audio", Z80, XTAL_16MHz/4) /* verified on pcb */
617619   MDRV_CPU_PROGRAM_MAP(rainbow_s_readmem,rainbow_s_writemem)
618620
619   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
621   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
620622
621623   /* video hardware */
622624   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
653655   MDRV_CPU_ADD("audio", Z80, XTAL_18_432MHz/6)   /* not verified but music tempo matches original */
654656   MDRV_CPU_PROGRAM_MAP(jumping_sound_readmem,jumping_sound_writemem)
655657
656   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough ? */
658   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough ? */
657659
658660   /* video hardware */
659661   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/galspnbl.c
r3957r3958
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "cpu/m68000/m68000.h"
2223#include "cpu/z80/z80.h"
2324#include "sound/okim6295.h"
2425#include "sound/3812intf.h"
src/mame/drivers/dynduke.c
r3957r3958
6363***************************************************************************/
6464
6565#include "driver.h"
66#include "cpu/nec/nec.h"
6667#include "cpu/z80/z80.h"
6768#include "audio/seibu.h"
6869#include "sound/3812intf.h"
r3957r3958
292293
293294   SEIBU_SOUND_SYSTEM_CPU(14318180/4)
294295
295   MDRV_INTERLEAVE(60)
296   MDRV_QUANTUM_TIME(HZ(3600))
296297
297298   MDRV_MACHINE_RESET(seibu_sound)
298299
src/mame/drivers/mgolf.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89
910static UINT8* mgolf_video_ram;
1011
src/mame/drivers/deco_mlc.c
r3957r3958
723723static DRIVER_INIT( avengrgs )
724724{
725725   // init options
726   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
726   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
727727
728728   // set up speed cheat
729   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
730   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x3234);
731   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
732   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x32dc);
729   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
730   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x3234);
731   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
732   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x32dc);
733733
734734   mainCpuIsArm=0;
735735   memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r );
src/mame/drivers/tunhunt.c
r3957r3958
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "cpu/m6502/m6502.h"
5253#include "deprecat.h"
5354#include "sound/pokey.h"
5455
src/mame/drivers/tryout.c
r3957r3958
1313****************************************************************/
1414
1515#include "driver.h"
16#include "cpu/m6502/m6502.h"
1617#include "deprecat.h"
1718#include "sound/2203intf.h"
1819
src/mame/drivers/pasha2.c
r3957r3958
7272*********************************************************************/
7373
7474#include "driver.h"
75#include "cpu/e132xs/e132xs.h"
7576#include "machine/eeprom.h"
7677#include "sound/okim6295.h"
7778
src/mame/drivers/rungun.c
r3957r3958
336336   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
337337   MDRV_CPU_PERIODIC_INT(audio_interrupt, 480)
338338
339   MDRV_INTERLEAVE(100) // higher if sound stutters
339   MDRV_QUANTUM_TIME(HZ(6000)) // higher if sound stutters
340340
341341   MDRV_GFXDECODE(rungun)
342342
src/mame/drivers/tempest.c
r3957r3958
278278***************************************************************************/
279279
280280#include "driver.h"
281#include "cpu/m6502/m6502.h"
281282#include "machine/mathbox.h"
282283#include "video/avgdvg.h"
283284#include "video/vector.h"
r3957r3958
554555   MDRV_CPU_ADD("main", M6502, MASTER_CLOCK / 8)
555556   MDRV_CPU_PROGRAM_MAP(main_map, 0)
556557   MDRV_CPU_PERIODIC_INT(irq0_line_assert, (double)MASTER_CLOCK / 4096 / 12)
557   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ(CLOCK_3KHZ / 256))
558   MDRV_WATCHDOG_TIME_INIT(HZ(CLOCK_3KHZ / 256))
558559   MDRV_NVRAM_HANDLER(atari_vg)
559560
560561   /* video hardware */
src/mame/drivers/madmotor.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/m68000/m68000.h"
1617#include "cpu/h6280/h6280.h"
1718#include "sound/2203intf.h"
1819#include "sound/2151intf.h"
src/mame/drivers/eprom.c
r3957r3958
2424
2525
2626#include "driver.h"
27#include "cpu/m68000/m68000.h"
2728#include "machine/atarigen.h"
2829#include "audio/atarijsa.h"
2930#include "eprom.h"
r3957r3958
416417   MDRV_CPU_ADD("extra", M68000, ATARI_CLOCK_14MHz/2)
417418   MDRV_CPU_PROGRAM_MAP(extra_map,0)
418419
419   MDRV_INTERLEAVE(100)
420   MDRV_QUANTUM_TIME(HZ(6000))
420421
421422   MDRV_MACHINE_RESET(eprom)
422423   MDRV_NVRAM_HANDLER(atarigen)
r3957r3958
447448   MDRV_CPU_PROGRAM_MAP(main_map,0)
448449   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
449450
450   MDRV_INTERLEAVE(10)
451   MDRV_QUANTUM_TIME(HZ(600))
451452
452453   MDRV_MACHINE_RESET(klaxp)
453454   MDRV_NVRAM_HANDLER(atarigen)
r3957r3958
477478   MDRV_CPU_PROGRAM_MAP(guts_map,0)
478479   MDRV_CPU_VBLANK_INT("main", atarigen_video_int_gen)
479480
480   MDRV_INTERLEAVE(10)
481   MDRV_QUANTUM_TIME(HZ(600))
481482
482483   MDRV_MACHINE_RESET(eprom)
483484   MDRV_NVRAM_HANDLER(atarigen)
src/mame/drivers/bublbobl.c
r3957r3958
269269***************************************************************************/
270270
271271#include "driver.h"
272#include "cpu/z80/z80.h"
273#include "cpu/m6800/m6800.h"
272274#include "deprecat.h"
273275#include "sound/2203intf.h"
274276#include "sound/3812intf.h"
r3957r3958
699701   MDRV_CPU_ADD("audio", Z80, MAIN_XTAL/8)   // 3 MHz
700702   MDRV_CPU_PROGRAM_MAP(tokio_sound_map, 0) // NMIs are triggered by the main CPU, IRQs are triggered by the YM2203
701703
702   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
704   MDRV_QUANTUM_TIME(HZ(6000)) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
703705
704706   // video hardware
705707
r3957r3958
743745   MDRV_CPU_PROGRAM_MAP(mcu_map, 0)
744746   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse) // comes from the same clock that latches the INT pin on the second Z80
745747
746   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
748   MDRV_QUANTUM_TIME(HZ(6000)) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
747749
748750   // video hardware
749751
src/mame/drivers/chinsan.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "machine/mc8123.h"
4445#include "sound/2203intf.h"
4546
src/mame/drivers/skyfox.c
r3957r3958
1717
1818***************************************************************************/
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "sound/2203intf.h"
2122
2223/* Variables defined in video: */
src/mame/drivers/cshooter.c
r3957r3958
8484*/
8585
8686#include "driver.h"
87#include "cpu/z80/z80.h"
8788#include "deprecat.h"
8889#include "audio/seibu.h"
8990
src/mame/drivers/aerofgt.c
r3957r3958
5959***************************************************************************/
6060
6161#include "driver.h"
62#include "cpu/m68000/m68000.h"
6263#include "cpu/z80/z80.h"
6364#include "sound/2610intf.h"
6465#include "sound/3812intf.h"
src/mame/drivers/fgoal.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/m6800/m6800.h"
2021#include "includes/fgoal.h"
2122
2223UINT8* fgoal_video_ram;
src/mame/drivers/coinmstr.c
r3957r3958
2323
2424
2525#include "driver.h"
26#include "cpu/z80/z80.h"
2627#include "machine/6821pia.h"
2728#include "video/mc6845.h"
2829#include "sound/ay8910.h"
r3957r3958
648649   MDRV_VIDEO_START(coinmstr)
649650   MDRV_VIDEO_UPDATE(coinmstr)
650651
651   MDRV_DEVICE_ADD("crtc", MC6845)
652   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
652653
653654   /* sound hardware */
654655   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/docastle.c
r3957r3958
153153***************************************************************************/
154154
155155#include "driver.h"
156#include "cpu/z80/z80.h"
156157#include "deprecat.h"
157158#include "sound/msm5205.h"
158159#include "sound/sn76496.h"
src/mame/drivers/expro02.c
r3957r3958
145145*/
146146
147147#include "driver.h"
148#include "cpu/m68000/m68000.h"
148149#include "deprecat.h"
149150#include "includes/kaneko16.h"
150151#include "sound/okim6295.h"
r3957r3958
500501   MDRV_PALETTE_INIT(berlwall)
501502
502503   /* arm watchdog */
503   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
504   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
504505
505506   /* sound hardware */
506507   MDRV_SPEAKER_STANDARD_MONO("mono")
r3957r3958
519520   MDRV_CPU_MODIFY("main")
520521   MDRV_CPU_PROGRAM_MAP(fantasia_map,0)
521522
522   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(0))   /* a guess, and certainly wrong */
523   MDRV_WATCHDOG_TIME_INIT(SEC(0))   /* a guess, and certainly wrong */
523524
524525MACHINE_DRIVER_END
525526
src/mame/drivers/ultrsprt.c
r3957r3958
55*/
66
77#include "driver.h"
8#include "cpu/m68000/m68000.h"
89#include "cpu/powerpc/ppc.h"
910#include "sound/k054539.h"
1011#include "machine/eeprom.h"
r3957r3958
8182static MACHINE_START( ultrsprt )
8283{
8384   /* set conservative DRC options */
84   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
85   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
8586
8687   /* configure fast RAM regions for DRC */
87   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
88   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
89   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x0007ffff);
90   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, vram);
91   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
88   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
89   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
90   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x0007ffff);
91   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, vram);
92   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
9293
93   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 1);
94   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x7f000000);
95   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x7f01ffff);
96   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
97   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
94   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 1);
95   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x7f000000);
96   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x7f01ffff);
97   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
98   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
9899}
99100
100101
r3957r3958
239240   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
240241   MDRV_CPU_PERIODIC_INT(irq5_line_hold, 1)   // ???
241242
242   MDRV_INTERLEAVE(200)
243   MDRV_QUANTUM_TIME(HZ(12000))
243244
244245   MDRV_NVRAM_HANDLER(ultrsprt)
245246   MDRV_MACHINE_START(ultrsprt)
src/mame/drivers/mainsnk.c
r3957r3958
108108*/
109109
110110#include "driver.h"
111#include "cpu/z80/z80.h"
111112#include "snk.h"
112113#include "sound/ay8910.h"
113114
src/mame/drivers/mystston.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/m6502/m6502.h"
1718#include "sound/ay8910.h"
1819#include "mystston.h"
1920
src/mame/drivers/midyunit.c
r3957r3958
112112**************************************************************************/
113113
114114#include "driver.h"
115#include "cpu/z80/z80.h"
115116#include "cpu/tms34010/tms34010.h"
116117#include "audio/williams.h"
117118#include "sound/okim6295.h"
src/mame/drivers/hitme.c
r3957r3958
1515*/
1616
1717#include "driver.h"
18#include "cpu/i8085/i8085.h"
1819#include "hitme.h"
1920#include "sound/discrete.h"
2021
src/mame/drivers/rampart.c
r3957r3958
2323
2424
2525#include "driver.h"
26#include "cpu/m68000/m68000.h"
2627#include "machine/atarigen.h"
2728#include "rampart.h"
2829#include "sound/okim6295.h"
r3957r3958
528529
529530   atarigen_eeprom_default = compressed_default_eeprom;
530531   memcpy(&rom[0x140000], &rom[0x40000], 0x8000);
531   atarigen_slapstic_init(machine, 0, 0x140000, 0x438000, 118);
532   atarigen_slapstic_init(machine->cpu[0], 0x140000, 0x438000, 118);
532533}
533534
534535
src/mame/drivers/senjyo.c
r3957r3958
6969***************************************************************************/
7070
7171#include "driver.h"
72#include "cpu/z80/z80.h"
7273#include "sound/sn76496.h"
7374#include "sound/samples.h"
7475#include "machine/segacrpt.h"
r3957r3958
9495
9596static WRITE8_HANDLER( flip_screen_w )
9697{
97   flip_screen_set(data);
98   flip_screen_set(space->machine, data);
9899}
99100
100101static WRITE8_HANDLER( paletteram_IIBBGGRR_w )
r3957r3958
606607   MDRV_MACHINE_RESET(senjyo)
607608
608609   MDRV_Z80PIO_ADD( "z80pio", senjyo_pio_intf )
609   MDRV_Z80CTC_ADD( "z80ctc", senjyo_ctc_intf )
610   MDRV_Z80CTC_ADD( "z80ctc", 2000000 /* same as "sub" */, senjyo_ctc_intf )
610611
611612   /* video hardware */
612613   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/murogem.c
r3957r3958
9595*/
9696
9797#include "driver.h"
98#include "cpu/m6800/m6800.h"
9899#include "video/mc6845.h"
99100
100101static UINT8 *murogem_videoram;
r3957r3958
212213   MDRV_PALETTE_INIT(murogem)
213214   MDRV_VIDEO_UPDATE(murogem)
214215
215   MDRV_DEVICE_ADD("crtc", MC6845)
216   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
216217MACHINE_DRIVER_END
217218
218219
src/mame/drivers/snowbros.c
r3957r3958
7676static WRITE16_HANDLER( snowbros_flipscreen_w )
7777{
7878   if (ACCESSING_BITS_8_15)
79      flip_screen_set(~data & 0x8000);
79      flip_screen_set(space->machine, ~data & 0x8000);
8080}
8181
8282
src/mame/drivers/bzone.c
r3957r3958
201201***************************************************************************/
202202
203203#include "driver.h"
204#include "cpu/m6502/m6502.h"
204205#include "video/vector.h"
205206#include "video/avgdvg.h"
206207#include "machine/mathbox.h"
src/mame/drivers/mhavoc.c
r3957r3958
184184***************************************************************************/
185185
186186#include "driver.h"
187#include "cpu/m6502/m6502.h"
187188#include "machine/atari_vg.h"
188189#include "video/avgdvg.h"
189190#include "video/vector.h"
src/mame/drivers/segaxbd.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
2324#include "system16.h"
2425#include "cpu/m68000/m68000.h"
2526#include "machine/segaic16.h"
r3957r3958
210211   segaic16_tilemap_reset(machine, 0);
211212
212213   /* hook the RESET line, which resets CPU #1 */
213   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)xboard_reset);
214   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_RESET_CALLBACK, (genf *)xboard_reset);
214215
215216   /* set up the compare/timer chip */
216217   segaic16_compare_timer_init(0, sound_data_w, timer_ack_callback);
r3957r3958
11381139
11391140   MDRV_MACHINE_RESET(xboard)
11401141   MDRV_NVRAM_HANDLER(xboard)
1141   MDRV_INTERLEAVE(100)
1142   MDRV_QUANTUM_TIME(HZ(6000))
11421143
11431144   /* video hardware */
11441145   MDRV_GFXDECODE(segaxbd)
src/mame/drivers/nbmj9195.c
r3957r3958
2020******************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
2324#include "machine/z80ctc.h"
2425#include "nb1413m3.h"      // needed for mahjong input controller
2526#include "sound/3812intf.h"
r3957r3958
490491
491492static z80ctc_interface ctc_intf_main =
492493{
493   "main",                  /* clock from main CPU */
494   0,                     /* clock */
495494   0,                     /* timer disables */
496495   ctc0_interrupt,            /* interrupt handler */
497496   0,                     /* ZC/TO0 callback ctc1.zc0 -> ctc1.trg3 */
r3957r3958
501500
502501static z80ctc_interface ctc_intf_audio =
503502{
504   "audio",               /* clock from audio CPU */
505   0,                     /* clock */
506503   0,                     /* timer disables */
507504   ctc1_interrupt,            /* interrupt handler */
508505   z80ctc_trg3_w,            /* ZC/TO0 callback ctc1.zc0 -> ctc1.trg3 */
r3957r3958
36403637   MDRV_CPU_PROGRAM_MAP(sound_readmem, sound_writemem)
36413638   MDRV_CPU_IO_MAP(sound_readport, sound_writeport)
36423639
3643   MDRV_Z80CTC_ADD("main_ctc", ctc_intf_main)
3644   MDRV_Z80CTC_ADD("audio_ctc", ctc_intf_audio)
3640   MDRV_Z80CTC_ADD("main_ctc", 12000000/2 /* same as "main" */, ctc_intf_main)
3641   MDRV_Z80CTC_ADD("audio_ctc", 8000000/1 /* same as "audio" */, ctc_intf_audio)
36453642
36463643   MDRV_MACHINE_RESET(sailorws)
36473644
src/mame/drivers/spool99.c
r3957r3958
8888*******************************************************************************************/
8989
9090#include "driver.h"
91#include "cpu/z80/z80.h"
9192#include "sound/okim6295.h"
9293#include "machine/eeprom.h"
9394
src/mame/drivers/sslam.c
r3957r3958
8181
8282
8383#include "driver.h"
84#include "cpu/m68000/m68000.h"
8485#include "cpu/mcs51/mcs51.h"
8586#include "sound/okim6295.h"
8687
src/mame/drivers/lgp.c
r3957r3958
6464
6565
6666#include "driver.h"
67#include "cpu/z80/z80.h"
6768#include "render.h"
6869#include "machine/laserdsc.h"
6970
src/mame/drivers/deadang.c
r3957r3958
3737*/
3838
3939#include "driver.h"
40#include "cpu/nec/nec.h"
4041#include "deprecat.h"
4142#include "audio/seibu.h"
4243#include "sound/2203intf.h"
r3957r3958
237238
238239   SEIBU3A_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4)
239240
240   MDRV_INTERLEAVE(1) // the game stops working with higher interleave rates..
241   MDRV_QUANTUM_TIME(HZ(60)) // the game stops working with higher interleave rates..
241242
242243   MDRV_MACHINE_RESET(seibu_sound)
243244
src/mame/drivers/cliffhgr.c
r3957r3958
7474*********************************************************/
7575
7676#include "driver.h"
77#include "cpu/z80/z80.h"
7778#include "render.h"
7879#include "machine/laserdsc.h"
7980#include "video/tms9928a.h"
src/mame/drivers/copsnrob.c
r3957r3958
5656***************************************************************************/
5757
5858#include "driver.h"
59#include "cpu/m6502/m6502.h"
5960#include "copsnrob.h"
6061#include "copsnrob.lh"
6162
src/mame/drivers/artmagic.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/m68000/m68000.h"
2526#include "cpu/tms34010/tms34010.h"
2627#include "video/tlc34076.h"
2728#include "artmagic.h"
r3957r3958
699700   MDRV_CPU_PROGRAM_MAP(tms_map,0)
700701
701702   MDRV_MACHINE_RESET(artmagic)
702   MDRV_INTERLEAVE(100)
703   MDRV_QUANTUM_TIME(HZ(6000))
703704   MDRV_NVRAM_HANDLER(generic_1fill)
704705
705706   /* video hardware */
src/mame/drivers/cntsteer.c
r3957r3958
2626*******************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/m6502/m6502.h"
2930#include "deprecat.h"
3031#include "cpu/m6809/m6809.h"
3132#include "sound/ay8910.h"
r3957r3958
432433   {
433434      rotation_sign = !(data & 1);
434435
435      flip_screen_set(!(data & 4));
436      flip_screen_set(space->machine, !(data & 4));
436437
437438      scrolly_hi = (data & 0xf0) << 4;
438439
src/mame/drivers/twincobr.c
r3957r3958
188188
189189
190190#include "driver.h"
191#include "cpu/z80/z80.h"
191192#include "cpu/m68000/m68000.h"
192193#include "cpu/tms32010/tms32010.h"
193194#include "twincobr.h"
r3957r3958
716717   /* Data Map is internal to the CPU */
717718   MDRV_CPU_IO_MAP(DSP_io_map, 0)
718719
719   MDRV_INTERLEAVE(100)
720   MDRV_QUANTUM_TIME(HZ(6000))
720721
721722   MDRV_MACHINE_RESET(twincobr)   /* Reset fshark bootleg 8741 MCU data */
722723
src/mame/drivers/hexion.c
r3957r3958
7979***************************************************************************/
8080
8181#include "driver.h"
82#include "cpu/z80/z80.h"
8283#include "deprecat.h"
8384#include "sound/okim6295.h"
8485#include "sound/k051649.h"
r3957r3958
104105   coin_counter_w(1,data & 0x02);
105106
106107   /* bit 5 = flip screen */
107   flip_screen_set(data & 0x20);
108   flip_screen_set(space->machine, data & 0x20);
108109
109110   /* other bit unknown */
110111if ((data & 0xdc) != 0x10) popmessage("coincntr %02x",data);
src/mame/drivers/bking.c
r3957r3958
1616***************************************************************************/
1717
1818#include "driver.h"
19#include "cpu/z80/z80.h"
1920#include "cpu/m6805/m6805.h"
2021#include "sound/ay8910.h"
2122#include "sound/dac.h"
r3957r3958
483484
484485   MDRV_MACHINE_RESET(buggychl)
485486
486   MDRV_INTERLEAVE(100)
487   MDRV_QUANTUM_TIME(HZ(6000))
487488MACHINE_DRIVER_END
488489
489490/***************************************************************************
src/mame/drivers/dblewing.c
r3957r3958
1717*/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "cpu/m68000/m68000.h"
2122#include "decocrpt.h"
2223#include "deco16ic.h"
r3957r3958
103104         inc = 1;
104105      }
105106
106      if (flip_screen_get())
107      if (flip_screen_get(machine))
107108      {
108109         y=240-y;
109110         x=304-x;
r3957r3958
153154
154155static VIDEO_UPDATE(dblewing)
155156{
156   flip_screen_set( deco16_pf12_control[0]&0x80 );
157   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
157158   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
158159
159160   bitmap_fill(bitmap,cliprect,0); /* not Confirmed */
src/mame/drivers/galpani2.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/m68000/m68000.h"
2526#include "deprecat.h"
2627#include "machine/eeprom.h"
2728#include "kaneko16.h"
src/mame/drivers/arabian.c
r3957r3958
6767***************************************************************************/
6868
6969#include "driver.h"
70#include "cpu/z80/z80.h"
7071#include "arabian.h"
7172#include "sound/ay8910.h"
7273
src/mame/drivers/shougi.c
r3957r3958
8282
8383
8484#include "driver.h"
85#include "cpu/alph8201/alph8201.h"
8586#include "cpu/z80/z80.h"
8687#include "sound/ay8910.h"
8788#include "video/resnet.h"
r3957r3958
387388   MDRV_CPU_ADD("mcu", ALPHA8201, 10000000/4/8)
388389   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
389390
390   MDRV_INTERLEAVE(10)
391   MDRV_QUANTUM_TIME(HZ(600))
391392   MDRV_WATCHDOG_VBLANK_INIT(16)   // assuming it's the same as champbas
392393
393394   /* video hardware */
src/mame/drivers/hornet.c
r3957r3958
308308*/
309309
310310#include "driver.h"
311#include "deprecat.h"
311#include "cpu/m68000/m68000.h"
312312#include "cpu/powerpc/ppc.h"
313313#include "cpu/sharc/sharc.h"
314314#include "machine/eeprom.h"
r3957r3958
10071007   memset(jvs_sdata, 0, 1024);
10081008
10091009   /* set conservative DRC options */
1010   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
1010   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
10111011
10121012   /* configure fast RAM regions for DRC */
1013   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
1014   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
1015   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff);
1016   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
1017   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
1013   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
1014   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
1015   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff);
1016   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
1017   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
10181018
10191019   state_save_register_global(machine, led_reg0);
10201020   state_save_register_global(machine, led_reg1);
r3957r3958
10431043   NVRAM_HANDLER_CALL(93C46);
10441044}
10451045
1046static const timekeeper_config timekeeper_intf =
1047{
1048   "m48t58"
1049};
1050
10511046static MACHINE_DRIVER_START( hornet )
10521047
10531048   /* basic machine hardware */
r3957r3958
10611056   MDRV_CPU_CONFIG(sharc_cfg)
10621057   MDRV_CPU_DATA_MAP(sharc0_map, 0)
10631058
1064   MDRV_INTERLEAVE(100)
1059   MDRV_QUANTUM_TIME(HZ(6000))
10651060
10661061   MDRV_MACHINE_START( hornet )
10671062   MDRV_MACHINE_RESET( hornet )
r3957r3958
10911086   MDRV_SOUND_ROUTE(0, "left", 1.0)
10921087   MDRV_SOUND_ROUTE(1, "right", 1.0)
10931088
1094   MDRV_DEVICE_ADD( "m48t58", M48T58 )
1095   MDRV_DEVICE_CONFIG( timekeeper_intf )
1089   MDRV_M48T58_ADD( "m48t58" )
10961090MACHINE_DRIVER_END
10971091
10981092static MACHINE_RESET( hornet_2board )
r3957r3958
11731167
11741168/*****************************************************************************/
11751169
1176static void jamma_jvs_cmd_exec(void);
1170static void jamma_jvs_cmd_exec(running_machine *machine);
11771171
1178static void jamma_jvs_w(UINT8 data)
1172static void jamma_jvs_w(const device_config *device, UINT8 data)
11791173{
11801174   if (jvs_sdata_ptr == 0 && data != 0xe0)
11811175      return;
r3957r3958
11831177   jvs_sdata_ptr++;
11841178
11851179   if (jvs_sdata_ptr >= 3 && jvs_sdata_ptr >= 3 + jvs_sdata[2])
1186      jamma_jvs_cmd_exec();
1180      jamma_jvs_cmd_exec(device->machine);
11871181}
11881182
1189static int jvs_encode_data(UINT8 *in, int length)
1183static int jvs_encode_data(running_machine *machine, UINT8 *in, int length)
11901184{
1191   running_machine *machine = Machine;
11921185   int inptr = 0;
11931186   int sum = 0;
11941187
r3957r3958
12381231   return outptr;
12391232}
12401233
1241static void jamma_jvs_cmd_exec(void)
1234static void jamma_jvs_cmd_exec(running_machine *machine)
12421235{
1243   running_machine *machine = Machine;
12441236   UINT8 sync, node, byte_num;
12451237   UINT8 data[1024], rdata[1024];
12461238   int length;
r3957r3958
13031295   ppc4xx_spu_receive_byte(machine->cpu[0], 0xe0);         // sync
13041296   ppc4xx_spu_receive_byte(machine->cpu[0], 0x00);         // node
13051297   ppc4xx_spu_receive_byte(machine->cpu[0], rdata_ptr+1);   // num of bytes
1306   sum += jvs_encode_data(rdata, rdata_ptr);
1298   sum += jvs_encode_data(machine, rdata, rdata_ptr);
13071299   ppc4xx_spu_receive_byte(machine->cpu[0], sum - 1);      // checksum
13081300
13091301   jvs_sdata_ptr = 0;
r3957r3958
13261318
13271319static DRIVER_INIT(hornet)
13281320{
1329   init_konami_cgboard(1, CGBOARD_TYPE_HORNET);
1330   set_cgboard_texture_bank(0, 5, memory_region(machine, "user5"));
1321   init_konami_cgboard(machine, 1, CGBOARD_TYPE_HORNET);
1322   set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5"));
13311323
13321324   K056800_init(machine, sound_irq_callback);
13331325   K033906_init(machine);
r3957r3958
13391331
13401332static DRIVER_INIT(hornet_2board)
13411333{
1342   init_konami_cgboard(2, CGBOARD_TYPE_HORNET);
1343   set_cgboard_texture_bank(0, 5, memory_region(machine, "user5"));
1344   set_cgboard_texture_bank(1, 6, memory_region(machine, "user5"));
1334   init_konami_cgboard(machine, 2, CGBOARD_TYPE_HORNET);
1335   set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5"));
1336   set_cgboard_texture_bank(machine, 1, 6, memory_region(machine, "user5"));
13451337
13461338   K056800_init(machine, sound_irq_callback);
13471339   K033906_init(machine);
r3957r3958
13551347
13561348ROM_START(sscope)
13571349   ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1358   ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x200000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14))
1350   ROM_LOAD16_WORD_SWAP("ss1-1.27p", 0x200000, 0x200000, CRC(3b6bb075) SHA1(babc134c3a20c7cdcaa735d5f1fd5cab38667a14) )
13591351   ROM_RELOAD(0x000000, 0x200000)
13601352
13611353   ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
13621354
13631355   ROM_REGION(0x80000, "audio", 0)      /* 68K Program */
1364   ROM_LOAD16_WORD_SWAP("ss1-1.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1))
1356   ROM_LOAD16_WORD_SWAP("ss1-1.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
13651357
13661358   ROM_REGION(0x1000000, "user5", 0)      /* CG Board texture roms */
13671359   ROM_LOAD32_WORD( "ss1-3.u32",    0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
r3957r3958
13771369
13781370ROM_START(sscopea)
13791371   ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1380   ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x200000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37))
1372   ROM_LOAD16_WORD_SWAP("830_a01.bin", 0x200000, 0x200000, CRC(39e353f1) SHA1(569b06969ae7a690f6d6e63cc3b5336061663a37) )
13811373   ROM_RELOAD(0x000000, 0x200000)
13821374
13831375   ROM_REGION32_BE(0x800000, "user2", ROMREGION_ERASE00)   /* Data roms */
13841376
13851377   ROM_REGION(0x80000, "audio", 0)      /* 68K Program */
1386   ROM_LOAD16_WORD_SWAP("ss1-1.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1))
1378   ROM_LOAD16_WORD_SWAP("ss1-1.7s", 0x000000, 0x80000, CRC(2805ea1d) SHA1(2556a51ee98cb8f59bf081e916c69a24532196f1) )
13871379
13881380   ROM_REGION(0x1000000, "user5", 0)      /* CG Board texture roms */
13891381   ROM_LOAD32_WORD( "ss1-3.u32",    0x000000, 0x400000, CRC(335793e1) SHA1(d582b53c3853abd59bc728f619a30c27cfc9497c) )
r3957r3958
13991391
14001392ROM_START(sscope2)
14011393   ROM_REGION32_BE(0x400000, "user1", 0)   /* PowerPC program */
1402   ROM_LOAD16_WORD_SWAP("931d01.bin", 0x200000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2))
1394   ROM_LOAD16_WORD_SWAP("931d01.bin", 0x200000, 0x200000, CRC(4065fde6) SHA1(84f2dedc3e8f61651b22c0a21433a64993e1b9e2) )
14031395   ROM_RELOAD(0x000000, 0x200000)
14041396
14051397   ROM_REGION32_BE(0x800000, "user2", 0)   /* Data roms */
1406   ROM_LOAD32_WORD_SWAP("931a04.bin", 0x000000, 0x200000, CRC(4f5917e6) SHA1(a63a107f1d6d9756e4ab0965d72ea446f0692814))
1398   ROM_LOAD32_WORD_SWAP("931a04.bin", 0x000000, 0x200000, CRC(4f5917e6) SHA1(a63a107f1d6d9756e4ab0965d72ea446f0692814) )
14071399
14081400   ROM_REGION32_BE(0x800000, "user3", 0)   /* Comm board roms */
1409   ROM_LOAD("931a19.bin", 0x000000, 0x400000, BAD_DUMP CRC(8e8bb6af) SHA1(1bb399f7897fbcbe6852fda3215052b2810437d8))
1410   ROM_LOAD("931a20.bin", 0x400000, 0x400000, BAD_DUMP CRC(a14a7887) SHA1(daf0cbaf83e59680a0d3c4d66fcc48d02c9723d1))
1401   ROM_LOAD("931a19.bin", 0x000000, 0x400000, CRC(8b25a6f1) SHA1(41f9c2046a6aae1e9f5f3ffa3e0ffb15eba46211) )
1402   ROM_LOAD("931a20.bin", 0x400000, 0x400000, CRC(ecf665f6) SHA1(5a73e87435560a7bb2d0f9be7fba12254b18708d) )
14111403
14121404   ROM_REGION(0x800000, "user5", ROMREGION_ERASE00)   /* CG Board texture roms */
14131405
14141406   ROM_REGION(0x80000, "audio", 0)      /* 68K Program */
1415   ROM_LOAD16_WORD_SWAP("931a08.bin", 0x000000, 0x80000, CRC(1597d604) SHA1(a1eab4d25907930b59ea558b484c3b6ddcb9303c))
1407   ROM_LOAD16_WORD_SWAP("931a08.bin", 0x000000, 0x80000, CRC(1597d604) SHA1(a1eab4d25907930b59ea558b484c3b6ddcb9303c) )
14161408
14171409   ROM_REGION(0xc00000, "rf", 0)      /* PCM sample roms */
14181410   ROM_LOAD( "931a09.bin",   0x000000, 0x400000, CRC(694c354c) SHA1(42f54254a5959e1b341f2801f1ad032c4ed6f329) )
src/mame/drivers/ccastles.c
r3957r3958
120120***************************************************************************/
121121
122122#include "driver.h"
123#include "cpu/m6502/m6502.h"
123124#include "sound/pokey.h"
124125#include "ccastles.h"
125126
src/mame/drivers/ddragon3.c
r3957r3958
1212    Combatribes has sprite lag but it seems to be caused by poor
1313    programming and I think the original does the same.
1414
15
16
17Double Dragon 3 PCB Layout
18--------------------------
19
20TA-0030-P1-03 (early version with EPROMs)
21TA-0030-P1-04 (later version with MASKROMs)
22|----------------------------------------------|
23|VOL M51516 YM3012 YM2151     3.579545MHz IC15 |
24|     MB3615 1.056MHz   Z80               IC14|-|
25|     MB3615  M6295      IC43                 | |
26|                                6116     IC13| |
27|           IC74         6116 |-------|   IC12| |
28|           IC73         28MHz|TECHNOS|       | |
29|                        6116 |TJ-003 |   IC11| |
30|J                            |       |   IC10|-|
31|A                       6116 |-------|        |
32|M                       30.IC38          IC9  |
33|M  DSW1                      |-------|   IC8 |-|
34|A                            |TECHNOS|       | |
35|   DSW2                      |TJ-002 |   IC7 | |
36|             6116            |       |   IC6 | |
37|             6116            |-------|       | |
38|      IC79 IC80                6264      IC5 | |
39|CN4          6264              6264      IC4 |-|
40|    68000    6264        20MHz                |
41|----------------------------------------------|
42Notes:
436264 - 8k x8 SRAM
446116 - 2k x8 SRAM
4568000 clock - 10.000MHz [20/2]
46Z80 clock - 3.579545MHz
47M6295 clock - 1.056MHz. Pin 7 HIGH
48YM2151 clock - 3.579545MHz
49VSync - 57.4446Hz
50HSync - 15.6250kHz
51CN4 - connector for extra controls
52
53IC4 to IC15 not populated
54IC79 - 1M EPROM (27C010)
55IC80 - 2M EPROM (27C020)
56IC73/74 - 2M EPROM (27C020)
57IC43 - 512k EPROM (27C512)
5830.IC38 - MB7114 / 82S129 Bipolar PROM
59
60
61ROM Board (only used on earlier version -03 main board)
62---------
63TA-0028-P2-10
64|------------------------|
65|IC33                    |
66|IC34                   |-|
67|IC35    IC19     IC3   | |
68|IC36    IC20     IC4   | |
69|IC37    IC21     IC5   | |
70|        IC22     IC6   | |
71|IC38    IC23     IC7   | |
72|IC39             IC8   |-|
73|IC40    IC24            |
74|IC41    IC25            |
75|IC42    IC26           |-|
76|IC43    IC27           | |
77|        IC28           | |
78|IC44                   | |
79|IC45    IC29     IC13  | |
80|IC46    IC30     IC14  | |
81|IC47    IC31     IC15  |-|
82|IC48    IC32     IC16   |
83|------------------------|
84Notes:
85
86ROMs (All ROMs are 27C010 EPROM. - means not populated)
87      Label   Location
88      ----------------
89      25      IC3
90      26      IC4
91      27      IC5
92      28      IC6
93      30A9-0  IC7
94      -       IC8
95      30      IC13
96      31      IC14
97      -       IC15
98      -       IC16
99      16      IC19
100      17      IC20
101      18      IC21
102      19      IC22
103      30A10-0 IC23
104      -       IC24
105      21      IC25
106      22      IC26
107      -       IC27
108      -       IC28
109      23      IC29
110      24      IC30
111      -       IC31
112      -       IC32
113      4       IC33
114      5       IC34
115      6       IC35
116      7       IC36
117      30A11-0 IC37
118      -       IC38
119      9       IC39
120      10      IC40
121      11      IC41
122      12      IC42
123      30A12-0 IC43
124      -       IC44
125      14      IC45
126      15      IC46
127      -       IC47
128      -       IC48
129
15130******************************************************************/
16131
17132/*
r3957r3958
24139
25140
26141#include "driver.h"
27#include "deprecat.h"
28142#include "cpu/z80/z80.h"
29143#include "cpu/m68000/m68000.h"
30144#include "sound/2151intf.h"
31145#include "sound/okim6295.h"
32146
147#define PIXEL_CLOCK      (XTAL_28MHz / 4)
33148
34149extern UINT16 *ddragon3_bg_videoram16;
35150extern UINT16 *ddragon3_fg_videoram16;
r3957r3958
76191      /*  this gets written to on startup and at the end of IRQ6
77192        **  possibly trigger IRQ on sound CPU
78193        */
194      cpu_set_input_line(space->machine->cpu[0], 6, CLEAR_LINE);
79195      break;
80196
81197      case 3:
82198      /*  this gets written to on startup,
83199        **  and at the end of IRQ5 (input port read) */
200      cpu_set_input_line(space->machine->cpu[0], 5, CLEAR_LINE);
84201      break;
85202
86203      case 4:
87204      /* this gets written to at the end of IRQ6 only */
205      cpu_set_input_line(space->machine->cpu[0], 6, CLEAR_LINE);
88206      break;
89207
90208      default:
r3957r3958
303421   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
304422   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
305423   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE1 )
306   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VBLANK )
424   PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_VBLANK )
307425   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Flip_Screen ) )   PORT_DIPLOCATION("SW1:7")
308426   PORT_DIPSETTING(     0x1000, DEF_STR( Off ) )
309427   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
r3957r3958
467585 *
468586 *************************************/
469587
470static INTERRUPT_GEN( ddragon3_cpu_interrupt ) { /* 6:0x177e - 5:0x176a */
471   if( cpu_getiloops(device) == 0 ){
472      cpu_set_input_line(device, 6, HOLD_LINE);  /* VBlank */
588static TIMER_DEVICE_CALLBACK( ddragon3_scanline )
589{
590   int scanline = param;
591
592   /* An interrupt is generated every 16 scanlines */
593   if (scanline % 16 == 0)
594   {
595      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
596      cpu_set_input_line(timer->machine->cpu[0], 5, ASSERT_LINE);
473597   }
474   else {
475      cpu_set_input_line(device, 5, HOLD_LINE); /* Input Ports */
598
599   /* Vblank is raised on scanline 248 */
600   if (scanline == 248)
601   {
602      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
603      cpu_set_input_line(timer->machine->cpu[0], 6, ASSERT_LINE);
476604   }
605
606   /* Adjust for next scanline */
607   if (++scanline >= video_screen_get_height(timer->machine->primary_screen))
608   {
609      scanline = 0;
610   }
477611}
478612
479613/*************************************
r3957r3958
484618
485619static MACHINE_DRIVER_START( ddragon3 )
486620   /* basic machine hardware */
487   MDRV_CPU_ADD("main", M68000, 12000000) // Guess
621   MDRV_CPU_ADD("main", M68000, XTAL_20MHz / 2)
488622   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
489   MDRV_CPU_VBLANK_INT_HACK(ddragon3_cpu_interrupt, 2)
623   MDRV_TIMER_ADD_SCANLINE("scantimer", ddragon3_scanline, "main", 0, 1)
490624
491   MDRV_CPU_ADD("audio", Z80, 3579545) // Guess (confirmed on bootleg)
625   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz)
492626   MDRV_CPU_PROGRAM_MAP(readmem_sound, writemem_sound)
493627
494628   /* video hardware */
495629   MDRV_SCREEN_ADD("main", RASTER)
496   MDRV_SCREEN_REFRESH_RATE(57)
497   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
498630   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
499   MDRV_SCREEN_SIZE(40*8, 32*8)
500   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
631   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 448, 0, 320, 272, 8, 248)   /* HTOTAL and VTOTAL are guessed */
501632
502633   MDRV_GFXDECODE(ddragon3)
503634   MDRV_PALETTE_LENGTH(768)
r3957r3958
508639   /* sound hardware */
509640   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
510641
511   MDRV_SOUND_ADD("ym2151", YM2151, 3579545)   /* music */
642   MDRV_SOUND_ADD("ym2151", YM2151, XTAL_3_579545MHz)
512643   MDRV_SOUND_CONFIG(ym2151_config)
513644   MDRV_SOUND_ROUTE(0, "left", 0.50)
514645   MDRV_SOUND_ROUTE(1, "right", 0.50)
515646
516   MDRV_SOUND_ADD("oki", OKIM6295, 1000000)   /* sound fx */
517   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified
647   MDRV_SOUND_ADD("oki", OKIM6295, XTAL_1_056MHz)
648   MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
518649   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 1.50)
519650   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.50)
520651MACHINE_DRIVER_END
r3957r3958
535666   MDRV_CPU_MODIFY("audio")
536667   MDRV_CPU_PROGRAM_MAP(ctribe_readmem_sound,ctribe_writemem_sound)
537668
538   MDRV_SCREEN_MODIFY("main")
539   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
540
541669   MDRV_VIDEO_UPDATE(ctribe)
542670
543671   MDRV_SOUND_MODIFY("ym2151")
r3957r3958
563691   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
564692   ROM_LOAD( "30a13-0.ic43", 0x00000, 0x10000, CRC(1e974d9b) SHA1(8e54ff747efe587a2e971c15e729445c4e232f0f) )
565693
566   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
567   ROM_LOAD( "30j-7.ic4",    0x000000, 0x40000, CRC(89d58d32) SHA1(54cfc154024e014f537c7ae0c2275ece50413bc5) ) /* Background */
694   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
695   ROM_LOAD( "30j-7.ic4",    0x000000, 0x40000, CRC(89d58d32) SHA1(54cfc154024e014f537c7ae0c2275ece50413bc5) )
568696   ROM_LOAD( "30j-6.ic5",    0x040000, 0x40000, CRC(9bf1538e) SHA1(c7cb96c6b1ac73ec52f46b2a6687bfcfd375ab44) )
569697   ROM_LOAD( "30j-5.ic6",    0x080000, 0x40000, CRC(8f671a62) SHA1(b5dba61ad6ed39440bb98f7b2dc1111779d6c4a1) )
570698   ROM_LOAD( "30j-4.ic7",    0x0c0000, 0x40000, CRC(0f74ea1c) SHA1(6bd8dd89bd22b29038cf502a898336e95e50a9cc) )
571699
572   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE ) /* sprites */
700   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
573701   ROM_LOAD( "30j-3.ic9",    0x000000, 0x80000, CRC(b3151871) SHA1(a647b4d9bddd6b8715a1d24641391a2e2d0f8867) )
574702   ROM_LOAD( "30a12-0.ic8",  0x080000, 0x10000, CRC(20d64bea) SHA1(c2bd86bc5310f13f158ca2f93cfc57e5dbf01f7e) )
575703   ROM_LOAD( "30j-2.ic11",   0x100000, 0x80000, CRC(41c6fb08) SHA1(9fb6105bdc9ff8eeaacf378d208cf6d32a09401b) )
r3957r3958
594722   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
595723   ROM_LOAD( "30j13.ic43",   0x00000, 0x10000, CRC(1e974d9b) SHA1(8e54ff747efe587a2e971c15e729445c4e232f0f) )
596724
597   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
598   ROM_LOAD( "30j-7.ic4",    0x000000, 0x40000, CRC(89d58d32) SHA1(54cfc154024e014f537c7ae0c2275ece50413bc5) ) /* Background */
725   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
726   ROM_LOAD( "30j-7.ic4",    0x000000, 0x40000, CRC(89d58d32) SHA1(54cfc154024e014f537c7ae0c2275ece50413bc5) )
599727   ROM_LOAD( "30j-6.ic5",    0x040000, 0x40000, CRC(9bf1538e) SHA1(c7cb96c6b1ac73ec52f46b2a6687bfcfd375ab44) )
600728   ROM_LOAD( "30j-5.ic6",    0x080000, 0x40000, CRC(8f671a62) SHA1(b5dba61ad6ed39440bb98f7b2dc1111779d6c4a1) )
601729   ROM_LOAD( "30j-4.ic7",    0x0c0000, 0x40000, CRC(0f74ea1c) SHA1(6bd8dd89bd22b29038cf502a898336e95e50a9cc) )
602730
603   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE ) /* sprites */
731   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
604732   ROM_LOAD( "30j-3.ic9",    0x000000, 0x80000, CRC(b3151871) SHA1(a647b4d9bddd6b8715a1d24641391a2e2d0f8867) )
605733   ROM_LOAD( "30j12-0.ic8",  0x080000, 0x10000, CRC(1e9290d7) SHA1(77e660d2dc9a0e2c4c8ceb3e47b7ce674bceb34a) )
606734   ROM_LOAD( "30j-2.ic11",   0x100000, 0x80000, CRC(41c6fb08) SHA1(9fb6105bdc9ff8eeaacf378d208cf6d32a09401b) )
r3957r3958
617745   ROM_LOAD( "mb7114h.ic38", 0x000000, 0x00100, CRC(113c7443) SHA1(7b0b13e9f0c219f6d436aeec06494734d1f4a599) )
618746ROM_END
619747
748ROM_START( ddrago3p )
749   ROM_REGION( 0x80000, "main", 0 )   /* 64k for cpu code */
750   ROM_LOAD16_BYTE( "30a14-0.ic80", 0x00001, 0x40000, CRC(f42fe016) SHA1(11511aa43caa12b36a795bfaefee824821282523) )
751   ROM_LOAD16_BYTE( "30a15-0.ic79", 0x00000, 0x20000, CRC(ad50e92c) SHA1(facac5bbe11716d076a40eacbb67f7caab7a4a27) )
752
753   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
754   ROM_LOAD( "30a13-0.ic43",   0x00000, 0x10000, CRC(1e974d9b) SHA1(8e54ff747efe587a2e971c15e729445c4e232f0f) )
755
756   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
757   ROM_LOAD( "14.ic45",   0x000000, 0x20000, CRC(b036a27b) SHA1(c13589c3882bb86f14a3b0143f2d9a4474350ddd) )
758   ROM_LOAD( "15.ic46",   0x020000, 0x20000, CRC(24d0bf41) SHA1(2e9c26c8078d17323af6ba378c7ceaed9045d3f7) )
759   ROM_LOAD( "30.ic13",   0x040000, 0x20000, CRC(72fe2b16) SHA1(92f02381c0216cf5cfede6813e4dcb814a040091) )
760   ROM_LOAD( "31.ic14",   0x060000, 0x20000, CRC(ab48a0c8) SHA1(b908f601a621697ad3b5067d26b6fb1713c4af39) )
761   ROM_LOAD( "23.ic29",   0x080000, 0x20000, CRC(0768fedd) SHA1(757c4378f53b4b8cc024b4c5a74d19ab653e886e) )
762   ROM_LOAD( "24.ic30",   0x0a0000, 0x20000, CRC(ec9db18a) SHA1(7e4085ba4c0e20ec00f392a2bf9cdb81be53b97f) )
763   ROM_LOAD( "21.ic25",   0x0c0000, 0x20000, CRC(902744b9) SHA1(eea623ce013bc270b1611982dd2f9388b205dbb3) )
764   ROM_LOAD( "22.ic26",   0x0e0000, 0x20000, CRC(5b142d4d) SHA1(88e22e102efa35449c0d9f6139eb0718528a9d72) )
765
766   ROM_REGION( 0x480000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
767   ROM_LOAD( "9.ic39",    0x000000, 0x20000, CRC(726c49b7) SHA1(dbafad47bb6b717c409fdc5d81c413f1282f2bbb) )
768   ROM_LOAD( "10.ic40",   0x020000, 0x20000, CRC(37a1c335) SHA1(de70ba51788b601591c3aff71cb94aae349b272d) )
769   ROM_LOAD( "11.ic41",   0x040000, 0x20000, CRC(2bcfe63c) SHA1(678ef0e7cc38e4df1e1d1e3f5cba6601aa520ec6) )
770   ROM_LOAD( "12.ic42",   0x060000, 0x20000, CRC(b864cf17) SHA1(39a5155f40ba500bf201acca6f7d230cb0ea8309) )
771   ROM_COPY( "gfx2",  0x400000, 0x080000, 0x10000 )
772   ROM_LOAD( "4.ic33",    0x100000, 0x20000, CRC(8c71eb06) SHA1(e47acf9e2d5eeec0cff9654210a43c690a45d447) )
773   ROM_LOAD( "5.ic34",    0x120000, 0x20000, CRC(3e134be9) SHA1(0a75b56353bed2743f7ce8f3f74379fc9f0d3cb9) )
774   ROM_LOAD( "6.ic35",    0x140000, 0x20000, CRC(b4115ef0) SHA1(d90943f75051c7590a0effcc30fa813890c9ad11) )
775   ROM_LOAD( "7.ic36",    0x160000, 0x20000, CRC(4639333d) SHA1(8e3c982d6fa38cbec42e8de780f165547b5b0271) )
776   ROM_COPY( "gfx2",  0x420000, 0x180000, 0x10000 )
777   ROM_LOAD( "16.ic19",   0x200000, 0x20000, CRC(04420cc8) SHA1(ed148c52374bbd0d29c12070ea1499333fc04449) )
778   ROM_LOAD( "17.ic20",   0x220000, 0x20000, CRC(33f97b2f) SHA1(40dc5357caa17ed6673588422332966ee97752b7) )
779   ROM_LOAD( "18.ic21",   0x240000, 0x20000, CRC(0f9a8f2a) SHA1(d7e46d32067d3f8b3bacbf96ea313645a9a48410) )
780   ROM_LOAD( "19.ic22",   0x260000, 0x20000, CRC(15c91772) SHA1(8578b6c501e3af64863bd6b28ef59c6884dfe028) )
781   ROM_COPY( "gfx2",  0x440000, 0x280000, 0x10000 )
782   ROM_LOAD( "25.ic3",    0x300000, 0x20000, CRC(894734b3) SHA1(46fa174a303e85f439254976252835626c4b2ddc) )
783   ROM_LOAD( "26.ic4",    0x320000, 0x20000, CRC(cd504584) SHA1(674481b524853dbfcb7d173d58250b1be8464313) )
784   ROM_LOAD( "27.ic5",    0x340000, 0x20000, CRC(38e8a9ad) SHA1(1c66acde8f72fa7c6415a7aadc2dbf4300446c88) )
785   ROM_LOAD( "28.ic6",    0x360000, 0x20000, CRC(80c1cb74) SHA1(5558fa36b238cff1bee9df921e77d7de2062bf15) )
786   ROM_COPY( "gfx2",  0x460000, 0x380000, 0x10000 )
787
788   /* These ROMs are 128kB but only the lower 64kB is addressed */
789   ROM_LOAD( "30a12-0.ic43",  0x400000, 0x20000, CRC(91da004c) SHA1(d61c8545e622de6872ce1f1487dd0342fd81572c) )
790   ROM_LOAD( "30a11-0.ic37",  0x420000, 0x20000, CRC(5f419232) SHA1(86a883d7f0dfdfcc34c90e54f0b65b23b5822c16) )
791   ROM_LOAD( "30a10-0.ic23",  0x440000, 0x20000, CRC(12f641ba) SHA1(1e197a584bcc0b2f3b97e1a8ec61864b279ab951) )
792   ROM_LOAD( "30a9-0.ic7",    0x460000, 0x20000, CRC(9199a77b) SHA1(35b9a2a707ffd7dd2cfc2bea0c78f02f3639d1bd) )
793
794   ROM_REGION( 0x080000, "oki", 0 )   /* ADPCM Samples */
795   ROM_LOAD( "2.ic73",   0x000000, 0x40000, CRC(3af21dbe) SHA1(295d0b7f33c55ef37a71382a22edd8fc97fa5353) )
796   ROM_LOAD( "3.ic74",   0x040000, 0x40000, CRC(c28b53cd) SHA1(93d29669ec899fd5852f61b1d91d0a90cc30e192) )
797
798   ROM_REGION( 0x0100, "proms", 0 )
799   ROM_LOAD( "30.ic38", 0x000000, 0x00100, CRC(113c7443) SHA1(7b0b13e9f0c219f6d436aeec06494734d1f4a599) )
800ROM_END
801
620802ROM_START( ddrago3b )
621803   ROM_REGION( 0x80000, "main", 0 )   /* 64k for cpu code */
622804   ROM_LOAD16_BYTE( "dd3.01",   0x00001, 0x20000, CRC(68321d8b) SHA1(bd34d361e8ef18ef2b7e8bfe438b1b098c3151b5) )
r3957r3958
627809   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
628810   ROM_LOAD( "dd3.06",    0x00000, 0x10000, CRC(1e974d9b) SHA1(8e54ff747efe587a2e971c15e729445c4e232f0f) )
629811
630   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
631   /* Background */
812   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
632813   ROM_LOAD( "dd3.f",   0x000000, 0x40000, CRC(89d58d32) SHA1(54cfc154024e014f537c7ae0c2275ece50413bc5) )
633814   ROM_LOAD( "dd3.e",   0x040000, 0x40000, CRC(9bf1538e) SHA1(c7cb96c6b1ac73ec52f46b2a6687bfcfd375ab44) )
634815   ROM_LOAD( "dd3.b",   0x080000, 0x40000, CRC(8f671a62) SHA1(b5dba61ad6ed39440bb98f7b2dc1111779d6c4a1) )
635816   ROM_LOAD( "dd3.a",   0x0c0000, 0x40000, CRC(0f74ea1c) SHA1(6bd8dd89bd22b29038cf502a898336e95e50a9cc) )
636817
637   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )
638   /* sprites  */
818   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
639819   ROM_LOAD( "dd3.3e",   0x000000, 0x20000, CRC(726c49b7) SHA1(dbafad47bb6b717c409fdc5d81c413f1282f2bbb) ) //4a
640820   ROM_LOAD( "dd3.3d",   0x020000, 0x20000, CRC(37a1c335) SHA1(de70ba51788b601591c3aff71cb94aae349b272d) ) //3a
641821   ROM_LOAD( "dd3.3c",   0x040000, 0x20000, CRC(2bcfe63c) SHA1(678ef0e7cc38e4df1e1d1e3f5cba6601aa520ec6) ) //2a
r3957r3958
678858   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
679859   ROM_LOAD( "28a10-0.ic89", 0x00000, 0x8000, CRC(4346de13) SHA1(67c6de90ba31a325f03e64d28c9391a315ee359c) )
680860
681   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
682   ROM_LOAD( "28j7-0.ic11",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )    /* Background */
861   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
862   ROM_LOAD( "28j7-0.ic11",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )
683863   ROM_LOAD( "28j6-0.ic13",  0x040000, 0x40000, CRC(617530fc) SHA1(b9155ed0ae1437bf4d0b7a95e769bc05a820ecec) )
684864   ROM_LOAD( "28j5-0.ic12",  0x080000, 0x40000, CRC(cef0a821) SHA1(c7a35048d5ebf3f09abf9d27f91d12adc03befeb) )
685865   ROM_LOAD( "28j4-0.ic14",  0x0c0000, 0x40000, CRC(b84fda09) SHA1(3ae0c0ec6c398dea17e248b017ea3e2f6c3571e1) )
686866
687   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )
688   ROM_LOAD( "28j3-0.ic77",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )    /* Sprites */
867   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
868   ROM_LOAD( "28j3-0.ic77",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )
689869   ROM_LOAD( "28a14-0.ic60", 0x080000, 0x10000, CRC(972faddb) SHA1(f2b211e8f8301667e6c9a3ce9612e39b16e66a67) )
690870   ROM_LOAD( "28j2-0.ic78",  0x100000, 0x80000, CRC(8c796707) SHA1(7417ad0413083876ed65a8612845ccb0d2717530) )
691871   ROM_LOAD( "28a13-0.ic61", 0x180000, 0x10000, CRC(eb3ab374) SHA1(db66cb7976c111fa76a3a211e96ad1d7b78ce0ad) )
r3957r3958
712892   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
713893   ROM_LOAD( "28a10-0.ic89", 0x00000, 0x8000, CRC(4346de13) SHA1(67c6de90ba31a325f03e64d28c9391a315ee359c) )
714894
715   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
716   ROM_LOAD( "28j7-0.ic11",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )    /* Background */
895   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
896   ROM_LOAD( "28j7-0.ic11",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )
717897   ROM_LOAD( "28j6-0.ic13",  0x040000, 0x40000, CRC(617530fc) SHA1(b9155ed0ae1437bf4d0b7a95e769bc05a820ecec) )
718898   ROM_LOAD( "28j5-0.ic12",  0x080000, 0x40000, CRC(cef0a821) SHA1(c7a35048d5ebf3f09abf9d27f91d12adc03befeb) )
719899   ROM_LOAD( "28j4-0.ic14",  0x0c0000, 0x40000, CRC(b84fda09) SHA1(3ae0c0ec6c398dea17e248b017ea3e2f6c3571e1) )
720900
721   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )
722   ROM_LOAD( "28j3-0.ic77",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )    /* Sprites */
901   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
902   ROM_LOAD( "28j3-0.ic77",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )
723903   ROM_LOAD( "28a14-0.ic60", 0x080000, 0x10000, CRC(972faddb) SHA1(f2b211e8f8301667e6c9a3ce9612e39b16e66a67) )
724904   ROM_LOAD( "28j2-0.ic78",  0x100000, 0x80000, CRC(8c796707) SHA1(7417ad0413083876ed65a8612845ccb0d2717530) )
725905   ROM_LOAD( "28a13-0.ic61", 0x180000, 0x10000, CRC(eb3ab374) SHA1(db66cb7976c111fa76a3a211e96ad1d7b78ce0ad) )
r3957r3958
746926   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
747927   ROM_LOAD( "ct_ep4.rom",   0x00000, 0x8000, CRC(4346de13) SHA1(67c6de90ba31a325f03e64d28c9391a315ee359c) )
748928
749   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
750   ROM_LOAD( "ct_mr7.rom",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )    /* Background */
929   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
930   ROM_LOAD( "ct_mr7.rom",  0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )
751931   ROM_LOAD( "ct_mr6.rom",  0x040000, 0x40000, CRC(617530fc) SHA1(b9155ed0ae1437bf4d0b7a95e769bc05a820ecec) )
752932   ROM_LOAD( "ct_mr5.rom",  0x080000, 0x40000, CRC(cef0a821) SHA1(c7a35048d5ebf3f09abf9d27f91d12adc03befeb) )
753933   ROM_LOAD( "ct_mr4.rom",  0x0c0000, 0x40000, CRC(b84fda09) SHA1(3ae0c0ec6c398dea17e248b017ea3e2f6c3571e1) )
754934
755   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )
756   ROM_LOAD( "ct_mr3.rom",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )    /* Sprites */
935   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
936   ROM_LOAD( "ct_mr3.rom",  0x000000, 0x80000, CRC(1ac2a461) SHA1(17436f5dcf29041ca5f470dfae538e4fc12153cc) )
757937   ROM_LOAD( "ct_ep5.rom",  0x080000, 0x10000, CRC(972faddb) SHA1(f2b211e8f8301667e6c9a3ce9612e39b16e66a67) )
758938   ROM_LOAD( "ct_mr2.rom",  0x100000, 0x80000, CRC(8c796707) SHA1(7417ad0413083876ed65a8612845ccb0d2717530) )
759939   ROM_LOAD( "ct_ep6.rom",  0x180000, 0x10000, CRC(eb3ab374) SHA1(db66cb7976c111fa76a3a211e96ad1d7b78ce0ad) )
r3957r3958
777957   ROM_REGION( 0x10000, "audio", 0 )   /* 64k for sound cpu code */
778958   ROM_LOAD( "6.bin",   0x00000, 0x10000, CRC(0101df2d) SHA1(35e1efa4a11c0f9d9db5ee057926e5de29c3a4c1) )
779959
780   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )
781   ROM_LOAD( "7.bin",   0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )    /* Background */
960   ROM_REGION( 0x200000, "gfx1", ROMREGION_DISPOSE )   /* Background */
961   ROM_LOAD( "7.bin",   0x000000, 0x40000, CRC(a8b773f1) SHA1(999e41dfeb3fb937da769c4a33bb29bf4076dc63) )
782962   ROM_LOAD( "8.bin",   0x040000, 0x40000, CRC(617530fc) SHA1(b9155ed0ae1437bf4d0b7a95e769bc05a820ecec) )
783963   ROM_LOAD( "11.bin",  0x080000, 0x40000, CRC(cef0a821) SHA1(c7a35048d5ebf3f09abf9d27f91d12adc03befeb) )
784964   ROM_LOAD( "12.bin",  0x0c0000, 0x40000, CRC(b84fda09) SHA1(3ae0c0ec6c398dea17e248b017ea3e2f6c3571e1) )
r3957r3958
787967   ROM_LOAD( "13.bin",  0x180000, 0x20000, CRC(59e01fe1) SHA1(67f5a4e9c9e9ebc6218b7c2ede0e5ff51682ee2f) )
788968   ROM_LOAD( "14.bin",  0x1c0000, 0x20000, CRC(a69ab4f3) SHA1(bc99c6a587c972cb5c9e719c53ef921a28f1498e) )
789969
790   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )
791   ROM_LOAD( "34.bin",  0x000000, 0x20000, CRC(5b498f0e) SHA1(9d93ca1f44e1f04eb3b66db6027130683c9431a2) )    /* Sprites */
970   ROM_REGION( 0x400000, "gfx2", ROMREGION_DISPOSE )   /* Sprites */
971   ROM_LOAD( "34.bin",  0x000000, 0x20000, CRC(5b498f0e) SHA1(9d93ca1f44e1f04eb3b66db6027130683c9431a2) )
792972   ROM_LOAD( "33.bin",  0x020000, 0x20000, CRC(14d79049) SHA1(250c87aa238fc794cd0f07e3388b97137cc1228f) )
793973   ROM_LOAD( "32.bin",  0x040000, 0x20000, CRC(9631ea23) SHA1(de0a6595731d185ea18959bd04e3ac9e4261a8f8) )
794974   ROM_LOAD( "31.bin",  0x060000, 0x20000, CRC(0ca8d3b9) SHA1(c48e7c456acb9deb7f01c19ab9a66360af09a13d) )
r3957r3958
8211001 *************************************/
8221002
8231003GAME( 1990, ddragon3, 0,        ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (US)", GAME_SUPPORTS_SAVE )
824GAME( 1990, ddrago3j, ddragon3,   ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (Japan)", GAME_SUPPORTS_SAVE )
1004GAME( 1990, ddrago3j, ddragon3, ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (Japan)", GAME_SUPPORTS_SAVE )
1005GAME( 1990, ddrago3p, ddragon3, ddragon3, ddragon3, 0, ROT0, "Technos", "Double Dragon 3 - The Rosetta Stone (prototype)", GAME_SUPPORTS_SAVE )
8251006GAME( 1990, ddrago3b, ddragon3, ddrago3b, ddrago3b, 0, ROT0, "bootleg", "Double Dragon 3 - The Rosetta Stone (bootleg)", GAME_SUPPORTS_SAVE )
8261007GAME( 1990, ctribe,   0,        ctribe,   ctribe,   0, ROT0, "Technos", "The Combatribes (US)", GAME_SUPPORTS_SAVE )
8271008GAME( 1990, ctribe1,  ctribe,   ctribe,   ctribe,   0, ROT0, "Technos", "The Combatribes (US Set 1?)", GAME_SUPPORTS_SAVE )
src/mame/drivers/sprint2.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/m6502/m6502.h"
2122#include "sprint2.h"
2223#include "sound/discrete.h"
2324
src/mame/drivers/exterm.c
r3957r3958
489489   MDRV_CPU_ADD("audioslave", M6502, 2000000)
490490   MDRV_CPU_PROGRAM_MAP(sound_slave_map,0)
491491
492   MDRV_INTERLEAVE(100)
492   MDRV_QUANTUM_TIME(HZ(6000))
493493
494494   MDRV_MACHINE_RESET(exterm)
495495   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/dragrace.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89#include "deprecat.h"
910#include "dragrace.h"
1011#include "sound/discrete.h"
src/mame/drivers/discoboy.c
r3957r3958
3636
3737
3838#include "driver.h"
39#include "cpu/z80/z80.h"
3940#include "deprecat.h"
4041#include "sound/msm5205.h"
4142#include "sound/3812intf.h"
src/mame/drivers/mediagx.c
r3957r3958
6464*/
6565
6666#include "driver.h"
67#include "cpu/i386/i386.h"
6768#include "devconv.h"
68#include "deprecat.h"
6969#include "machine/8237dma.h"
7070#include "machine/pic8259.h"
7171#include "machine/pit8253.h"
r3957r3958
7575#include "machine/8042kbdc.h"
7676#include "machine/pckeybrd.h"
7777#include "machine/idectrl.h"
78#include "cpu/i386/i386.h"
7978#include "sound/dmadac.h"
8079
8180#define SPEEDUP_HACKS   1
r3957r3958
792791
793792static const struct dma8237_interface dma8237_1_config =
794793{
795   0,
794   "main",
796795   1.0e-6, // 1us
797796
798797   pc_dma_read_byte,
r3957r3958
806805
807806static const struct dma8237_interface dma8237_2_config =
808807{
809   0,
808   "main",
810809   1.0e-6, // 1us
811810
812811   NULL,
r3957r3958
957956   cpu_set_irq_callback(machine->cpu[0], irq_callback);
958957
959958   memcpy(bios_ram, rom, 0x40000);
960   cpu_reset(machine->cpu[0]);
959   device_reset(machine->cpu[0]);
961960
962961   dacl = auto_malloc(65536 * sizeof(INT16));
963962   dacr = auto_malloc(65536 * sizeof(INT16));
r3957r3958
10741073   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.0)
10751074MACHINE_DRIVER_END
10761075
1077static void set_gate_a20(int a20)
1076static void set_gate_a20(running_machine *machine, int a20)
10781077{
1079   cpu_set_input_line(Machine->cpu[0], INPUT_LINE_A20, a20);
1078   cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20);
10801079}
10811080
1082static void keyboard_interrupt(int state)
1081static void keyboard_interrupt(running_machine *machine, int state)
10831082{
10841083   pic8259_set_irq_line(mediagx_devices.pic8259_1, 1, state);
10851084}
r3957r3958
10981097   KBDC8042_AT386, set_gate_a20, keyboard_interrupt, mediagx_get_out2
10991098};
11001099
1101static void mediagx_set_keyb_int(int state) {
1100static void mediagx_set_keyb_int(running_machine *machine, int state) {
11021101   pic8259_set_irq_line(mediagx_devices.pic8259_1, 1, state);
11031102}
11041103
src/mame/drivers/ambush.c
r3957r3958
3434***************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/z80/z80.h"
3738#include "sound/ay8910.h"
3839
3940
r3957r3958
5253
5354static WRITE8_HANDLER( flip_screen_w )
5455{
55   flip_screen_set(data);
56   flip_screen_set(space->machine, data);
5657}
5758
5859
src/mame/drivers/orbit.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/m6800/m6800.h"
2122#include "orbit.h"
2223#include "sound/discrete.h"
2324
src/mame/drivers/seibuspi.c
r3957r3958
669669*/
670670
671671#include "driver.h"
672#include "cpu/z80/z80.h"
673#include "cpu/i386/i386.h"
672674#include "machine/ds2404.h"
673675#include "machine/eeprom.h"
674676#include "machine/intelfsh.h"
r3957r3958
17371739static MACHINE_DRIVER_START( spi )
17381740
17391741   /* basic machine hardware */
1740   MDRV_CPU_ADD("main",I386, 50000000/2)   /* Intel 386DX, 25MHz */
1742   MDRV_CPU_ADD("main", I386, 50000000/2)   /* Intel 386DX, 25MHz */
17411743   MDRV_CPU_PROGRAM_MAP(spi_map, 0)
17421744   MDRV_CPU_VBLANK_INT("main", spi_interrupt)
17431745
17441746   MDRV_CPU_ADD("sound", Z80, 28636360/4)
17451747   MDRV_CPU_PROGRAM_MAP(spisound_map, 0)
17461748
1747   MDRV_INTERLEAVE(200)
1749   MDRV_QUANTUM_TIME(HZ(12000))
17481750
17491751   MDRV_MACHINE_RESET(spi)
17501752   MDRV_NVRAM_HANDLER(spi)
src/mame/drivers/coolpool.c
r3957r3958
2525***************************************************************************/
2626
2727#include "driver.h"
28#include "cpu/tms32010/tms32010.h"
2829#include "cpu/tms34010/tms34010.h"
2930#include "cpu/tms32025/tms32025.h"
3031#include "video/tlc34076.h"
src/mame/drivers/mwarr.c
r3957r3958
3939*/
4040
4141#include "driver.h"
42#include "cpu/m68000/m68000.h"
4243#include "sound/okim6295.h"
4344
4445static tilemap *bg_tilemap, *mlow_tilemap, *mhigh_tilemap, *tx_tilemap;
src/mame/drivers/sauro.c
r3957r3958
127127
128128static WRITE8_HANDLER( flip_screen_w )
129129{
130   flip_screen_set(data);
130   flip_screen_set(space->machine, data);
131131}
132132
133133static WRITE8_HANDLER( adpcm_w )
r3957r3958
135135   sp0256_ALD_w(space, 0, data);
136136}
137137
138static void lrq_callback(int state)
138static void lrq_callback(const device_config *device, int state)
139139{
140   //cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
141   cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, state);
140   //cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
141   cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, state);
142142}
143143
144144static ADDRESS_MAP_START( sauro_readmem, ADDRESS_SPACE_PROGRAM, 8 )
src/mame/drivers/gaplus.c
r3957r3958
150150***************************************************************************/
151151
152152#include "driver.h"
153#include "cpu/m6809/m6809.h"
153154#include "machine/namcoio.h"
154155#include "sound/namco.h"
155156#include "sound/samples.h"
r3957r3958
255256static WRITE8_HANDLER( gaplus_irq_1_ctrl_w )
256257{
257258   int bit = !BIT(offset,11);
258   cpu_interrupt_enable(0,bit);
259   cpu_interrupt_enable(space->machine->cpu[0],bit);
259260   if (!bit)
260261      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
261262}
r3957r3958
263264static WRITE8_HANDLER( gaplus_irq_3_ctrl_w )
264265{
265266   int bit = !BIT(offset,13);
266   cpu_interrupt_enable(2,bit);
267   cpu_interrupt_enable(space->machine->cpu[2],bit);
267268   if (!bit)
268269      cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE);
269270}
r3957r3958
271272static WRITE8_HANDLER( gaplus_irq_2_ctrl_w )
272273{
273274   int bit = offset & 1;
274   cpu_interrupt_enable(1,bit);
275   cpu_interrupt_enable(space->machine->cpu[1],bit);
275276   if (!bit)
276277      cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
277278}
r3957r3958
295296static MACHINE_RESET( gaplus )
296297{
297298   /* on reset, VINTON is reset, while the other flags don't seem to be affected */
298   cpu_interrupt_enable(1,0);
299   cpu_interrupt_enable(machine->cpu[1],0);
299300   cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
300301}
301302
r3957r3958
552553   MDRV_CPU_PROGRAM_MAP(readmem_cpu3,writemem_cpu3)
553554   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
554555
555   MDRV_INTERLEAVE(100)   /* a high value to ensure proper synchronization of the CPUs */
556   MDRV_QUANTUM_TIME(HZ(6000))   /* a high value to ensure proper synchronization of the CPUs */
556557   MDRV_MACHINE_RESET(gaplus)
557558
558559   /* video hardware */
src/mame/drivers/carpolo.c
r3957r3958
1717****************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/m6502/m6502.h"
2021#include "machine/6821pia.h"
2122#include "carpolo.h"
2223
src/mame/drivers/drmicro.c
r3957r3958
99*****************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "sound/msm5205.h"
1314#include "sound/sn76496.h"
1415
r3957r3958
2324
2425WRITE8_HANDLER( drmicro_videoram_w );
2526
26extern void drmicro_flip_w( int flip );
27extern void drmicro_flip_w( running_machine *machine, int flip );
2728
2829/****************************************************************************/
2930
r3957r3958
3839static WRITE8_HANDLER( nmi_enable_w )
3940{   // bit2,3 unknown
4041   drmicro_nmi_enable = data & 1;
41   drmicro_flip_w(data & 2);
42   drmicro_flip_w(space->machine, data & 2);
4243}
4344
4445/****************************************************************************/
r3957r3958
224225   MDRV_CPU_IO_MAP(io_map,0)
225226   MDRV_CPU_VBLANK_INT("main", drmicro_interrupt)
226227
227   MDRV_INTERLEAVE(1)
228   MDRV_QUANTUM_TIME(HZ(60))
228229
229230   /* video hardware */
230231   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/speedatk.c
r3957r3958
7575*****************************************************************************************/
7676
7777#include "driver.h"
78#include "cpu/z80/z80.h"
7879#include "sound/ay8910.h"
7980
8081static UINT8 mux_data;
src/mame/drivers/vroulet.c
r3957r3958
3535*/
3636
3737#include "driver.h"
38#include "cpu/z80/z80.h"
3839#include "machine/8255ppi.h"
3940#include "sound/ay8910.h"
4041
src/mame/drivers/twins.c
r3957r3958
4949*/
5050
5151#include "driver.h"
52#include "cpu/nec/nec.h"
5253#include "sound/ay8910.h"
5354
5455static UINT16 *twins_videoram;
src/mame/drivers/tetriunk.c
r3957r3958
99*/
1010
1111#include "driver.h"
12#include "cpu/i86/i86.h"
1213
1314static int crtindex;
1415static int crtdata[256];
src/mame/drivers/cultures.c
r3957r3958
99*/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "sound/okim6295.h"
1314
1415#define MCLK 16000000
src/mame/drivers/powerins.c
r3957r3958
2525***************************************************************************/
2626
2727#include "driver.h"
28#include "cpu/z80/z80.h"
29#include "cpu/m68000/m68000.h"
2830#include "machine/nmk112.h"
2931#include "sound/okim6295.h"
3032#include "sound/2203intf.h"
src/mame/drivers/niyanpai.c
r3957r3958
3333******************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
37#include "cpu/m68000/m68000.h"
3638#include "machine/m68kfmly.h"
3739#include "machine/z80ctc.h"
3840#include "nb1413m3.h"
r3957r3958
172174
173175static z80ctc_interface ctc_intf =
174176{
175   "audio",         /* clock from the audio CPU */
176   0,               /* clock */
177177   0,               /* timer disables */
178178   ctc0_interrupt,      /* interrupt handler */
179179   z80ctc_trg3_w,      /* ZC/TO0 callback ctc1.zc0 -> ctc1.trg3 */
r3957r3958
859859   MDRV_CPU_PROGRAM_MAP(sound_readmem, sound_writemem)
860860   MDRV_CPU_IO_MAP(sound_io_map,0)
861861
862   MDRV_Z80CTC_ADD("ctc", ctc_intf)
862   MDRV_Z80CTC_ADD("ctc", 8000000/1 /* same as "audio" */, ctc_intf)
863863
864864   MDRV_MACHINE_RESET(niyanpai)
865865   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/exedexes.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/z80/z80.h"
1314#include "deprecat.h"
1415#include "sound/ay8910.h"
1516#include "sound/sn76496.h"
src/mame/drivers/jedi.c
r3957r3958
349349   MDRV_CPU_ADD("main", M6502, JEDI_MAIN_CPU_CLOCK)
350350   MDRV_CPU_PROGRAM_MAP(main_map,0)
351351
352   MDRV_INTERLEAVE(4)
352   MDRV_QUANTUM_TIME(HZ(240))
353353
354354   MDRV_MACHINE_START(jedi)
355355   MDRV_MACHINE_RESET(jedi)
src/mame/drivers/bfm_sc2.c
r3957r3958
22202220
22212221static MACHINE_DRIVER_START( scorpion2_vid )
22222222   MDRV_MACHINE_RESET( init )                     // main scorpion2 board initialisation
2223   MDRV_INTERLEAVE(16)                           // needed for serial communication !!
2223   MDRV_QUANTUM_TIME(HZ(960))                           // needed for serial communication !!
22242224   MDRV_CPU_ADD("main", M6809, MASTER_CLOCK/4 )   // 6809 CPU at 2 Mhz
22252225   MDRV_CPU_PROGRAM_MAP(memmap_vid,0)               // setup scorpion2 board memorymap
22262226   MDRV_CPU_PERIODIC_INT(timer_irq, 1000)            // generate 1000 IRQ's per second
src/mame/drivers/suprnova.c
r3957r3958
10171017static void init_skns(running_machine *machine)
10181018{
10191019   // init DRC to fastest options
1020   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1020   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
10211021
1022   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1023   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6f8);
1022   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1023   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6f8);
10241024   memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x6000028, 0x600002b, 0, 0, bios_skip_r );
10251025}
10261026
10271027static void set_drc_pcflush(running_machine *machine, UINT32 addr)
10281028{
1029   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1030   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, addr);
1029   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1030   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, addr);
10311031}
10321032
10331033static DRIVER_INIT( galpani4 ) { skns_sprite_kludge(-5,-1); init_skns(machine);  }
src/mame/drivers/seta2.c
r3957r3958
407407***************************************************************************/
408408
409409#include "driver.h"
410#include "cpu/m68000/m68000.h"
410411#include "deprecat.h"
411412#include "machine/tmp68301.h"
412413#include "machine/eeprom.h"
src/mame/drivers/witch.c
r3957r3958
190190*/
191191
192192#include "driver.h"
193#include "cpu/z80/z80.h"
193194#include "sound/es8712.h"
194195#include "sound/2203intf.h"
195196
src/mame/drivers/flkatck.c
r3957r3958
290290   MDRV_CPU_ADD("audio", Z80,3579545)   /* NEC D780C-1, 3.579545 MHz */
291291   MDRV_CPU_PROGRAM_MAP(flkatck_readmem_sound,flkatck_writemem_sound)
292292
293   MDRV_INTERLEAVE(10)
293   MDRV_QUANTUM_TIME(HZ(600))
294294
295295   MDRV_MACHINE_RESET(flkatck)
296296
src/mame/drivers/dynax.c
r3957r3958
7171*********************************************************************************************************************/
7272
7373#include "driver.h"
74#include "cpu/z80/z80.h"
7475#include "deprecat.h"
7576#include "includes/dynax.h"
7677#include "cpu/tlcs90/tlcs90.h"
r3957r3958
38643865   MDRV_SCREEN_VISIBLE_AREA(0, 336-1, 8, 256-1-8-1)
38653866
38663867   /* devices */
3867   MDRV_DEVICE_ADD("rtc", MSM6242)
3868   MDRV_MSM6242_ADD("rtc")
38683869MACHINE_DRIVER_END
38693870
38703871
r3957r3958
39753976   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
39763977
39773978   /* devices */
3978   MDRV_DEVICE_ADD("rtc", MSM6242)
3979   MDRV_MSM6242_ADD("rtc")
39793980MACHINE_DRIVER_END
39803981
39813982
r3957r3958
41224123   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41234124
41244125   /* devices */
4125   MDRV_DEVICE_ADD("rtc", MSM6242)
4126   MDRV_MSM6242_ADD("rtc")
41264127MACHINE_DRIVER_END
41274128
41284129
r3957r3958
41834184   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
41844185
41854186   /* devices */
4186   MDRV_DEVICE_ADD("rtc", MSM6242)
4187   MDRV_MSM6242_ADD("rtc")
41874188MACHINE_DRIVER_END
41884189
41894190static MACHINE_DRIVER_START( majrjhdx )
src/mame/drivers/shootout.c
r3957r3958
6666
6767static WRITE8_HANDLER( shootout_flipscreen_w )
6868{
69   flip_screen_set(data & 0x01);
69   flip_screen_set(space->machine, data & 0x01);
7070}
7171
7272static WRITE8_HANDLER( shootout_coin_counter_w )
src/mame/drivers/contra.c
r3957r3958
256256    MDRV_CPU_ADD("audio", M6809, 2000000)
257257   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
258258
259   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
259   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
260260
261261   /* video hardware */
262262   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/zn.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/m68000/m68000.h"
1213#include "deprecat.h"
1314#include "cpu/mips/psx.h"
1415#include "cpu/z80/z80.h"
r3957r3958
190191   return m_n_znsecsel;
191192}
192193
193static void sio_znsec0_handler( int n_data )
194static void sio_znsec0_handler( running_machine *machine, int n_data )
194195{
195196   if( ( n_data & PSX_SIO_OUT_CLOCK ) == 0 )
196197   {
197198      if( m_b_lastclock )
198199      {
199         psx_sio_input( Machine, 0, PSX_SIO_IN_DATA, ( znsec_step( 0, ( n_data & PSX_SIO_OUT_DATA ) != 0 ) != 0 ) * PSX_SIO_IN_DATA );
200         psx_sio_input( machine, 0, PSX_SIO_IN_DATA, ( znsec_step( 0, ( n_data & PSX_SIO_OUT_DATA ) != 0 ) != 0 ) * PSX_SIO_IN_DATA );
200201      }
201202      m_b_lastclock = 0;
202203   }
r3957r3958
206207   }
207208}
208209
209static void sio_znsec1_handler( int n_data )
210static void sio_znsec1_handler( running_machine *machine, int n_data )
210211{
211212   if( ( n_data & PSX_SIO_OUT_CLOCK ) == 0 )
212213   {
213214      if( m_b_lastclock )
214215      {
215         psx_sio_input( Machine, 0, PSX_SIO_IN_DATA, ( znsec_step( 1, ( n_data & PSX_SIO_OUT_DATA ) != 0 ) != 0 ) * PSX_SIO_IN_DATA );
216         psx_sio_input( machine, 0, PSX_SIO_IN_DATA, ( znsec_step( 1, ( n_data & PSX_SIO_OUT_DATA ) != 0 ) != 0 ) * PSX_SIO_IN_DATA );
216217      }
217218      m_b_lastclock = 0;
218219   }
r3957r3958
222223   }
223224}
224225
225static void sio_pad_handler( int n_data )
226static void sio_pad_handler( running_machine *machine, int n_data )
226227{
227   running_machine *machine = Machine;
228
229228   if( ( n_data & PSX_SIO_OUT_DTR ) != 0 )
230229   {
231230      m_b_znsecport = 1;
r3957r3958
239238   psx_sio_input( machine, 0, PSX_SIO_IN_DATA | PSX_SIO_IN_DSR, PSX_SIO_IN_DATA | PSX_SIO_IN_DSR );
240239}
241240
242static void sio_dip_handler( int n_data )
241static void sio_dip_handler( running_machine *machine, int n_data )
243242{
244243   if( ( n_data & PSX_SIO_OUT_CLOCK ) == 0 )
245244   {
246245      if( m_b_lastclock )
247246      {
248         running_machine *machine = Machine;
249247         int bit = ( ( input_port_read(machine, "DSW") >> m_n_dip_bit ) & 1 );
250248         verboselog( machine, 2, "read dip %02x -> %02x\n", n_data, bit * PSX_SIO_IN_DATA );
251249         psx_sio_input( machine, 0, PSX_SIO_IN_DATA, bit * PSX_SIO_IN_DATA );
r3957r3958
439437   psx_machine_init(machine);
440438}
441439
442static const at28c16_config at28c16_intf =
443{
444   "at28c16", NULL
445};
446
447440static MACHINE_DRIVER_START( zn1_1mb_vram )
448441   /* basic machine hardware */
449442   MDRV_CPU_ADD( "main", PSXCPU, XTAL_67_7376MHz )
r3957r3958
472465   MDRV_SOUND_ROUTE(0, "left", 0.35)
473466   MDRV_SOUND_ROUTE(1, "right", 0.35)
474467
475   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
476   MDRV_DEVICE_CONFIG( at28c16_intf )
468   MDRV_AT28C16_ADD( "at28c16", NULL )
477469MACHINE_DRIVER_END
478470
479471static MACHINE_DRIVER_START( zn1_2mb_vram )
r3957r3958
511503   MDRV_SOUND_ROUTE(0, "left", 0.35)
512504   MDRV_SOUND_ROUTE(1, "right", 0.35)
513505
514   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
515   MDRV_DEVICE_CONFIG( at28c16_intf )
506   MDRV_AT28C16_ADD( "at28c16", NULL )
516507MACHINE_DRIVER_END
517508
518509/*
r3957r3958
15991590   }
16001591}
16011592
1602static void atpsx_dma_read( UINT32 n_address, INT32 n_size )
1593static void atpsx_dma_read( running_machine *machine, UINT32 n_address, INT32 n_size )
16031594{
1604   const device_config *ide = device_list_find_by_tag(Machine->config->devicelist, IDE_CONTROLLER, "ide");
1595   const device_config *ide = device_list_find_by_tag(machine->config->devicelist, IDE_CONTROLLER, "ide");
16051596
16061597   logerror("DMA read: %d bytes (%d words) to %08x\n", n_size<<2, n_size, n_address);
16071598
r3957r3958
16221613   }
16231614}
16241615
1625static void atpsx_dma_write( UINT32 n_address, INT32 n_size )
1616static void atpsx_dma_write( running_machine *machine, UINT32 n_address, INT32 n_size )
16261617{
16271618   logerror("DMA write from %08x for %d bytes\n", n_address, n_size<<2);
16281619}
src/mame/drivers/paradise.c
r3957r3958
3030***************************************************************************/
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
3334#include "deprecat.h"
3435#include "paradise.h"
3536#include "sound/okim6295.h"
src/mame/drivers/volfied.c
r3957r3958
4040********************************************************************/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
44#include "cpu/m68000/m68000.h"
4345#include "taitoipt.h"
4446#include "video/taitoic.h"
4547#include "audio/taitosnd.h"
r3957r3958
246248   MDRV_CPU_ADD("audio", Z80, 4000000)   /* sound CPU, required to run the game */
247249   MDRV_CPU_PROGRAM_MAP(z80_map,0)
248250
249   MDRV_INTERLEAVE(20)
251   MDRV_QUANTUM_TIME(HZ(1200))
250252
251253   /* video hardware */
252254   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dribling.c
r3957r3958
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
2930#include "machine/8255ppi.h"
3031#include "dribling.h"
3132
src/mame/drivers/balsente.c
r3957r3958
220220***************************************************************************/
221221
222222#include "driver.h"
223#include "cpu/z80/z80.h"
224#include "cpu/m6809/m6809.h"
225#include "cpu/m68000/m68000.h"
223226#include "balsente.h"
224227#include "sound/cem3394.h"
225228
r3957r3958
11911194   MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
11921195   MDRV_CPU_IO_MAP(cpu2_io_map,0)
11931196
1194   MDRV_INTERLEAVE(10)
1197   MDRV_QUANTUM_TIME(HZ(600))
11951198
11961199   MDRV_MACHINE_RESET(balsente)
11971200   MDRV_NVRAM_HANDLER(generic_0fill)
r3957r3958
12441247   MDRV_CPU_ADD("68k", M68000, 8000000)
12451248   MDRV_CPU_PROGRAM_MAP(shrike68k_map,0)
12461249
1247   MDRV_INTERLEAVE(100)
1250   MDRV_QUANTUM_TIME(HZ(6000))
12481251MACHINE_DRIVER_END
12491252
12501253
src/mame/drivers/megadriv.c
r3957r3958
6666
6767
6868#include "driver.h"
69#include "cpu/z80/z80.h"
6970#include "deprecat.h"
7071#include "sound/sn76496.h"
7172#include "sound/2612intf.h"
r3957r3958
636637                            ((megadrive_vdp_command_part2 & 0x0003) << 14);
637638}
638639
639static UINT16 (*vdp_get_word_from_68k_mem)(UINT32 source);
640static UINT16 (*vdp_get_word_from_68k_mem)(running_machine *machine, UINT32 source);
640641
641static UINT16 vdp_get_word_from_68k_mem_default(UINT32 source)
642static UINT16 vdp_get_word_from_68k_mem_default(running_machine *machine, UINT32 source)
642643{
643644   if (( source >= 0x000000 ) && ( source <= 0x3fffff ))
644645   {
645      UINT16 *rom = (UINT16*)memory_region(Machine, "main");
646      UINT16 *rom = (UINT16*)memory_region(machine, "main");
646647      return rom[(source&0x3fffff)>>1];
647648   }
648649   else if (( source >= 0xe00000 ) && ( source <= 0xffffff ))
r3957r3958
654655   else
655656   {
656657      printf("DMA Read unmapped %06x\n",source);
657      return mame_rand(Machine);
658      return mame_rand(machine);
658659   }
659660
660661}
r3957r3958
712713}
713714
714715/* Instant, but we pause the 68k a bit */
715static void megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length)
716static void megadrive_do_insta_68k_to_vram_dma(running_machine *machine, UINT32 source,int length)
716717{
717718   int count;
718719
719720   if (length==0x00) length = 0xffff;
720721
721722   /* This is a hack until real DMA timings are implemented */
722   cpu_spinuntil_time(Machine->cpu[0], ATTOTIME_IN_NSEC(length*1000/3500));
723   cpu_spinuntil_time(machine->cpu[0], ATTOTIME_IN_NSEC(length*1000/3500));
723724
724725   for (count = 0;count<(length>>1);count++)
725726   {
726      vdp_vram_write(vdp_get_word_from_68k_mem(source));
727      vdp_vram_write(vdp_get_word_from_68k_mem(machine, source));
727728      source+=2;
728729      if (source>0xffffff) source = 0xe00000;
729730   }
r3957r3958
749750   {
750751      //if (megadrive_vdp_address>=0x80) return; // abandon
751752
752      write_cram_value(machine, (megadrive_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(source));
753      write_cram_value(machine, (megadrive_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(machine, source));
753754      source+=2;
754755
755756      if (source>0xffffff) source = 0xfe0000;
r3957r3958
767768
768769}
769770
770static void megadrive_do_insta_68k_to_vsram_dma(UINT32 source,UINT16 length)
771static void megadrive_do_insta_68k_to_vsram_dma(running_machine *machine,UINT32 source,UINT16 length)
771772{
772773   int count;
773774
r3957r3958
777778   {
778779      if (megadrive_vdp_address>=0x80) return; // abandon
779780
780      megadrive_vdp_vsram[(megadrive_vdp_address&0x7e)>>1] = vdp_get_word_from_68k_mem(source);
781      megadrive_vdp_vsram[(megadrive_vdp_address&0x7e)>>1] = vdp_get_word_from_68k_mem(machine, source);
781782      source+=2;
782783
783784      if (source>0xffffff) source = 0xfe0000;
r3957r3958
823824
824825         /* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
825826         //mame_printf_debug("68k->VRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
826         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vram_dma(source,length);
827         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vram_dma(machine,source,length);
827828
828829      }
829830      else if (MEGADRIVE_REG17_DMATYPE==0x2)
r3957r3958
884885
885886         /* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
886887         //mame_printf_debug("68k->VSRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, megadrive_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
887         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vsram_dma(source,length);
888         if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vsram_dma(machine,source,length);
888889      }
889890      else if (MEGADRIVE_REG17_DMATYPE==0x2)
890891      {
r3957r3958
19221923}
19231924
19241925/* used by megatech bios, the test mode accesses the joypad/stick inputs like this */
1925UINT8 megatech_bios_port_cc_dc_r(int offset, int ctrl)
1926UINT8 megatech_bios_port_cc_dc_r(running_machine *machine, int offset, int ctrl)
19261927{
1927   running_machine *machine = Machine;
19281928   UINT8 retdata;
19291929
19301930   if (ctrl==0x55)
r3957r3958
38873887
38883888
38893889/* DMA read function for SVP */
3890static UINT16 vdp_get_word_from_68k_mem_svp(UINT32 source)
3890static UINT16 vdp_get_word_from_68k_mem_svp(running_machine *machine, UINT32 source)
38913891{
38923892   if ((source & 0xe00000) == 0x000000)
38933893   {
3894      UINT16 *rom = (UINT16*)memory_region(Machine, "main");
3894      UINT16 *rom = (UINT16*)memory_region(machine, "main");
38953895      source -= 2; // DMA latency
38963896      return rom[source >> 1];
38973897   }
r3957r3958
39093909   else
39103910   {
39113911      mame_printf_debug("DMA Read unmapped %06x\n",source);
3912      return mame_rand(Machine);
3912      return mame_rand(machine);
39133913   }
39143914}
39153915
r3957r3958
63756375   //
63766376   // boosting the interleave here actually makes Kolibri run incorrectly however, that
63776377   // one works best just boosting the interleave on communications?!
6378   MDRV_INTERLEAVE(30000)
6378   MDRV_QUANTUM_TIME(HZ(1800000))
63796379MACHINE_DRIVER_END
63806380
63816381
r3957r3958
64926492
64936493   vdp_get_word_from_68k_mem = vdp_get_word_from_68k_mem_default;
64946494
6495   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_TAS_CALLBACK, (void *)megadriv_tas_callback);
6495   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_TAS_CALLBACK, (void *)megadriv_tas_callback);
64966496
64976497   if ((machine->gamedrv->ipt==ipt_megadri6) || (machine->gamedrv->ipt==ipt_ssf2ghw))
64986498   {
r3957r3958
67066706   _32x_240mode = 0;
67076707
67086708// checking if these help brutal, they don't.
6709   cpu_set_info_int(machine->cpu[2], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_COMPATIBLE_OPTIONS);
6710   cpu_set_info_int(machine->cpu[3], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_COMPATIBLE_OPTIONS);
6709   device_set_info_int(machine->cpu[2], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_COMPATIBLE_OPTIONS);
6710   device_set_info_int(machine->cpu[3], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_COMPATIBLE_OPTIONS);
67116711
67126712   DRIVER_INIT_CALL(megadriv);
67136713}
src/mame/drivers/galpani3.c
r3957r3958
6464*/
6565
6666#include "driver.h"
67#include "cpu/m68000/m68000.h"
6768#include "deprecat.h"
6869#include "sound/ymz280b.h"
6970#include "includes/suprnova.h"
src/mame/drivers/itech32.c
r3957r3958
293293****************************************************************************/
294294
295295#include "driver.h"
296#include "cpu/tms32031/tms32031.h"
297#include "cpu/m6800/m6800.h"
296298#include "deprecat.h"
297299#include "cpu/m6809/m6809.h"
298300#include "cpu/m68000/m68000.h"
r3957r3958
17451747//  MDRV_CPU_ADD("comm", M6803, 8000000/4) -- network CPU
17461748
17471749   MDRV_MACHINE_RESET(drivedge)
1748   MDRV_INTERLEAVE(100)
1750   MDRV_QUANTUM_TIME(HZ(6000))
17491751MACHINE_DRIVER_END
17501752
17511753
r3957r3958
17731775   /* basic machine hardware */
17741776   MDRV_IMPORT_FROM(sftm)
17751777
1776   MDRV_DEVICE_ADD( "m48t02", M48T02 )
1778   MDRV_M48T02_ADD( "m48t02" )
17771779MACHINE_DRIVER_END
17781780
17791781
src/mame/drivers/mexico86.c
r3957r3958
385385   MDRV_CPU_PROGRAM_MAP(sub_cpu_map,0)
386386   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
387387
388   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
388   MDRV_QUANTUM_TIME(HZ(6000))    /* 100 CPU slices per frame - an high value to ensure proper */
389389                     /* synchronization of the CPUs */
390390
391391   /* video hardware */
src/mame/drivers/megadriv.h
r3957r3958
2121extern UINT16* megadriv_backupram;
2222extern int megadriv_backupram_length;
2323extern UINT16* megadrive_ram;
24extern UINT8 megatech_bios_port_cc_dc_r(int offset, int ctrl);
24extern UINT8 megatech_bios_port_cc_dc_r(running_machine *machine, int offset, int ctrl);
2525extern void megadriv_stop_scanline_timer(void);
2626
2727void megatech_set_megadrive_z80_as_megadrive_z80(running_machine *machine);
src/mame/drivers/chaknpop.c
r3957r3958
66 */
77
88#include "driver.h"
9#include "cpu/z80/z80.h"
910#include "sound/ay8910.h"
1011#include "includes/chaknpop.h"
1112
src/mame/drivers/fitfight.c
r3957r3958
8282*/
8383
8484#include "driver.h"
85#include "cpu/m68000/m68000.h"
8586#include "cpu/upd7810/upd7810.h"
8687#include "sound/okim6295.h"
8788#include "includes/fitfight.h"
src/mame/drivers/sspeedr.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/z80/z80.h"
89#include "sspeedr.lh"
910#include "includes/sspeedr.h"
1011
src/mame/drivers/filetto.c
r3957r3958
6464******************************************************************************************/
6565
6666#include "driver.h"
67#include "cpu/i86/i86.h"
6768#include "video/generic.h"
6869#include "machine/pit8253.h"
6970#include "machine/8255ppi.h"
r3957r3958
613614
614615static const struct dma8237_interface dma8237_1_config =
615616{
616   0,
617   "main",
617618   1.0e-6, // 1us
618619
619620   pc_dma_read_byte,
src/mame/drivers/ashnojoe.c
r3957r3958
7373*************************************************************************/
7474
7575#include "driver.h"
76#include "cpu/z80/z80.h"
77#include "cpu/m68000/m68000.h"
7678#include "sound/2203intf.h"
7779#include "sound/msm5205.h"
7880
src/mame/drivers/terracre.c
r3957r3958
8181*/
8282
8383#include "driver.h"
84#include "cpu/m68000/m68000.h"
8485#include "deprecat.h"
8586#include "cpu/z80/z80.h"
8687#include "sound/dac.h"
r3957r3958
995996   ROM_LOAD( "1-n.bin",   0x10000, 0x8000, CRC(e300747a) SHA1(5875a46c215b12f1e9a889819215bca40e4459a6) )
996997   ROM_LOAD( "1-o.bin",   0x18000, 0x8000, CRC(cddc6a6c) SHA1(28d12342e0ada941f68845fa65793a3f5fa21246) ) // Booby Kids gfx hack changes these 2 roms ONLY
997998
998   ROM_REGION( 0x500, "proms", 0 )
999   ROM_REGION( 0x400, "proms", 0 )
9991000   ROM_LOAD( "kid_prom.10f", 0x000, 0x100, CRC(ca13ce23) SHA1(46f0ed22f601721fa35bab12ce8816f30b102f59) ) /* red */
10001001   ROM_LOAD( "kid_prom.11f", 0x100, 0x100, CRC(fb44285a) SHA1(f9605e82f63188daeff044fd48d81c1dfc4d4f2a) ) /* green */
10011002   ROM_LOAD( "kid_prom.12f", 0x200, 0x100, CRC(40d41237) SHA1(b33082540d739a3bfe096f68f3359fbf1360b5be) ) /* blue */
10021003   ROM_LOAD( "kid_prom.2g",  0x300, 0x100, CRC(4b9be0ed) SHA1(81aa7bb24fe6ea13f5dffdb67ea699adf0b3129a) ) /* clut */
1003   ROM_LOAD( "kid_prom.4e",  0x400, 0x100, CRC(e4fb54ee) SHA1(aba89d347b24dc6680e6f25b4a6c0d6657bb6a83) ) /* ctable */
10041004
10051005   ROM_REGION( 0x0100, "user1", 0 )
1006   ROM_LOAD( "kid_prom.4e",  0x000, 0x100, NO_DUMP ) /* ctable */
1006   ROM_LOAD( "kid_prom.4e",  0x000, 0x100, NO_DUMP CRC(e4fb54ee) SHA1(aba89d347b24dc6680e6f25b4a6c0d6657bb6a83) ) /* ctable */
10071007ROM_END
10081008
10091009static DRIVER_INIT( amazon )
src/mame/drivers/findout.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
1617#include "machine/8255ppi.h"
1718#include "machine/ticket.h"
1819#include "sound/dac.h"
src/mame/drivers/mouser.c
r3957r3958
1313*******************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
1617#include "deprecat.h"
1718#include "sound/ay8910.h"
1819
src/mame/drivers/brasil.c
r3957r3958
2222*************************************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/nec/nec.h"
26#include "cpu/i86/i86.h"
2527#include "fashion.lh"
2628
2729static UINT16 *blit_ram;
src/mame/drivers/undrfire.c
r3957r3958
773773   MDRV_CPU_PROGRAM_MAP(cbombers_cpub_map, 0)
774774   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)
775775
776   MDRV_INTERLEAVE(8)   /* CPU slices - Need to interleave Cpu's 1 & 3 */
776   MDRV_QUANTUM_TIME(HZ(480))   /* CPU slices - Need to interleave Cpu's 1 & 3 */
777777
778778   MDRV_MACHINE_RESET(undrfire)
779779   MDRV_NVRAM_HANDLER(undrfire)
src/mame/drivers/deco32.c
r3957r3958
224224***************************************************************************/
225225
226226#include "driver.h"
227#include "cpu/z80/z80.h"
227228#include "deprecat.h"
228229#include "cpu/arm/arm.h"
229230#include "cpu/h6280/h6280.h"
src/mame/drivers/vertigo.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/m6805/m6805.h"
14#include "cpu/m68000/m68000.h"
1315#include "video/vector.h"
1416#include "vertigo.h"
1517#include "exidy440.h"
src/mame/drivers/midzeus.c
r3957r3958
2525**************************************************************************/
2626
2727#include "driver.h"
28#include "cpu/tms32031/tms32031.h"
2829#include "cpu/tms34010/tms34010.h"
2930#include "cpu/adsp2100/adsp2100.h"
3031#include "includes/midzeus.h"
r3957r3958
9394{
9495   memcpy(ram_base, memory_region(machine, "user1"), 0x40000*4);
9596   *ram_base <<= 1;
96   cpu_reset(machine->cpu[0]);
97   device_reset(machine->cpu[0]);
9798
9899   cmos_protected = TRUE;
99100}
r3957r3958
11501151   /* sound hardware */
11511152   MDRV_IMPORT_FROM(dcs2_audio_2104)
11521153
1153   MDRV_DEVICE_ADD( "m48t35", M48T35 )
1154   MDRV_M48T35_ADD( "m48t35" )
11541155MACHINE_DRIVER_END
11551156
11561157
src/mame/drivers/grchamp.c
r3957r3958
692692
693693   MDRV_MACHINE_RESET(grchamp)
694694   MDRV_WATCHDOG_VBLANK_INIT(8)
695   MDRV_INTERLEAVE(100)
695   MDRV_QUANTUM_TIME(HZ(6000))
696696
697697   /* video hardware */
698698   MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
src/mame/drivers/argus.c
r3957r3958
8787
8888
8989#include "driver.h"
90#include "cpu/z80/z80.h"
9091#include "deprecat.h"
9192#include "sound/2203intf.h"
9293#include "includes/argus.h"
r3957r3958
524525   MDRV_CPU_IO_MAP(sound_portmap_2,0)
525526#endif
526527
527   MDRV_INTERLEAVE(10)
528   MDRV_QUANTUM_TIME(HZ(600))
528529
529530   /* video hardware */
530531   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
578579   MDRV_CPU_PROGRAM_MAP(sound_map_a,0)
579580   MDRV_CPU_IO_MAP(sound_portmap_2,0)
580581
581   MDRV_INTERLEAVE(10)
582   MDRV_QUANTUM_TIME(HZ(600))
582583
583584   /* video hardware */
584585   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
623624   MDRV_CPU_PROGRAM_MAP(sound_map_b,0)
624625   MDRV_CPU_IO_MAP(sound_portmap_2,0)
625626
626   MDRV_INTERLEAVE(10)
627   MDRV_QUANTUM_TIME(HZ(600))
627628
628629   /* video hardware */
629630   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/superdq.c
r3957r3958
2121
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425#include "render.h"
2526#include "sound/sn76496.h"
2627#include "sound/custom.h"
src/mame/drivers/goodejan.c
r3957r3958
5252*******************************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/nec/nec.h"
5556#include "deprecat.h"
5657#include "audio/seibu.h"
5758#include "sound/3812intf.h"
src/mame/drivers/bestleag.c
r3957r3958
2020*******************************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
2324#include "sound/okim6295.h"
2425
2526/* Video Handling */
src/mame/drivers/zaxxon.c
r3957r3958
305305***************************************************************************/
306306
307307#include "driver.h"
308#include "cpu/z80/z80.h"
308309#include "machine/segacrpt.h"
309310#include "machine/8255ppi.h"
310311#include "audio/segasnd.h"
r3957r3958
398399static MACHINE_RESET( razmataz )
399400{
400401   /* the timer value is unknown, but this seems to work well */
401   sega_usb_reset(0x10);
402   sega_usb_reset(machine, 0x10);
402403}
403404
404405
src/mame/drivers/shangkid.c
r3957r3958
399399
400400   MDRV_MACHINE_RESET(chinhero)
401401
402   MDRV_INTERLEAVE(10)
402   MDRV_QUANTUM_TIME(HZ(600))
403403
404404   /* video hardware */
405405   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/aleck64.c
r3957r3958
166166*/
167167
168168#include "driver.h"
169#include "cpu/rsp/rsp.h"
169170#include "cpu/mips/mips3.h"
170171#include "streams.h"
171172#include "sound/custom.h"
src/mame/drivers/trackfld.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/z80/z80.h"
22#include "cpu/m6800/m6800.h"
2123#include "machine/konami1.h"
2224#include "cpu/m6809/m6809.h"
2325#include "sound/sn76496.h"
src/mame/drivers/fastfred.c
r3957r3958
66***************************************************************************/
77
88#include "driver.h"
9#include "cpu/z80/z80.h"
910#include "deprecat.h"
1011#include "fastfred.h"
1112#include "sound/ay8910.h"
src/mame/drivers/astrof.c
r3957r3958
4747
4848
4949#include "driver.h"
50#include "cpu/m6502/m6502.h"
5051#include "astrof.h"
5152
5253
src/mame/drivers/karnov.c
r3957r3958
3838*******************************************************************************/
3939
4040#include "driver.h"
41#include "cpu/m68000/m68000.h"
42#include "cpu/m6502/m6502.h"
4143#include "sound/2203intf.h"
4244#include "sound/3812intf.h"
4345
src/mame/drivers/lwings.c
r3957r3958
4646***************************************************************************/
4747
4848#include "driver.h"
49#include "cpu/z80/z80.h"
4950#include "deprecat.h"
5051#include "lwings.h"
5152#include "sound/2203intf.h"
r3957r3958
8081   int bank;
8182
8283   /* bit 0 is flip screen */
83   flip_screen_set(~data & 0x01);
84   flip_screen_set(space->machine, ~data & 0x01);
8485
8586   /* bits 1 and 2 select ROM bank */
8687   RAM = memory_region(space->machine, "main");
src/mame/drivers/punchout.c
r3957r3958
105105***************************************************************************/
106106
107107#include "driver.h"
108#include "cpu/z80/z80.h"
108109#include "cpu/m6502/m6502.h"
109110#include "sound/vlm5030.h"
110111#include "sound/nes_apu.h"
src/mame/drivers/vegas.c
r3957r3958
545545      dcs_idma_cs = 0;
546546
547547   /* set the fastest DRC options, but strict verification */
548   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY + MIPS3DRC_FLUSH_PC);
548   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY + MIPS3DRC_FLUSH_PC);
549549
550550   /* configure fast RAM regions for DRC */
551   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
552   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
553   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, ramsize - 1);
554   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
555   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
551   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
552   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
553   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, ramsize - 1);
554   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
555   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
556556
557   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
558   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
559   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
560   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
561   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
557   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
558   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
559   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
560   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
561   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
562562
563563   /* register for save states */
564564   state_save_register_global(machine, nile_irq_state);
r3957r3958
24882488
24892489static void add_speedup(running_machine *machine, offs_t pc, UINT32 op)
24902490{
2491   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_SELECT, speedup_index++);
2492   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_PC, pc);
2493   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_OPCODE, op);
2494   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_CYCLES, 250);
2491   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_SELECT, speedup_index++);
2492   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_PC, pc);
2493   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_OPCODE, op);
2494   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_CYCLES, 250);
24952495}
24962496
24972497
src/mame/drivers/kopunch.c
r3957r3958
11#include "driver.h"
2#include "cpu/i8085/i8085.h"
23#include "deprecat.h"
34
45extern UINT8 *kopunch_videoram2;
src/mame/drivers/news.c
r3957r3958
1414*/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
1718#include "news.h"
1819#include "sound/okim6295.h"
1920
src/mame/drivers/galpanic.c
r3957r3958
118118***************************************************************************/
119119
120120#include "driver.h"
121#include "cpu/m68000/m68000.h"
121122#include "deprecat.h"
122123#include "includes/kaneko16.h"
123124#include "sound/okim6295.h"
r3957r3958
966967   MDRV_IMPORT_FROM(galpanic)
967968
968969   /* arm watchdog */
969   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
970   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
970971MACHINE_DRIVER_END
971972
972973static MACHINE_DRIVER_START( comad )
src/mame/drivers/finalizr.c
r3957r3958
1717
1818extern UINT8 *finalizr_scroll;
1919extern UINT8 *finalizr_videoram2,*finalizr_colorram2;
20static UINT8 *finalizr_interrupt_enable;
20static UINT8 nmi_enable,irq_enable;
2121
22
2223static int finalizr_T1_line;
2324
2425PALETTE_INIT( finalizr );
r3957r3958
3233{
3334   if (cpu_getiloops(device) == 0)
3435   {
35      if (*finalizr_interrupt_enable & 2)
36      if (irq_enable)
3637         cpu_set_input_line(device, M6809_IRQ_LINE, HOLD_LINE);
3738   }
3839   else if (cpu_getiloops(device) % 2)
3940   {
40      if (*finalizr_interrupt_enable & 1)
41      if (nmi_enable)
4142         cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
4243   }
4344}
r3957r3958
4849   coin_counter_w(1,data & 0x02);
4950}
5051
52static WRITE8_HANDLER( finalizr_flipscreen_w )
53{
54   nmi_enable = data & 0x01;
55   irq_enable = data & 0x02;
56
57   flip_screen_set(space->machine, ~data & 0x08);
58}
59
5160static WRITE8_HANDLER( finalizr_i8039_irq_w )
5261{
5362   cpu_set_input_line(space->machine->cpu[1], 0, ASSERT_LINE);
r3957r3958
7786    */
7887
7988   finalizr_T1_line++;
80   if ((finalizr_T1_line % 3) == 0)
81   {
82      if (finalizr_T1_line == 15)
83      {
84         finalizr_T1_line = -1;
85         return 0;
86      }
87      return 1;
88   }
89   return 0;
89   finalizr_T1_line %= 16;
90   return (!(finalizr_T1_line % 3) && (finalizr_T1_line > 0));
9091}
9192
9293static WRITE8_HANDLER( i8039_T0_w )
r3957r3958
99100    */
100101}
101102
102static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
103static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
104   AM_RANGE(0x0001, 0x0001) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_scroll)
105   AM_RANGE(0x0003, 0x0003) AM_WRITE(finalizr_videoctrl_w)
106   AM_RANGE(0x0004, 0x0004) AM_WRITE(finalizr_flipscreen_w)
107//  AM_RANGE(0x0020, 0x003f) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_scroll)
103108   AM_RANGE(0x0800, 0x0800) AM_READ_PORT("DSW3")
104109   AM_RANGE(0x0808, 0x0808) AM_READ_PORT("DSW2")
105110   AM_RANGE(0x0810, 0x0810) AM_READ_PORT("SYSTEM")
106111   AM_RANGE(0x0811, 0x0811) AM_READ_PORT("P1")
107112   AM_RANGE(0x0812, 0x0812) AM_READ_PORT("P2")
108113   AM_RANGE(0x0813, 0x0813) AM_READ_PORT("DSW1")
109   AM_RANGE(0x2000, 0x2fff) AM_READ(SMH_RAM)
110   AM_RANGE(0x3000, 0x3fff) AM_READ(SMH_RAM)
111   AM_RANGE(0x4000, 0xffff) AM_READ(SMH_ROM)
112ADDRESS_MAP_END
113
114static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
115   AM_RANGE(0x0001, 0x0001) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_scroll)
116   AM_RANGE(0x0003, 0x0003) AM_WRITE(finalizr_videoctrl_w)
117   AM_RANGE(0x0004, 0x0004) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_interrupt_enable)
118//  AM_RANGE(0x0020, 0x003f) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_scroll)
119114   AM_RANGE(0x0818, 0x0818) AM_WRITE(watchdog_reset_w)
120115   AM_RANGE(0x0819, 0x0819) AM_WRITE(finalizr_coin_w)
121116   AM_RANGE(0x081a, 0x081a) AM_WRITE(sn76496_0_w)   /* This address triggers the SN chip to read the data port. */
122117   AM_RANGE(0x081b, 0x081b) AM_WRITE(SMH_NOP)      /* Loads the snd command into the snd latch */
123118   AM_RANGE(0x081c, 0x081c) AM_WRITE(finalizr_i8039_irq_w)   /* custom sound chip */
124119   AM_RANGE(0x081d, 0x081d) AM_WRITE(soundlatch_w)         /* custom sound chip */
125   AM_RANGE(0x2000, 0x23ff) AM_WRITE(SMH_RAM) AM_BASE(&colorram)
126   AM_RANGE(0x2400, 0x27ff) AM_WRITE(SMH_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
127   AM_RANGE(0x2800, 0x2bff) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_colorram2)
128   AM_RANGE(0x2c00, 0x2fff) AM_WRITE(SMH_RAM) AM_BASE(&finalizr_videoram2)
129   AM_RANGE(0x3000, 0x31ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
130   AM_RANGE(0x3200, 0x37ff) AM_WRITE(SMH_RAM)
131   AM_RANGE(0x3800, 0x39ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
132   AM_RANGE(0x3a00, 0x3fff) AM_WRITE(SMH_RAM)
133   AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
120   AM_RANGE(0x2000, 0x23ff) AM_RAM AM_BASE(&colorram)
121   AM_RANGE(0x2400, 0x27ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
122   AM_RANGE(0x2800, 0x2bff) AM_RAM AM_BASE(&finalizr_colorram2)
123   AM_RANGE(0x2c00, 0x2fff) AM_RAM AM_BASE(&finalizr_videoram2)
124   AM_RANGE(0x3000, 0x31ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
125   AM_RANGE(0x3200, 0x37ff) AM_RAM
126   AM_RANGE(0x3800, 0x39ff) AM_RAM AM_BASE(&spriteram_2)
127   AM_RANGE(0x3a00, 0x3fff) AM_RAM
128   AM_RANGE(0x4000, 0xffff) AM_ROM
134129ADDRESS_MAP_END
135130
136static ADDRESS_MAP_START( i8039_readmem, ADDRESS_SPACE_PROGRAM, 8 )
137   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_ROM)
131static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
132   AM_RANGE(0x0000, 0x0fff) AM_ROM
138133ADDRESS_MAP_END
139134
140static ADDRESS_MAP_START( i8039_writemem, ADDRESS_SPACE_PROGRAM, 8 )
141   AM_RANGE(0x0000, 0x0fff) AM_WRITE(SMH_ROM)
142ADDRESS_MAP_END
143
144static ADDRESS_MAP_START( i8039_io_map, ADDRESS_SPACE_IO, 8 )
135static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
145136   AM_RANGE(0x00, 0xff)               AM_READ(soundlatch_r)
146137   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_WRITE(dac_0_data_w)
147138   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(i8039_irqen_w)
r3957r3958
313304static MACHINE_DRIVER_START( finalizr )
314305
315306   /* basic machine hardware */
316   MDRV_CPU_ADD("main", M6809,18432000/6)   /* ??? */
317   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
307   MDRV_CPU_ADD("main", M6809,XTAL_18_432MHz/6)   /* ??? */
308   MDRV_CPU_PROGRAM_MAP(main_map,0)
318309   MDRV_CPU_VBLANK_INT_HACK(finalizr_interrupt,16)   /* 1 IRQ + 8 NMI (generated by a custom IC) */
319310
320   MDRV_CPU_ADD("audio", I8039,18432000/2)   /* 9.216MHz clkin ?? */
321   MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem)
322   MDRV_CPU_IO_MAP(i8039_io_map,0)
311   MDRV_CPU_ADD("audio", I8039,XTAL_18_432MHz/2)   /* 9.216MHz clkin ?? */
312   MDRV_CPU_PROGRAM_MAP(sound_map,0)
313   MDRV_CPU_IO_MAP(sound_io_map,0)
323314
324315   /* video hardware */
325316   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
339330   /* sound hardware */
340331   MDRV_SPEAKER_STANDARD_MONO("mono")
341332
342   MDRV_SOUND_ADD("sn", SN76496, 18432000/12)
333   MDRV_SOUND_ADD("sn", SN76489A, XTAL_18_432MHz/12)
343334   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
344335
345336   MDRV_SOUND_ADD("dac", DAC, 0)
r3957r3958
411402}
412403
413404
414GAME( 1985, finalizr, 0,        finalizr, finalizr, finalizr, ROT90, "Konami", "Finalizer - Super Transformation", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
415GAME( 1985, finalizb, finalizr, finalizr, finalizb, finalizr, ROT90, "bootleg", "Finalizer - Super Transformation (bootleg)", GAME_IMPERFECT_SOUND | GAME_NO_COCKTAIL )
405GAME( 1985, finalizr, 0,        finalizr, finalizr, finalizr, ROT90, "Konami", "Finalizer - Super Transformation", GAME_IMPERFECT_SOUND )
406GAME( 1985, finalizb, finalizr, finalizr, finalizb, finalizr, ROT90, "bootleg", "Finalizer - Super Transformation (bootleg)", GAME_IMPERFECT_SOUND )
416407
src/mame/drivers/segaybd.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/z80/z80.h"
1314#include "system16.h"
1415#include "cpu/m68000/m68000.h"
1516#include "machine/segaic16.h"
r3957r3958
967968
968969   MDRV_MACHINE_RESET(yboard)
969970   MDRV_NVRAM_HANDLER(yboard)
970   MDRV_INTERLEAVE(100)
971   MDRV_QUANTUM_TIME(HZ(6000))
971972
972973   /* video hardware */
973974   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/shuuz.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "shuuz.h"
2324#include "sound/okim6295.h"
src/mame/drivers/cclimber.c
r3957r3958
194194***************************************************************************/
195195
196196#include "driver.h"
197#include "cpu/z80/z80.h"
197198#include "machine/segacrpt.h"
198199#include "sound/ay8910.h"
199200#include "sound/samples.h"
r3957r3958
247248
248249static TIMER_CALLBACK( disable_interrupts )
249250{
250   cpu_interrupt_enable(0,0);
251   cpu_interrupt_enable(machine->cpu[0],0);
251252}
252253
253254
src/mame/drivers/xorworld.c
r3957r3958
205205   MDRV_CPU_PROGRAM_MAP(xorworld_map, 0)
206206   MDRV_CPU_VBLANK_INT_HACK(xorworld_interrupt, 4)   // 1 IRQ2 + 1 IRQ4 + 1 IRQ6
207207
208   MDRV_INTERLEAVE(1)
208   MDRV_QUANTUM_TIME(HZ(60))
209209
210210   MDRV_NVRAM_HANDLER(xorworld)
211211
src/mame/drivers/speedspn.c
r3957r3958
2121******************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425#include "sound/okim6295.h"
2526
2627/*** README INFO **************************************************************
src/mame/drivers/enigma2.c
r3957r3958
1919*********************************************************************/
2020
2121#include "driver.h"
22#include "cpu/z80/z80.h"
23#include "cpu/i8085/i8085.h"
2224#include "deprecat.h"
2325#include "sound/ay8910.h"
2426
r3957r3958
194196         offs_t color_map_address = (y >> 3 << 5) | (x >> 3);
195197         /* the schematics shows it like this, but it doesn't work as this would
196198               produce no stars, due to the contents of the PROM -- maybe there is
197               a star disabled bit somewhere that's connected here instead of flip_screen_get() */
199               a star disabled bit somewhere that's connected here instead of flip_screen_get(screen->machine) */
198200         /* star_map_address = (y >> 4 << 6) | (engima2_flip_screen_get() << 5) | (x >> 3); */
199201         offs_t star_map_address = (y >> 4 << 6) | 0x20 | (x >> 3);
200202
src/mame/drivers/cowrace.c
r3957r3958
77*************************************************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "sound/okim6295.h"
1112#include "sound/2203intf.h"
1213
src/mame/drivers/segaorun.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
1718#include "system16.h"
1819#include "machine/fd1089.h"
1920#include "machine/segaic16.h"
r3957r3958
257258   segaic16_tilemap_reset(machine, 0);
258259
259260   /* hook the RESET line, which resets CPU #1 */
260   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)outrun_reset);
261   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_RESET_CALLBACK, (genf *)outrun_reset);
261262
262263   /* start timers to track interrupts */
263264   timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 223, 0), NULL, 223, scanline_callback);
r3957r3958
816817   MDRV_CPU_IO_MAP(sound_portmap,0)
817818
818819   MDRV_MACHINE_RESET(outrun)
819   MDRV_INTERLEAVE(100)
820   MDRV_QUANTUM_TIME(HZ(6000))
820821
821822   MDRV_PPI8255_ADD( "ppi8255", single_ppi_intf )
822823
src/mame/drivers/koikoi.c
r3957r3958
3838***************************************************************************/
3939
4040#include "driver.h"
41#include "cpu/z80/z80.h"
4142#include "sound/ay8910.h"
4243
4344static int inputcnt=0;
src/mame/drivers/hexa.c
r3957r3958
4747*************************************************************************/
4848
4949#include "driver.h"
50#include "cpu/z80/z80.h"
5051#include "sound/ay8910.h"
5152
5253
src/mame/drivers/gticlub.c
r3957r3958
219219*/
220220
221221#include "driver.h"
222#include "cpu/m68000/m68000.h"
222223#include "machine/eeprom.h"
223224#include "cpu/powerpc/ppc.h"
224225#include "cpu/sharc/sharc.h"
225226#include "machine/konppc.h"
226227#include "machine/konamiic.h"
227#include "machine/adc083x.h"
228228#include "sound/rf5c400.h"
229229#include "video/voodoo.h"
230230#include "video/gticlub.h"
r3957r3958
598598static MACHINE_START( gticlub )
599599{
600600   /* set conservative DRC options */
601   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
601   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
602602
603603   /* configure fast RAM regions for DRC */
604   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
605   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
606   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff);
607   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
608   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
604   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
605   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
606   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff);
607   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
608   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
609609}
610610
611611static ADDRESS_MAP_START( gticlub_map, ADDRESS_SPACE_PROGRAM, 32 )
r3957r3958
924924   MDRV_CPU_CONFIG(sharc_cfg)
925925   MDRV_CPU_DATA_MAP(sharc_map, 0)
926926
927   MDRV_INTERLEAVE(100)
927   MDRV_QUANTUM_TIME(HZ(6000))
928928
929929   MDRV_NVRAM_HANDLER(gticlub)
930930   MDRV_MACHINE_START(gticlub)
r3957r3958
972972   MDRV_CPU_CONFIG(sharc_cfg)
973973   MDRV_CPU_DATA_MAP(hangplt_sharc1_map, 0)
974974
975   MDRV_INTERLEAVE(100)
975   MDRV_QUANTUM_TIME(HZ(6000))
976976
977977   MDRV_NVRAM_HANDLER(gticlub)
978978   MDRV_MACHINE_START(gticlub)
r3957r3958
11671167
11681168static DRIVER_INIT(gticlub)
11691169{
1170   init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB);
1170   init_konami_cgboard(machine, 1, CGBOARD_TYPE_GTICLUB);
11711171
11721172   sharc_dataram_0 = auto_malloc(0x100000);
11731173   gticlub_led_reg0 = gticlub_led_reg1 = 0x7f;
r3957r3958
11811181
11821182static DRIVER_INIT(hangplt)
11831183{
1184   init_konami_cgboard(2, CGBOARD_TYPE_HANGPLT);
1185   set_cgboard_texture_bank(0, 5, memory_region(machine, "user5"));
1186   set_cgboard_texture_bank(1, 6, memory_region(machine, "user5"));
1184   init_konami_cgboard(machine, 2, CGBOARD_TYPE_HANGPLT);
1185   set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5"));
1186   set_cgboard_texture_bank(machine, 1, 6, memory_region(machine, "user5"));
11871187
11881188   sharc_dataram_0 = auto_malloc(0x100000);
11891189   sharc_dataram_1 = auto_malloc(0x100000);
src/mame/drivers/cloak.c
r3957r3958
112112*/
113113
114114#include "driver.h"
115#include "cpu/m6502/m6502.h"
115116#include "deprecat.h"
116117#include "sound/pokey.h"
117118#include "includes/cloak.h"
r3957r3958
337338   MDRV_CPU_PROGRAM_MAP(slave_map,0)
338339   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
339340
340   MDRV_INTERLEAVE(5)
341   MDRV_QUANTUM_TIME(HZ(300))
341342
342343   MDRV_NVRAM_HANDLER(generic_0fill)
343344
src/mame/drivers/mazerbla.c
r3957r3958
3636****************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/z80/z80.h"
3940#include "sound/ay8910.h"
4041
4142static UINT8 *cfb_ram;
src/mame/drivers/foodf.c
r3957r3958
7474
7575
7676#include "driver.h"
77#include "cpu/m68000/m68000.h"
7778#include "machine/atarigen.h"
7879#include "sound/pokey.h"
7980#include "foodf.h"
src/mame/drivers/namcona1.c
r3957r3958
159159***************************************************************************/
160160
161161#include "driver.h"
162#include "cpu/m68000/m68000.h"
162163#include "deprecat.h"
163164#include "namcona1.h"
164165#include "sound/c140.h"
r3957r3958
10191020   MDRV_NVRAM_HANDLER(namcosna1)
10201021   MDRV_MACHINE_START(namcona1)
10211022   MDRV_MACHINE_RESET(namcona1_mcu)
1022   MDRV_INTERLEAVE(40)
1023   MDRV_QUANTUM_TIME(HZ(2400))
10231024
10241025   /* video hardware */
10251026   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/bsktball.c
r3957r3958
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/m6502/m6502.h"
2728#include "deprecat.h"
2829#include "bsktball.h"
2930#include "sound/discrete.h"
src/mame/drivers/armedf.c
r3957r3958
173173   COMBINE_DATA(&armedf_vreg);
174174   /* bits 0 and 1 of armedf_vreg are coin counters */
175175   /* bit 12 seems to handle screen flipping */
176   flip_screen_set(armedf_vreg & 0x1000);
176   flip_screen_set(space->machine, armedf_vreg & 0x1000);
177177}
178178
179179static WRITE16_HANDLER( terraf_io_w )
r3957r3958
181181   COMBINE_DATA(&armedf_vreg);
182182   /* bits 0 and 1 of armedf_vreg are coin counters */
183183   /* bit 12 seems to handle screen flipping */
184   flip_screen_set(armedf_vreg & 0x1000);
184   flip_screen_set(space->machine, armedf_vreg & 0x1000);
185185
186186
187187   if ((armedf_vreg & 0x4000) && !(armedf_vreg & 0x0100))
r3957r3958
203203   COMBINE_DATA(&armedf_vreg);
204204   /* bits 0 and 1 of armedf_vreg are coin counters */
205205   /* bit 12 seems to handle screen flipping */
206   flip_screen_set(armedf_vreg & 0x1000);
206   flip_screen_set(space->machine, armedf_vreg & 0x1000);
207207
208208   /* This is a temporary condition specification. */
209209   if (!(armedf_vreg & 0x0080))
src/mame/drivers/forte2.c
r3957r3958
4040   AM_RANGE(0xa0, 0xa0) AM_WRITE(ay8910_control_port_0_w)
4141   AM_RANGE(0xa1, 0xa1) AM_WRITE(ay8910_write_port_0_w)
4242   AM_RANGE(0xa2, 0xa2) AM_READ(ay8910_read_port_0_r)
43   AM_RANGE(0xa8, 0xa8) AM_RAM
44   AM_RANGE(0xa9, 0xab) AM_NOP
43
44//Ports a8-ab are originally for communicating with the i8255 PPI on MSX.
45//( http://map.tni.nl/resources/msx_io_ports.php#ppi )
46//Since this arcade board doesn't have one, those ports should be
47//unmapped, so setting a8 to RAM is wrong. The ROM hasn't been hacked
48//cleanly by removing all references to the PPI. PCB pics showing eg. lack
49//  AM_RANGE(0xa8, 0xa8) AM_RAM
50//  AM_RANGE(0xa9, 0xab) AM_NOP
4551ADDRESS_MAP_END
4652
4753static INPUT_PORTS_START( pesadelo )
src/mame/drivers/dkong.c
r3957r3958
299299***************************************************************************/
300300
301301#include "driver.h"
302#include "cpu/z80/z80.h"
302303#include "cpu/s2650/s2650.h"
303304#include "cpu/m6502/m6502.h"
304305#include "includes/dkong.h"
r3957r3958
338339
339340static const z80dma_interface dk3_dma =
340341{
341   0,
342   CLOCK_1H,
342   "main",
343343
344344   dk_dma_read_byte,
345345   dk_dma_write_byte,
r3957r3958
349349
350350static const dma8257_interface dk_dma =
351351{
352   0,
353   CLOCK_1H,
352   "main",
354353
355354   dk_dma_read_byte,
356355   dk_dma_write_byte,
r3957r3958
362361
363362static const dma8257_interface hb_dma =
364363{
365   0,
366   CLOCK_1H,
364   "main",
367365
368366   hb_dma_read_byte,
369367   hb_dma_write_byte,
r3957r3958
15751573   MDRV_MACHINE_START(dkong2b)
15761574   MDRV_MACHINE_RESET(dkong)
15771575
1578   MDRV_DEVICE_ADD("dma8257", DMA8257)
1579   MDRV_DEVICE_CONFIG(dk_dma)
1576   MDRV_DMA8257_ADD("dma8257", CLOCK_1H, dk_dma)
15801577
15811578   /* video hardware */
15821579   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
16441641
16451642   MDRV_MACHINE_START(dkong3)
16461643
1647   MDRV_DEVICE_ADD("z80dma", Z80DMA)
1648   MDRV_DEVICE_CONFIG(dk3_dma)
1644   MDRV_Z80DMA_ADD("z80dma", CLOCK_1H, dk3_dma)
16491645
16501646   /* video hardware */
16511647   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sprint4.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89#include "audio/sprint4.h"
910
1011#define MASTER_CLOCK    12096000
src/mame/drivers/appoooh.c
r3957r3958
4848***************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "appoooh.h"
5253#include "machine/segacrpt.h"
5354#include "sound/msm5205.h"
src/mame/drivers/skyraid.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89
910extern UINT8* skyraid_alpha_num_ram;
1011extern UINT8* skyraid_pos_ram;
src/mame/drivers/travrusa.c
r3957r3958
4848****************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "audio/irem.h"
5253
5354extern UINT8 *travrusa_videoram;
src/mame/drivers/hanaroku.c
r3957r3958
1111*/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "sound/ay8910.h"
1516
1617/* video */
r3957r3958
5354      int sx = hanaroku_spriteram1[i + 0x200] | ((hanaroku_spriteram2[i + 0x200] & 0x07) << 8);
5455      int sy = 242 - hanaroku_spriteram3[i];
5556
56      if (flip_screen_get())
57      if (flip_screen_get(machine))
5758      {
5859         sy = 242 - sy;
5960         flipx = !flipx;
src/mame/drivers/metlclsh.c
r3957r3958
130130
131131static WRITE8_HANDLER( metlclsh_flipscreen_w )
132132{
133   flip_screen_set(data & 1);
133   flip_screen_set(space->machine, data & 1);
134134}
135135
136136static ADDRESS_MAP_START( metlclsh_readmem2, ADDRESS_SPACE_PROGRAM, 8 )
r3957r3958
308308
309309static MACHINE_RESET( metlclsh )
310310{
311   flip_screen_set(0);
311   flip_screen_set(machine, 0);
312312}
313313
314314static MACHINE_DRIVER_START( metlclsh )
src/mame/drivers/aliens.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/z80/z80.h"
1112#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1213#include "video/konamiic.h"
1314#include "sound/k007232.h"
src/mame/drivers/ddenlovr.c
r3957r3958
8585***************************************************************************/
8686
8787#include "driver.h"
88#include "cpu/m68000/m68000.h"
8889#include "deprecat.h"
8990#include "cpu/z80/z80.h"
9091#include "sound/ay8910.h"
r3957r3958
65266527   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
65276528
65286529   /* devices */
6529   MDRV_DEVICE_ADD("rtc", MSM6242)
6530   MDRV_MSM6242_ADD("rtc")
65306531MACHINE_DRIVER_END
65316532
65326533static MACHINE_DRIVER_START( ddenlvrj )
r3957r3958
65946595   /* I haven't found a irq ack register, so I need this kludge to
65956596       make sure I don't lose any interrupt generated by the blitter,
65966597       otherwise quizchq would lock up. */
6597   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6598   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
65986599      return;
65996600
66006601   if ((++count % 60) == 0)
r3957r3958
66436644   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
66446645
66456646   /* devices */
6646   MDRV_DEVICE_ADD("rtc", MSM6242)
6647   MDRV_MSM6242_ADD("rtc")
66476648MACHINE_DRIVER_END
66486649
66496650static MACHINE_DRIVER_START( rongrong )
r3957r3958
66746675   /* I haven't found a irq ack register, so I need this kludge to
66756676       make sure I don't lose any interrupt generated by the blitter,
66766677       otherwise the game would lock up. */
6677   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6678   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
66786679      return;
66796680
66806681   if ((++count % 60) == 0)
r3957r3958
67246725   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
67256726
67266727   /* devices */
6727   MDRV_DEVICE_ADD("rtc", MSM6242)
6728   MDRV_MSM6242_ADD("rtc")
67286729MACHINE_DRIVER_END
67296730
67306731
r3957r3958
67466747   /* I haven't found a irq ack register, so I need this kludge to
67476748       make sure I don't lose any interrupt generated by the blitter,
67486749       otherwise quizchq would lock up. */
6749   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6750   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
67506751      return;
67516752
67526753   if ((++count % 60) == 0)
r3957r3958
67886789   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
67896790
67906791   /* devices */
6791   MDRV_DEVICE_ADD("rtc", MSM6242)
6792   MDRV_MSM6242_ADD("rtc")
67926793MACHINE_DRIVER_END
67936794
67946795static MACHINE_DRIVER_START( hkagerou )
r3957r3958
68226823   /* I haven't found a irq ack register, so I need this kludge to
68236824       make sure I don't lose any interrupt generated by the blitter,
68246825       otherwise quizchq would lock up. */
6825   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6826   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
68266827      return;
68276828
68286829   if ((++count % 60) == 0)
r3957r3958
68806881   /* I haven't found a irq ack register, so I need this kludge to
68816882       make sure I don't lose any interrupt generated by the blitter,
68826883       otherwise quizchq would lock up. */
6883   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6884   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
68846885      return;
68856886
68866887   switch( cpu_getiloops(device) )
r3957r3958
69366937   /* I haven't found a irq ack register, so I need this kludge to
69376938       make sure I don't lose any interrupt generated by the blitter,
69386939       otherwise hginga would lock up. */
6939   if (cpu_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
6940   if (device_get_info_int(device,CPUINFO_INT_INPUT_STATE + 0))
69406941      return;
69416942
69426943   if ((++count % 60) == 0)
src/mame/drivers/chinagat.c
r3957r3958
7070
7171
7272#include "driver.h"
73#include "cpu/hd6309/hd6309.h"
7374#include "cpu/m6809/m6809.h"
7475#include "cpu/z80/z80.h"
7576#include "cpu/mcs48/mcs48.h"
r3957r3958
125126   ddragon_scrolly_hi = ( ( data & 0x02 ) << 7 );
126127   ddragon_scrollx_hi = ( ( data & 0x01 ) << 8 );
127128
128   flip_screen_set(~data & 0x04);
129   flip_screen_set(space->machine, ~data & 0x04);
129130}
130131
131132static WRITE8_HANDLER( chinagat_bankswitch_w )
r3957r3958
505506   MDRV_CPU_ADD("audio", Z80, 3579545)   /* 3.579545 MHz */
506507   MDRV_CPU_PROGRAM_MAP(sound_map,0)
507508
508   MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */
509   MDRV_QUANTUM_TIME(HZ(6000)) /* heavy interleaving to sync up sprite<->main cpu's */
509510
510511   MDRV_MACHINE_RESET(chinagat)
511512
r3957r3958
553554   MDRV_CPU_PROGRAM_MAP(i8748_map,0)
554555   MDRV_CPU_IO_MAP(i8748_portmap,0)
555556
556   MDRV_INTERLEAVE(100)   /* heavy interleaving to sync up sprite<->main cpu's */
557   MDRV_QUANTUM_TIME(HZ(6000))   /* heavy interleaving to sync up sprite<->main cpu's */
557558
558559   MDRV_MACHINE_RESET(chinagat)
559560
r3957r3958
597598   MDRV_CPU_ADD("audio", Z80, 3579545)      /* 3.579545 MHz oscillator */
598599   MDRV_CPU_PROGRAM_MAP(ym2203c_sound_map,0)
599600
600   MDRV_INTERLEAVE(100) /* heavy interleaving to sync up sprite<->main cpu's */
601   MDRV_QUANTUM_TIME(HZ(6000)) /* heavy interleaving to sync up sprite<->main cpu's */
601602
602603   MDRV_MACHINE_RESET(chinagat)
603604
src/mame/drivers/kaneko16.c
r3957r3958
7171***************************************************************************/
7272
7373#include "driver.h"
74#include "cpu/z80/z80.h"
75#include "cpu/m68000/m68000.h"
7476#include "deprecat.h"
7577#include "machine/eeprom.h"
7678#include "includes/kaneko16.h"
src/mame/drivers/goldstar.c
r3957r3958
77different hardware.  There are also various bootlegs / hacks, it isn't clear
88exactly what hardware each runs on, some appear to have no OKI for example.
99
10driver by Mirko Buffoni
10Driver by Mirko Buffoni.
11Additional Work: David Haywood, Roberto Fresca.
1112
1213***************************************************************************/
14
1315#include "driver.h"
16#include "cpu/z80/z80.h"
1417#include "sound/ay8910.h"
1518#include "sound/okim6295.h"
19#include "sound/sn76496.h"
20#include "machine/8255ppi.h"
1621
1722static int dataoffset=0;
1823
r3957r3958
2934extern UINT8 *goldstar_reel3_ram;
3035extern WRITE8_HANDLER( goldstar_reel3_ram_w );
3136
37extern WRITE8_HANDLER( goldstar_fg_vidram_w );
38extern WRITE8_HANDLER( goldstar_fg_atrram_w );
39
3240WRITE8_HANDLER( goldstar_fa00_w );
3341VIDEO_START( goldstar );
42VIDEO_START( cherrym );
3443VIDEO_UPDATE( goldstar );
35VIDEO_UPDATE( cherrym );
3644
3745static UINT8 *nvram;
3846static size_t nvram_size;
r3957r3958
7078   AM_RANGE(0x0000, 0xb7ff) AM_ROM
7179   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size)
7280   AM_RANGE(0xc000, 0xc7ff) AM_ROM
73   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
74   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&colorram)
81   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram)
82   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram)
7583   AM_RANGE(0xd800, 0xd9ff) AM_RAM AM_WRITE( goldstar_reel1_ram_w ) AM_BASE(&goldstar_reel1_ram)
7684   AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_WRITE( goldstar_reel2_ram_w ) AM_BASE(&goldstar_reel2_ram)
7785   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_WRITE( goldstar_reel3_ram_w ) AM_BASE(&goldstar_reel3_ram)
r3957r3958
97105   AM_RANGE(0xfe00, 0xfe00) AM_READWRITE(protection_r,protection_w)
98106ADDRESS_MAP_END
99107
108static ADDRESS_MAP_START( goldstar_readport, ADDRESS_SPACE_IO, 8 )
109   ADDRESS_MAP_GLOBAL_MASK(0xff)
110   AM_RANGE(0x10, 0x10) AM_READ_PORT("DSW6")
111ADDRESS_MAP_END
112
113
100114static ADDRESS_MAP_START( ncb3_map, ADDRESS_SPACE_PROGRAM, 8 )
101115   AM_RANGE(0x0000, 0xb7ff) AM_ROM
102116   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size)
103117   AM_RANGE(0xc000, 0xc7ff) AM_ROM
104   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
105   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&colorram)
106   AM_RANGE(0xd800, 0xd9ff) AM_RAM AM_WRITE( goldstar_reel1_ram_w ) AM_BASE(&goldstar_reel1_ram)
107   AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_WRITE( goldstar_reel2_ram_w ) AM_BASE(&goldstar_reel2_ram)
108   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_WRITE( goldstar_reel3_ram_w ) AM_BASE(&goldstar_reel3_ram)
118   AM_RANGE(0xc800, 0xcfff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram)
119   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram)
120   AM_RANGE(0xd800, 0xd9ff) AM_RAM AM_WRITE(goldstar_reel1_ram_w) AM_BASE(&goldstar_reel1_ram)
121   AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_WRITE(goldstar_reel2_ram_w) AM_BASE(&goldstar_reel2_ram)
122   AM_RANGE(0xe800, 0xe9ff) AM_RAM AM_WRITE(goldstar_reel3_ram_w) AM_BASE(&goldstar_reel3_ram)
109123   AM_RANGE(0xf040, 0xf07f) AM_RAM AM_BASE(&goldstar_reel1_scroll)
110124   AM_RANGE(0xf080, 0xf0bf) AM_RAM AM_BASE(&goldstar_reel2_scroll)
111   AM_RANGE(0xf100, 0xf17f) AM_RAM AM_BASE(&goldstar_reel3_scroll) // moved compared to ncb3
125   AM_RANGE(0xf100, 0xf17f) AM_RAM AM_BASE(&goldstar_reel3_scroll) // moved compared to goldstar
112126
113   AM_RANGE(0xf800, 0xf800) AM_READ_PORT("IN0")
114   AM_RANGE(0xf801, 0xf801) AM_READ_PORT("IN1")   /* Test Mode */
115   AM_RANGE(0xf802, 0xf802) AM_READ_PORT("DSW1")
116//  AM_RANGE(0xf803, 0xf803)
117//  AM_RANGE(0xf804, 0xf804)
118   AM_RANGE(0xf805, 0xf805) AM_READ_PORT("DSW4")   /* DSW 4 (also appears in 8910 port) */
119   AM_RANGE(0xf806, 0xf806) AM_READ_PORT("DSW7")   /* (don't know to which one of the */
120   AM_RANGE(0xf810, 0xf810) AM_READ_PORT("UNK1")
121   AM_RANGE(0xf811, 0xf811) AM_READ_PORT("UNK2")
122   AM_RANGE(0xf820, 0xf820) AM_READ_PORT("DSW2")
123//  AM_RANGE(0xf830, 0xf830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
124//  AM_RANGE(0xf840, 0xf840) AM_WRITE(ay8910_control_port_0_w)
125//  AM_RANGE(0xfa00, 0xfa00) AM_WRITE(goldstar_fa00_w)
126//  AM_RANGE(0xfb00, 0xfb00) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
127//  AM_RANGE(0xfd00, 0xfdff) AM_READWRITE(SMH_RAM,paletteram_BBGGGRRR_w) AM_BASE(&paletteram)
128//  AM_RANGE(0xfe00, 0xfe00) AM_READWRITE(protection_r,protection_w)
127   AM_RANGE(0xf800, 0xf803) AM_DEVREADWRITE(PPI8255, "ppi8255_0", ppi8255_r, ppi8255_w)   /* Input Ports */
128   AM_RANGE(0xf810, 0xf813) AM_DEVREADWRITE(PPI8255, "ppi8255_1", ppi8255_r, ppi8255_w)   /* Input Ports */
129   AM_RANGE(0xf820, 0xf823) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w)   /* Input/Output Ports */
130   AM_RANGE(0xf830, 0xf830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
131   AM_RANGE(0xf840, 0xf840) AM_WRITE(ay8910_control_port_0_w)
132   AM_RANGE(0xf870, 0xf870) AM_WRITE(sn76496_0_w)   /* guess... device is initialized, but doesn't seems to be used.*/
129133ADDRESS_MAP_END
130134
131
132
133static ADDRESS_MAP_START( goldstar_readport, ADDRESS_SPACE_IO, 8 )
135static ADDRESS_MAP_START( ncb3_readwriteport, ADDRESS_SPACE_IO, 8 )
134136   ADDRESS_MAP_GLOBAL_MASK(0xff)
135   AM_RANGE(0x10, 0x10) AM_READ_PORT("DSW6")
137//   AM_RANGE(0x00, 0x0f) ---> writes.
136138ADDRESS_MAP_END
137139
140/* ncb3 findings...
138141
142  f800-f803 = 8255_1 (ctrl=9b) ; portA, B & C (input)
143  f810-f813 = 8255_2 (ctrl=9b) ; portA, B & C (input)
144  f820-f823 = 8255_3 (ctrl=90) ; portA (input); ports B & C (output)
145  f830      = AY8910 RW
146  f840      = AY8910 ctrl
147  f850      = Unknown
148  f870      = PSG (init writes)
149
150
151  I/O
152
153  00 = RW
154  06 = RW
155  08 = RW
156  81 =  W
157
158*/
159
160
139161static ADDRESS_MAP_START( cm_map, ADDRESS_SPACE_PROGRAM, 8 )
140162   AM_RANGE(0x0000, 0xbfff) AM_ROM AM_WRITENOP
141163
142
143164   AM_RANGE(0xb800, 0xbfff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size) // not here..
144   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
145   AM_RANGE(0xe800, 0xefff) AM_RAM AM_BASE(&colorram)
165   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram)
166   AM_RANGE(0xe800, 0xefff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram)
146167
147168   AM_RANGE(0xd000, 0xd7ff) AM_RAM // main?
148169   AM_RANGE(0xd800, 0xdfff) AM_RAM
r3957r3958
337358   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
338359INPUT_PORTS_END
339360
361static ADDRESS_MAP_START( lucky8_map, ADDRESS_SPACE_PROGRAM, 8 )
362   AM_RANGE(0x0000, 0x7fff) AM_ROM
363   AM_RANGE(0x8000, 0x87ff) AM_RAM
364   AM_RANGE(0xf800, 0xffff) AM_RAM AM_BASE(&nvram) AM_SIZE(&nvram_size)
365   AM_RANGE(0x8800, 0x8fff) AM_RAM AM_WRITE(goldstar_fg_vidram_w) AM_BASE(&videoram)
366   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(goldstar_fg_atrram_w) AM_BASE(&colorram)
367   AM_RANGE(0x9800, 0x99ff) AM_RAM AM_WRITE(goldstar_reel1_ram_w) AM_BASE(&goldstar_reel1_ram)
368   AM_RANGE(0xa000, 0xa1ff) AM_RAM AM_WRITE(goldstar_reel2_ram_w) AM_BASE(&goldstar_reel2_ram)
369   AM_RANGE(0xa800, 0xa9ff) AM_RAM AM_WRITE(goldstar_reel3_ram_w) AM_BASE(&goldstar_reel3_ram)
370   AM_RANGE(0xb040, 0xb07f) AM_RAM AM_BASE(&goldstar_reel1_scroll)
371   AM_RANGE(0xb080, 0xb0bf) AM_RAM AM_BASE(&goldstar_reel2_scroll)
372   AM_RANGE(0xb100, 0xb17f) AM_RAM AM_BASE(&goldstar_reel3_scroll)
373
374   /* none of the inputs are verified / tested */
375   AM_RANGE(0xb800, 0xb800) AM_READ_PORT("IN0")
376   AM_RANGE(0xb801, 0xb801) AM_READ_PORT("IN1")   /* Test Mode */
377   AM_RANGE(0xb802, 0xb802) AM_READ_PORT("DSW1")
378   //AM_RANGE(0xb803, 0xb803)
379   //AM_RANGE(0xb804, 0xb804)
380   AM_RANGE(0xb805, 0xb805) AM_READ_PORT("DSW4")   /* DSW 4 (also appears in 8910 port) */
381   AM_RANGE(0xb806, 0xb806) AM_READ_PORT("DSW7")   /* (don't know to which one of the */
382   AM_RANGE(0xb810, 0xb810) AM_READ_PORT("UNK1")
383   AM_RANGE(0xb811, 0xb811) AM_READ_PORT("UNK2")
384   AM_RANGE(0xb820, 0xb820) AM_READ_PORT("DSW2")
385  AM_RANGE(0xb830, 0xb830) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
386  AM_RANGE(0xb840, 0xb840) AM_WRITE(ay8910_control_port_0_w)
387//  AM_RANGE(0xba00, 0xba00) AM_WRITE(goldstar_fa00_w)
388//  AM_RANGE(0xbb00, 0xbb00) AM_READWRITE(okim6295_status_0_r,okim6295_data_0_w)
389//  AM_RANGE(0xbd00, 0xbdff) AM_READWRITE(SMH_RAM,paletteram_BBGGGRRR_w) AM_BASE(&paletteram)
390//  AM_RANGE(0xbe00, 0xbe00) AM_READWRITE(protection_r,protection_w)
391ADDRESS_MAP_END
392
393
340394static INPUT_PORTS_START( goldstar )
341395   PORT_START("IN0")
342396   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
r3957r3958
463517   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
464518INPUT_PORTS_END
465519
520static INPUT_PORTS_START( chryigld )
521   PORT_START("IN0")
522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
523   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
524   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 2 / Double-Up") PORT_CODE(KEYCODE_X)
525   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Blue Bet / Card 3")  PORT_CODE(KEYCODE_B)
526   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1")             PORT_CODE(KEYCODE_Z)
527   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Red Bet / Card 2")   PORT_CODE(KEYCODE_V)
528   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 3 / Info / Card 1")    PORT_CODE(KEYCODE_C)
529   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start / Stop All / Card 4") PORT_CODE(KEYCODE_N)
466530
531   PORT_START("IN1")
532   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
533   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
534   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1)    PORT_IMPULSE(2)   // Coin1?
535   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
536   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2)    PORT_IMPULSE(2)   // Coin2?
537   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3)    PORT_IMPULSE(2)   // Coin3?
538   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In") PORT_CODE(KEYCODE_Q)
539   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4)    PORT_IMPULSE(2)   // Coin4?
467540
541   PORT_START("IN2")
542   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
543   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
544   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
545   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
546   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant") PORT_CODE(KEYCODE_W)
547   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
548   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9)
549   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats")    PORT_CODE(KEYCODE_0)
468550
551   PORT_START("DSW1")
552   PORT_DIPNAME( 0x07, 0x04, "Main Game %" )
553   PORT_DIPSETTING(    0x00, "55%" )
554   PORT_DIPSETTING(    0x01, "60%" )
555   PORT_DIPSETTING(    0x02, "65%" )
556   PORT_DIPSETTING(    0x03, "70%" )
557   PORT_DIPSETTING(    0x04, "75%" )
558   PORT_DIPSETTING(    0x05, "80%" )
559   PORT_DIPSETTING(    0x06, "85%" )
560   PORT_DIPSETTING(    0x07, "90%" )
561   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
562   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
563   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
564   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
565   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
567   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
568   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
569   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
570   PORT_DIPNAME( 0x40, 0x00, "Key-In Type" )
571   PORT_DIPSETTING(    0x40, "B-Type" )
572   PORT_DIPSETTING(    0x00, "A-Type" )
573   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
574   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
575   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
576
577   PORT_START("DSW2")
578   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
579   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
581   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
582   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
583   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
584   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
585   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
586   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
587   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
588   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
589   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
590   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
591   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
592   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
593   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
594   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
595   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
596   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
597   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
598   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
599   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
600   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
601   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
602
603   PORT_START("DSW3")
604   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
605   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
606   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
607   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
608   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
609   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
610   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
611   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
612   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
613   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
614   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
615   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
616   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
617   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
619   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
620   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
621   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
622   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
623   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
624   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
625   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
626   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
627   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
628
629   PORT_START("DSW4")
630   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
631   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
632   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
633   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
634   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
635   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
636   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
637   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
638   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
639   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
640   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
641   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
642   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
643   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
644   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
645   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
646   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
647   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
648   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
649   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
650   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
651   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
652   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
653   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
654
655   PORT_START("DSW5")
656   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
657   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
658   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
659   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
660   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
661   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
662   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
663   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
664   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
665   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
666   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
667   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
668   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
669   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
670   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
671   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
672   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
673   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
674   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
675   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
676   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
677   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
678   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
679   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
680INPUT_PORTS_END
681
682static INPUT_PORTS_START( ncb3 )
683   PORT_START("IN0")
684   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
685   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
686   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Stop 2 / Double-Up") PORT_CODE(KEYCODE_X)
687   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Blue Bet / Card 3")  PORT_CODE(KEYCODE_B)
688   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Stop 1")             PORT_CODE(KEYCODE_Z)
689   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Red Bet / Card 2")   PORT_CODE(KEYCODE_V)
690   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Stop 3 / Info / Card 1")    PORT_CODE(KEYCODE_C)
691   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Start / Stop All / Card 4") PORT_CODE(KEYCODE_N)
692
693   PORT_START("IN1")
694   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
695   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
696   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1)    PORT_IMPULSE(2)   // Coin1?
697   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
698   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2)    PORT_IMPULSE(2)   // Coin2?
699   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3)    PORT_IMPULSE(2)   // Coin3?
700   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In") PORT_CODE(KEYCODE_Q)
701   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4)    PORT_IMPULSE(2)   // Coin4?
702
703   PORT_START("IN2")
704   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
705   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
706   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
707   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
708   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out / Attendant") PORT_CODE(KEYCODE_W)
709   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
710   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Settings") PORT_CODE(KEYCODE_9)
711   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats")    PORT_CODE(KEYCODE_0)
712
713   PORT_START("DSW1")
714   PORT_DIPNAME( 0x07, 0x04, "Main Game %" )
715   PORT_DIPSETTING(    0x00, "55%" )
716   PORT_DIPSETTING(    0x01, "60%" )
717   PORT_DIPSETTING(    0x02, "65%" )
718   PORT_DIPSETTING(    0x03, "70%" )
719   PORT_DIPSETTING(    0x04, "75%" )
720   PORT_DIPSETTING(    0x05, "80%" )
721   PORT_DIPSETTING(    0x06, "85%" )
722   PORT_DIPSETTING(    0x07, "90%" )
723   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
724   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
725   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
726   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
727   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
728   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
729   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
730   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
731   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
732   PORT_DIPNAME( 0x40, 0x00, "Key-In Type" )
733   PORT_DIPSETTING(    0x40, "B-Type" )
734   PORT_DIPSETTING(    0x00, "A-Type" )
735   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
736   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
737   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
738
739   PORT_START("DSW2")
740   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
741   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
742   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
743   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
744   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
745   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
746   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
747   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
748   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
749   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
750   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
751   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
752   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
753   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
754   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
755   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
756   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
757   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
758   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
759   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
760   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
761   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
762   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
763   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
764
765   PORT_START("DSW3")
766   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
767   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
768   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
769   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
770   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
771   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
772   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
773   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
774   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
775   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
776   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
777   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
778   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
779   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
780   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
781   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
782   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
783   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
784   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
785   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
786   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
787   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
788   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
789   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
790
791   PORT_START("DSW4")
792   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
793   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
794   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
795   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
796   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
797   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
798   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
799   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
800   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
801   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
802   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
803   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
804   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
805   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
806   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
807   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
808   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
809   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
810   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
811   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
812   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
813   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
814   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
815   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
816
817   PORT_START("DSW5")
818   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
819   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
820   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
821   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
822   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
823   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
824   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
825   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
826   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
827   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
828   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
829   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
830   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
831   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
832   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
833   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
834   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
835   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
836   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
837   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
838   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
839   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
840   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
841   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
842INPUT_PORTS_END
843
844
845
469846static const gfx_layout charlayout =
470847{
471848   8,8,    /* 8*8 characters */
r3957r3958
560937   32*8
561938};
562939
940static const gfx_layout tiles8x32x5_layout =
941{
942   8,32,
943   RGN_FRAC(1,5),
944   5,
945   { RGN_FRAC(0,5), RGN_FRAC(1,5), RGN_FRAC(2,5), RGN_FRAC(3,5), RGN_FRAC(4,5) },
946   { 0, 1, 2, 3, 4, 5, 6, 7 },
947   { 0*8, 1*8,  2*8,  3*8,  4*8,  5*8,  6*8,  7*8,
948     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
949    16*8,17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
950     24*8,25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8
951   },
952   32*8
953};
563954
564
565
566955static GFXDECODE_START( goldstar )
567956   GFXDECODE_ENTRY( "gfx1", 0, charlayout,   0, 16 )
568957   GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 128,  8 )
569958GFXDECODE_END
959
570960static GFXDECODE_START( bl )
571961   GFXDECODE_ENTRY( "gfx1", 0, charlayout,   0, 16 )
572962   GFXDECODE_ENTRY( "gfx2", 0, tilelayoutbl, 128,  8 )
573963GFXDECODE_END
964
574965static GFXDECODE_START( ml )
575966   GFXDECODE_ENTRY( "gfx1", 0, charlayout,   0, 16 )
576967   GFXDECODE_ENTRY( "gfx2", 0x18000, tilelayout, 128,  8 )
r3957r3958
586977   GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x4_layout, 128+64, 4 )
587978GFXDECODE_END
588979
980static GFXDECODE_START( cmasterb )
981   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x3_layout, 0, 16 )
982   GFXDECODE_ENTRY( "gfx2", 0, tiles8x32x5_layout, 0, 4 )
983GFXDECODE_END
984
985
986/*************************************
987*      PPI 8255 (x3) Interfaces      *
988*************************************/
989
990static const ppi8255_interface ppi8255_intf[4] =
991{
992   {   /* A, B & C set as input */
993      DEVICE8_PORT("IN0"),   /* Port A read, IN0 */
994      NULL,               /* Port B read, IN1 */
995      NULL,               /* Port C read */
996      NULL,               /* Port A write */
997      NULL,               /* Port B write */
998      NULL               /* Port C write */
999   },
1000   {   /* A, B & C set as input */
1001      DEVICE8_PORT("IN1"),   /* Port A read, IN2 */
1002      DEVICE8_PORT("IN2"),   /* Port B read, IN3 */
1003      NULL,               /* Port C read */
1004      NULL,               /* Port A write */
1005      NULL,               /* Port B write */
1006      NULL               /* Port C write */
1007   },
1008   {   /* A set as input */
1009      DEVICE8_PORT("DSW1"),   /* Port A read, DSW4 */
1010      NULL,               /* Port B read */
1011      NULL,               /* Port C read */
1012      NULL,               /* Port A write */
1013      NULL,               /* Port B write */
1014      NULL               /* Port C write */
1015   }
1016};
1017
5891018static const ay8910_interface ay8910_config =
5901019{
5911020   AY8910_LEGACY_OUTPUT,
r3957r3958
7011130   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum
7021131MACHINE_DRIVER_END
7031132
1133static PALETTE_INIT(cm)
1134{
1135   int i;
1136   for (i=0;i<0x100;i++)
1137   {
1138      int r,g,b;
1139      UINT8 dat;
7041140
1141      UINT8*proms = memory_region(machine, "proms");
7051142
706static MACHINE_DRIVER_START( chry10 )
1143      dat = proms[0x000+i] | (proms[0x100+i]<<4);
7071144
1145      r = (dat & 0x07) << 5;
1146      g = (dat & 0x38) << 2;
1147      b = (dat & 0xc0) << 0;
1148
1149      palette_set_color(machine, i, MAKE_RGB(r, g, b));
1150
1151   }
1152}
1153
1154static MACHINE_DRIVER_START( chryigld )
1155
7081156   /* basic machine hardware */
7091157   MDRV_CPU_ADD("main", Z80, 3579545)//(4000000?)
710   MDRV_CPU_PROGRAM_MAP(goldstar_map,0)
711   MDRV_CPU_IO_MAP(goldstar_readport,0)
1158   MDRV_CPU_PROGRAM_MAP(ncb3_map,0)
1159   MDRV_CPU_IO_MAP(ncb3_readwriteport,0)
7121160   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
7131161
1162   /* 3x 8255 */
1163   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
1164   MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
1165   MDRV_PPI8255_ADD( "ppi8255_2", ppi8255_intf[2] )
1166
7141167   /* video hardware */
7151168   MDRV_SCREEN_ADD("main", RASTER)
7161169   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
7211174
7221175   MDRV_GFXDECODE(chry10)
7231176   MDRV_PALETTE_LENGTH(256)
1177   MDRV_PALETTE_INIT(cm)
7241178   MDRV_NVRAM_HANDLER(goldstar)
7251179
7261180   MDRV_VIDEO_START(goldstar)
7271181   MDRV_VIDEO_UPDATE(goldstar)
7281182
7291183   /* sound hardware */
730   MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono'
731   MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz
732   MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface
733   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum
1184   MDRV_SPEAKER_STANDARD_MONO("mono")
7341185
735   MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock
736   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified //"oki"
737   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum
1186   MDRV_SOUND_ADD("sn1", SN76489, 3000000)   /* 3 MHz. */
1187   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1188
1189   MDRV_SOUND_ADD("ay", AY8910,1500000)
1190   MDRV_SOUND_CONFIG(ay8910_config)
1191   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
7381192MACHINE_DRIVER_END
7391193
7401194
r3957r3958
7451199   /* basic machine hardware */
7461200   MDRV_CPU_ADD("main", Z80, 3579545)//(4000000?)
7471201   MDRV_CPU_PROGRAM_MAP(ncb3_map,0)
748   MDRV_CPU_IO_MAP(goldstar_readport,0)
1202   MDRV_CPU_IO_MAP(ncb3_readwriteport,0)
7491203   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
7501204
1205   /* 3x 8255 */
1206   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
1207   MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
1208   MDRV_PPI8255_ADD( "ppi8255_2", ppi8255_intf[2] )
1209
7511210   /* video hardware */
7521211   MDRV_SCREEN_ADD("main", RASTER)
7531212   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
7581217
7591218   MDRV_GFXDECODE(ncb3)
7601219   MDRV_PALETTE_LENGTH(256)
1220//  MDRV_PALETTE_INIT(cm)
1221
7611222   MDRV_NVRAM_HANDLER(goldstar)
7621223
7631224   MDRV_VIDEO_START(goldstar)
r3957r3958
7651226
7661227   /* sound hardware */
7671228   MDRV_SPEAKER_STANDARD_MONO("mono")
1229
1230   MDRV_SOUND_ADD("sn1", SN76489, 3000000)   /* 3 MHz. */
1231   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
1232
7681233   MDRV_SOUND_ADD("ay", AY8910,1500000)
7691234   MDRV_SOUND_CONFIG(ay8910_config)
7701235   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
7711236MACHINE_DRIVER_END
7721237
773// wrong
774static PALETTE_INIT(cm)
775{
776   int i;
777   for (i=0;i<0x100;i++)
778   {
779      int r,g,b;
780      UINT8 dat;
7811238
782      UINT8*proms = memory_region(machine, "proms");
1239static MACHINE_DRIVER_START( cm )
7831240
784      dat = proms[0x000+i] | (proms[0x100+i]<<4);
1241   /* basic machine hardware */
1242   MDRV_CPU_ADD("main", Z80, 3579545)//(4000000?)
1243   MDRV_CPU_PROGRAM_MAP(cm_map,0)
1244   MDRV_CPU_IO_MAP(cm_portmap,0)
1245   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
7851246
786      r = (dat & 0x07) << 5;
787      g = (dat & 0x38) << 2;
788      b = (dat & 0xc0) << 0;
1247   /* video hardware */
1248   MDRV_SCREEN_ADD("main", RASTER)
1249   MDRV_SCREEN_REFRESH_RATE(60)
1250//  MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
1251   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1252   MDRV_SCREEN_SIZE(64*8, 32*8)
1253   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
7891254
790      palette_set_color(machine, i, MAKE_RGB(r, g, b));
1255   MDRV_GFXDECODE(ncb3)
1256   MDRV_PALETTE_LENGTH(256)
1257   MDRV_PALETTE_INIT(cm)
1258//  MDRV_NVRAM_HANDLER(goldstar)
7911259
792   }
793}
794static MACHINE_DRIVER_START( cm )
1260   MDRV_VIDEO_START(cherrym)
1261   MDRV_VIDEO_UPDATE(goldstar)
7951262
1263   /* sound hardware */
1264   MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono'
1265   MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz
1266   MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface
1267   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum
1268
1269   MDRV_SOUND_ADD("oki", OKIM6295, 1056000)//clock
1270   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified //"oki"
1271   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)//all sound goes to the 'mono' speaker, at 1.0 X maximum
1272MACHINE_DRIVER_END
1273
1274static MACHINE_DRIVER_START( cmb )
1275
7961276   /* basic machine hardware */
7971277   MDRV_CPU_ADD("main", Z80, 3579545)//(4000000?)
7981278   MDRV_CPU_PROGRAM_MAP(cm_map,0)
r3957r3958
8071287   MDRV_SCREEN_SIZE(64*8, 32*8)
8081288   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
8091289
810   MDRV_GFXDECODE(ncb3)
1290   MDRV_GFXDECODE(cmasterb)
8111291   MDRV_PALETTE_LENGTH(256)
8121292   MDRV_PALETTE_INIT(cm)
8131293//  MDRV_NVRAM_HANDLER(goldstar)
8141294
815   MDRV_VIDEO_START(goldstar)
816   MDRV_VIDEO_UPDATE(cherrym)
1295   MDRV_VIDEO_START(cherrym)
1296   MDRV_VIDEO_UPDATE(goldstar)
8171297
8181298   /* sound hardware */
8191299   MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono'
r3957r3958
8271307MACHINE_DRIVER_END
8281308
8291309
1310static MACHINE_DRIVER_START( lucky8 )
1311
1312   /* basic machine hardware */
1313   MDRV_CPU_ADD("main", Z80, 12000000/3) // ?? Mhz
1314   MDRV_CPU_PROGRAM_MAP(lucky8_map,0)
1315   //MDRV_CPU_IO_MAP(goldstar_readport,0)
1316   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
1317
1318   /* video hardware */
1319   MDRV_SCREEN_ADD("main", RASTER)
1320   MDRV_SCREEN_REFRESH_RATE(60)
1321//  MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
1322   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1323   MDRV_SCREEN_SIZE(64*8, 32*8)
1324   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
1325
1326   MDRV_GFXDECODE(ncb3)
1327   MDRV_PALETTE_LENGTH(256)
1328   MDRV_NVRAM_HANDLER(goldstar)
1329
1330   MDRV_VIDEO_START(goldstar)
1331   MDRV_VIDEO_UPDATE(goldstar)
1332
1333   /* sound hardware */
1334   MDRV_SPEAKER_STANDARD_MONO("mono")//set up a standard mono speaker called 'mono'
1335   MDRV_SOUND_ADD("ay", AY8910,1500000)//1 AY8910, at clock 150000Hz
1336   MDRV_SOUND_CONFIG(ay8910_config)//read extra data from interface
1337   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)//all sound goes to the 'mono' speaker, at 0.50 X maximum
1338MACHINE_DRIVER_END
1339
1340
1341
8301342/***************************************************************************
8311343
8321344  Game driver(s)
r3957r3958
89114031x ispLSI1024-60LJ (pl3)(read protected)
89214043x PALCE16V8H (pl4,pl6,pl7)(read protected)
89314051x PEEL22CV10 (pl5)(read protected)
1406
8941407Note
8951408
89614091x 36x2 edge connector
r3957r3958
9501463   ROM_REGION( 0x08000, "gfx2", ROMREGION_DISPOSE )
9511464   ROM_LOAD( "1.u3",      0x00000, 0x08000, CRC(32b46e5c) SHA1(49e59589188324e15ec2b8157839423faea9833f) )
9521465
953   ROM_REGION( 0x0200, "prom", ROMREGION_DISPOSE )
1466   ROM_REGION( 0x0200, "proms", ROMREGION_DISPOSE )
9541467   ROM_LOAD( "82s147.u2",      0x00000, 0x0200, CRC(5c8f2b8f) SHA1(67d2121e75813dd85d83858c5fc5ec6ad9cc2a7d) )
9551468
9561469   ROM_REGION( 0x02e5, "palgal", ROMREGION_DISPOSE )
r3957r3958
9601473   ROM_LOAD( "gal22v10b.pl5.bad.dump",     0x00000, 0x02e5, BAD_DUMP CRC(996854bc) SHA1(647d2f49b739f7ca55c0b85290b6a21256834fd8) )
9611474   ROM_LOAD( "palce16v8h.pl6.bad.dump",    0x00000, 0x0117, BAD_DUMP CRC(7e3d99d8) SHA1(983e10eba11e4aeab5103ae644a8e6181d9b27a9) )
9621475   ROM_LOAD( "palce16v8h.pl7.bad.dump",    0x00000, 0x0117, BAD_DUMP CRC(c89d2f52) SHA1(f9d52d9c42ef95b7b85bbf6d09888ebdeac11fd3) )
963
964   ROM_REGION( 0x20000, "oki", ROMREGION_ERASE00 )
965   /* no oki on this pcb .. */
9661476ROM_END
9671477
9681478
r3957r3958
9771487   ROM_REGION( 0x08000, "gfx2", ROMREGION_DISPOSE )
9781488   ROM_LOAD( "1.u3",      0x00000, 0x08000, CRC(32b46e5c) SHA1(49e59589188324e15ec2b8157839423faea9833f) )
9791489
980   ROM_REGION( 0x0200, "prom", ROMREGION_DISPOSE )
1490   ROM_REGION( 0x0200, "proms", ROMREGION_DISPOSE )
9811491   ROM_LOAD( "82s147.u2",      0x00000, 0x0200, CRC(5c8f2b8f) SHA1(67d2121e75813dd85d83858c5fc5ec6ad9cc2a7d) )
9821492
9831493   ROM_REGION( 0x02dd, "palgal", ROMREGION_DISPOSE )
r3957r3958
9871497   ROM_LOAD( "peel22cv10a.pl5.bad.dump",0x00000, 0x02dd, BAD_DUMP CRC(8e6075d9) SHA1(f2c1b6497a4d9e873d36b89771c135a2cd91d05f) )
9881498   ROM_LOAD( "palce16v8h.pl6.bad.dump", 0x00000, 0x0117, BAD_DUMP CRC(7e3d99d8) SHA1(983e10eba11e4aeab5103ae644a8e6181d9b27a9) )
9891499   ROM_LOAD( "palce16v8h.pl7.bad.dump", 0x00000, 0x0117, BAD_DUMP CRC(c89d2f52) SHA1(f9d52d9c42ef95b7b85bbf6d09888ebdeac11fd3) )
990
991   ROM_REGION( 0x20000, "oki", ROMREGION_ERASE00 )
992   /* no oki on this pcb .. */
9931500ROM_END
9941501
9951502
996
9971503ROM_START( moonlght )
9981504   ROM_REGION( 0x20000, "main", 0 )
9991505   ROM_LOAD( "4.bin",       0x0000, 0x20000, CRC(ecb06cfb) SHA1(e32613cac5583a0fecf04fca98796b91698e530c) )
r3957r3958
10091515ROM_END
10101516
10111517
1518
10121519ROM_START( ncb3 )
10131520   ROM_REGION( 0x10000, "main", 0 )
10141521   ROM_LOAD( "8.512", 0x00000, 0x10000, CRC(1f669cd0) SHA1(fd394119e33c017507fde87a710577e37dcdec07) )
r3957r3958
10251532   ROM_LOAD( "6.764", 0x04000, 0x02000, CRC(e73ea4e3) SHA1(c9fd56461f6986d6bc170403d298fcc408a524e9) )
10261533   ROM_LOAD( "7.764", 0x06000, 0x02000, CRC(7cc6d26b) SHA1(de33e8985affce7bd3ead89463117c9aaa93d5e4) )
10271534
1028   ROM_REGION( 0x0200, "prom", ROMREGION_DISPOSE )
1029   /* prom missing? */
1535   ROM_REGION( 0x0200, "proms", ROMREGION_DISPOSE )
1536   ROM_LOAD( "colour_proms", 0x000, 0x200, NO_DUMP )
10301537
10311538   ROM_REGION( 0x20000, "oki", ROMREGION_ERASE00 )
10321539   /* no oki on this pcb? */
r3957r3958
10611568   ROM_LOAD( "6.764", 0x04000, 0x02000, CRC(e73ea4e3) SHA1(c9fd56461f6986d6bc170403d298fcc408a524e9) )
10621569   ROM_LOAD( "7.764", 0x06000, 0x02000, CRC(7cc6d26b) SHA1(de33e8985affce7bd3ead89463117c9aaa93d5e4) )
10631570
1064   ROM_REGION( 0x0200, "prom", ROMREGION_DISPOSE )
1065   /* prom missing? */
1571   ROM_REGION( 0x0200, "proms", ROMREGION_DISPOSE )
1572   ROM_LOAD( "colour_proms", 0x000, 0x200, NO_DUMP )
10661573
10671574   ROM_REGION( 0x20000, "oki", ROMREGION_ERASE00 )
10681575   /* no oki on this pcb? */
r3957r3958
10801587   ROM_LOAD( "m7.256",   0x10000, 0x8000, CRC(e39fff9c) SHA1(22fdc517fa478441622c6245cecb5728c5595757) )
10811588
10821589   ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE )
1083   ROM_LOAD( "m1.64",     0x0000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) )
1084   ROM_LOAD( "m2.64",     0x2000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) )
1085   ROM_LOAD( "m3.64",     0x4000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) )
1086   ROM_LOAD( "m4.64",      0x6000, 0x2000, CRC(c32367be) SHA1(ff217021b9c58e23b2226f8b0a7f5da966225715) )
1590   ROM_LOAD( "m3.64",     0x0000, 0x2000, CRC(8607ffd9) SHA1(9bc94715554aa2473ae2ed249a47f29c7886b3dc) )
1591   ROM_LOAD( "m4.64",      0x2000, 0x2000, CRC(c32367be) SHA1(ff217021b9c58e23b2226f8b0a7f5da966225715) )
1592   ROM_LOAD( "m1.64",     0x4000, 0x2000, CRC(6dfcb188) SHA1(22430429c798954d9d979e62699b58feae7fdbf4) )
1593   ROM_LOAD( "m2.64",     0x6000, 0x2000, CRC(9678ead2) SHA1(e80aefa98b2363fe9e6b2415762695ace272e4d3) )
10871594
10881595   ROM_REGION( 0x200, "proms", 0 ) // pal
10891596   ROM_LOAD( "prom2.287", 0x0000, 0x0100, CRC(0489b760) SHA1(78f8632b17a76335183c5c204cdec856988368b0) )
r3957r3958
11191626   ROM_LOAD( "p4.bin", 0x0300, 0x0100, CRC(72212427) SHA1(e87a91f28284313c706ebb8175a3586780636e31) )
11201627ROM_END
11211628
1629ROM_START( cmasterb )
1630   ROM_REGION( 0x10000, "main", 0 )
1631   ROM_LOAD( "3.bin",   0x00000, 0x10000, CRC(ccb64229) SHA1(532f4b59952702a3609ff20239acbbacaf71f38f) )
11221632
1633   ROM_REGION( 0x30000, "gfx1", ROMREGION_DISPOSE )
1634   ROM_LOAD( "6.bin",   0x00000, 0x10000, CRC(a98d610f) SHA1(d14b3bc8bd6dc9fe2d3fb05ec08224b1a9d52bee) )
1635   ROM_LOAD( "7.bin",   0x10000, 0x10000, CRC(a0ffd2d6) SHA1(e78d20d3ab578ccc880bc19678782cb1f8d3671e) )
1636   ROM_LOAD( "8.bin",   0x20000, 0x10000, CRC(4f67fca7) SHA1(808e84b9b1f67f137528bb76b0e8aac3dceba20c) )
11231637
1638   ROM_REGION( 0x50000, "gfx2", ROMREGION_DISPOSE )
1639   ROM_LOAD( "9.bin",   0x00000, 0x10000, CRC(e92443d3) SHA1(4b6ca4521841610054165f085ae05510e77af191) )
1640   ROM_LOAD( "1.bin",   0x10000, 0x10000, CRC(634fe2ad) SHA1(2284a09446c8928060270861d372a19c0c9d827a) )
1641   ROM_LOAD( "2.bin",   0x20000, 0x10000, CRC(a3d59f79) SHA1(588c45550cca673390a35af9617c68c853ff84ba) )
1642   ROM_LOAD( "4.bin",   0x30000, 0x10000, CRC(52240e0f) SHA1(7b8375e1f91fdff2b4ccc2e81fbcf843f7ede292) )
1643   ROM_LOAD( "5.bin",    0x40000, 0x10000, CRC(763973c1) SHA1(b364f22041f1d678332554edb3c718cf0ad778b4) )
1644
1645   ROM_REGION( 0x400, "proms", 0 )   // from cmaster
1646   ROM_LOAD( "p1.bin", 0x0000, 0x0100, CRC(ac529f04) SHA1(5bc92e50c85bb23e609172cc15c430ddea7fdcb5) )
1647   ROM_LOAD( "p2.bin", 0x0100, 0x0100, CRC(3febce95) SHA1(c7c0fec0fb024ebf7d7365a09d28ba3d0037b0b4) )
1648   ROM_LOAD( "p3.bin", 0x0200, 0x0100, CRC(99dbdf19) SHA1(3680335406f63289f8d9a81b4cd163e4aa0c14d4) )
1649   ROM_LOAD( "p4.bin", 0x0300, 0x0100, CRC(72212427) SHA1(e87a91f28284313c706ebb8175a3586780636e31) )
1650ROM_END
1651
1652/*
1653
1654        Lucky 8 Line
1655        Falcon 1989
1656
1657        G14           6116  9
1658        G13   D13           8
1659              D12
1660        6116                 Z80
1661        6116                 8255
1662        7                    8255
1663        6            SW1     8255
1664 12MHz  5            SW2     8910
1665        4  6116      SW4
1666        3  6116      SW3
1667        2  6116
1668        1  6116
1669
1670    ---
1671
1672*/
1673
1674ROM_START( lucky8 )
1675   ROM_REGION( 0x8000, "main", 0 )
1676   ROM_LOAD( "8",    0x0000, 0x4000, CRC(a187573e) SHA1(864627502025dbc83a0049fc98505655cec7b181) )
1677   ROM_LOAD( "9",   0x4000, 0x4000, CRC(6f62672e) SHA1(05662ef1a70f93b09e48de497b049a282f070735) )
1678
1679   ROM_REGION( 0x18000, "gfx1", ROMREGION_DISPOSE )
1680   ROM_LOAD( "5",  0x00000, 0x8000, CRC(59026af3) SHA1(3d7f7e78968ca26275635aeaa0e994468a3da575) )
1681   ROM_LOAD( "6",  0x08000, 0x8000, CRC(67a073c1) SHA1(36194d57d0dc0601fa1fdf2e6806f11b2ea6da36) )
1682   ROM_LOAD( "7",  0x10000, 0x8000, CRC(c415b9d0) SHA1(fd558fe8a116c33bbd712a639224d041447a45c1) )
1683
1684   ROM_REGION( 0x8000, "gfx2", ROMREGION_DISPOSE )
1685   ROM_LOAD( "3",   0x0000, 0x2000, CRC(898b9ed5) SHA1(11b7d1cfcf425d00d086c74e0dbcb72068dda9fe) )
1686   ROM_LOAD( "4",   0x2000, 0x2000, CRC(4f7cfb35) SHA1(0617cf4419be00d9bacc78724089cb8af4104d68) )
1687   ROM_LOAD( "1",   0x4000, 0x2000, CRC(29d6f197) SHA1(1542ca457594f6b7fe8f28f7d78023edd7021bc8) )
1688   ROM_LOAD( "2",   0x6000, 0x2000, CRC(5f812e65) SHA1(70d9ea82f9337936bf21f82b6961768d436f3a6f) )
1689
1690   ROM_REGION( 0x200, "proms", 0 )
1691   ROM_LOAD( "d12", 0x0100, 0x0100, CRC(23e81049) SHA1(78071dae70fad870e972d944642fb3a2374be5e4) )
1692   ROM_LOAD( "g14", 0x0000, 0x0100, CRC(bd48de71) SHA1(e4fa1e774af1499bc568be5b2deabb859d8c8172) )
1693
1694   ROM_REGION( 0x40, "proms2", 0 )
1695   ROM_LOAD( "d13", 0x0000, 0x0020, CRC(c6b41352) SHA1(d7c3b5aa32e4e456c9432a13bede1db6d62eb270) )
1696   ROM_LOAD( "g13", 0x0020, 0x0020, CRC(6df3f972) SHA1(0096a7f7452b70cac6c0752cb62e24b643015b5c) )
1697ROM_END
1698
1699
11241700static DRIVER_INIT(goldstar)
11251701{
11261702   int A;
r3957r3958
11521728      0x1800, 0x3000, 0x6800, 0x7000,
11531729      0x0000, 0x4800, 0x2000, 0x5000,
11541730      0x1000, 0x7800, 0x6000, 0x3800,
1155      /* bit below, I'm not sure, no match */
1731      /* bit below, I'm not sure, no exact match, but only the first ones matter? */
11561732      0xc000, 0xc800, 0xd000, 0xd800,
11571733      0xe000, 0xe800, 0xf000, 0xf800,
11581734      0x8000, 0x8800, 0x9000, 0x9800,
r3957r3958
11931769}
11941770
11951771
1196GAME( 199?, goldstar, 0,        goldstar, goldstar, goldstar, ROT0, "IGS", "Golden Star", 0 )
1197GAME( 199?, goldstbl, goldstar, goldstbl, goldstar, 0,        ROT0, "IGS", "Golden Star (Blue version)", 0 )
1198GAME( 199?, moonlght, goldstar, moonlght, goldstar, 0,        ROT0, "bootleg", "Moon Light (bootleg of Golden Star)", 0 )
1199GAME( 199?, chry10,  goldstar,  chry10,  goldstar, chry10,  ROT0, "bootleg", "Cherry 10 (bootleg of Golden Star)", GAME_NOT_WORKING )
1200GAME( 199?, chryigld, goldstar, chry10,  goldstar, chryigld,  ROT0, "bootleg", "Cherry I Gold (bootleg of Golden Star)", GAME_NOT_WORKING )
1772/*********************************************
1773*                Game Drivers                *
1774**********************************************
12011775
1776      YEAR  NAME      PARENT    MACHINE   INPUT     INIT      ROT    COMPANY       FULLNAME                                  FLAGS  */
1777GAME( 199?, goldstar, 0,        goldstar, goldstar, goldstar, ROT0, "IGS",         "Golden Star",                            0 )
1778GAME( 199?, goldstbl, goldstar, goldstbl, goldstar, 0,        ROT0, "IGS",         "Golden Star (Blue version)",             0 )
1779GAME( 199?, moonlght, goldstar, moonlght, goldstar, 0,        ROT0, "bootleg",     "Moon Light (bootleg of Golden Star)",    0 )
1780GAME( 199?, chryigld, goldstar, chryigld, chryigld, chryigld, ROT0, "bootleg",     "Cherry I Gold (bootleg of Golden Star)", 0 )
1781GAME( 199?, chry10,   goldstar, chryigld, goldstar, chry10,   ROT0, "bootleg",     "Cherry 10 (bootleg of Golden Star)",     GAME_NOT_WORKING )
1782
12021783// are these really dyna, or bootlegs?
1203GAME( 19??, ncb3,  goldstar,    ncb3, goldstar,  0, ROT0, "Dyna", "(New?) Cherry Bonus III", GAME_NOT_WORKING | GAME_NO_SOUND ) // set was labeled 'new cherry bonus 3' but there is no 'new' in the gfx roms
1204GAME( 19??, cb3,   goldstar,    ncb3, goldstar,  0, ROT0, "Dyna", "Cherry Bonus III", GAME_NOT_WORKING | GAME_NO_SOUND )
1784GAME( 19??, ncb3,     goldstar, ncb3,     ncb3,     0,        ROT0, "Dyna",        "Cherry Bonus III (Version 1.40)",        GAME_NOT_WORKING | GAME_WRONG_COLORS ) // set was labeled 'new cherry bonus 3' but there is no 'new' in the gfx roms
1785GAME( 19??, cb3,      goldstar, ncb3,     goldstar, 0,        ROT0, "Dyna",        "Cherry Bonus III",                       GAME_NOT_WORKING | GAME_WRONG_COLORS | GAME_NO_SOUND )
12051786
12061787// cherry master hardware has a rather different mem map, but is basically the same
1207GAME( 198?, cmv801, 0,   cm, cmv801, 0, ROT0, "Corsica", "Cherry Master (Corsica, v8.01)", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING ) // says ED-96 where the manufacturer is on some games..
1208GAME( 1991, cmaster, 0,   cm, cmv801, 0, ROT0, "Dyna", "Cherry Master 91?", GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING ) // different HW? closer to cherry master 2?
1788GAME( 198?, cmv801,   0,        cm,       cmv801,   0,        ROT0, "Corsica",     "Cherry Master (Corsica, v8.01)",         GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING ) // says ED-96 where the manufacturer is on some games..
1789GAME( 1991, cmaster,  0,        cm,       cmv801,   0,        ROT0, "Dyna",        "Cherry Master 91?",                      GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING ) // different HW? closer to cherry master 2?
1790GAME( 1991, cmasterb, cmaster,  cmb,      cmv801,   0,        ROT0, "Dyna",        "Cherry Master I (v1.01)",                 GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_NOT_WORKING )
1791GAME( 1989, lucky8,   0,        lucky8,   goldstar, 0,        ROT0, "Wing Co.Ltd", "New Lucky 8 Lines",                      GAME_NOT_WORKING )
src/mame/drivers/cybertnk.c
r3957r3958
170170*******************************************************************************************/
171171
172172#include "driver.h"
173#include "cpu/z80/z80.h"
174#include "cpu/m68000/m68000.h"
173175#include "deprecat.h"
174176#include "sound/3812intf.h"
175177
r3957r3958
572574   MDRV_CPU_ADD("audio", Z80,3579500)
573575   MDRV_CPU_PROGRAM_MAP(sound_mem,0)
574576
575   MDRV_INTERLEAVE(100)//arbitrary value,needed to get the communication to work
577   MDRV_QUANTUM_TIME(HZ(6000))//arbitrary value,needed to get the communication to work
576578
577579   /* video hardware */
578580   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gauntlet.c
r3957r3958
119119
120120
121121#include "driver.h"
122#include "cpu/m68000/m68000.h"
123#include "cpu/m6502/m6502.h"
122124#include "machine/atarigen.h"
123125#include "sound/5220intf.h"
124126#include "sound/2151intf.h"
r3957r3958
16281630{
16291631   UINT8 *rom = memory_region(machine, "main");
16301632   atarigen_eeprom_default = NULL;
1631   atarigen_slapstic_init(machine, 0, 0x038000, 0, slapstic);
1633   atarigen_slapstic_init(machine->cpu[0], 0x038000, 0, slapstic);
16321634
16331635   /* swap the top and bottom halves of the main CPU ROM images */
16341636   atarigen_swap_mem(rom + 0x000000, rom + 0x008000, 0x8000);
src/mame/drivers/ms32.c
r3957r3958
168168/********** BITS & PIECES **********/
169169
170170#include "driver.h"
171#include "cpu/z80/z80.h"
172#include "cpu/v60/v60.h"
171173#include "deprecat.h"
172174#include "sound/ymf271.h"
173175#include "includes/ms32.h"
r3957r3958
12141216   MDRV_CPU_ADD("audio", Z80, 4000000)
12151217   MDRV_CPU_PROGRAM_MAP(ms32_snd_readmem, ms32_snd_writemem)
12161218
1217   MDRV_INTERLEAVE(1000)
1219   MDRV_QUANTUM_TIME(HZ(60000))
12181220
12191221   MDRV_MACHINE_RESET(ms32)
12201222
src/mame/drivers/mpu4.c
r3957r3958
434434      memory_configure_bank(machine, 1, 0, 8, &rom[0x01000], 0x10000);
435435
436436      memory_set_bank(machine, 1,0);
437      cpu_reset(machine->cpu[0]);
437      device_reset(machine->cpu[0]);
438438   }
439439
440440}
src/mame/drivers/skylncr.c
r3957r3958
11/*************************************************************************************************************
22
3    Sky Lancer
3    Sky Lancer / Mad Zoo
44
5    preliminary driver by Luca Elia
5    Original preliminary driver by Luca Elia.
6    Additional Work: Roberto Fresca & David Haywood.
67
7    compare with carrera.c & cherrym2.c
88
9**************************************************************************************************************
10
11    Notes:
12
13    - Some of the tiles look badly scaled down, and others appear to have columns swapped.
14      This might actually be correct.
15
16    - Skylncr and madzoo can run with the same program roms, they're basically graphics swaps.
17
18    - To enter the Service Mode, press F2. All the game settings are there.
19      Change regular values using DIP switches, and jackpot value using STOP2 and STOP3.
20      To exit the mode, press START. You must reset the machine (F3) to update the changes.
21
22    - Press key 0 to navigate between statistics pages. Press START to exit the mode.
23
24
25    TODO:
26
27    - Hook the PPI 8255 devices and rework the I/O based on them.
28    - Proper M5M82C255 emulation.
29
30
931*************************************************************************************************************/
1032
33
34#define MASTER_CLOCK      XTAL_12MHz   /* confirmed */
35
1136#include "driver.h"
37#include "cpu/z80/z80.h"
1238#include "sound/ay8910.h"
1339
14static tilemap *tmap, *tmap2;
40static tilemap *tmap;
1541
1642static UINT8 *skylncr_videoram,*skylncr_colorram;
17static UINT8 *skylncr_videoram2,*skylncr_colorram2;
1843
44static UINT8* reeltiles_1_ram;
45static UINT8* reeltiles_2_ram;
46static UINT8* reeltiles_3_ram;
47static UINT8* reeltiles_4_ram;
48static UINT8* reeltileshigh_1_ram;
49static UINT8* reeltileshigh_2_ram;
50static UINT8* reeltileshigh_3_ram;
51static UINT8* reeltileshigh_4_ram;
52static tilemap *reel_1_tilemap;
53static tilemap *reel_2_tilemap;
54static tilemap *reel_3_tilemap;
55static tilemap *reel_4_tilemap;
56static UINT8* reelscroll1;
57static UINT8* reelscroll2;
58static UINT8* reelscroll3;
59static UINT8* reelscroll4;
60
61
1962static WRITE8_HANDLER( skylncr_videoram_w )
2063{
2164   skylncr_videoram[offset] = data;
r3957r3958
2871   tilemap_mark_tile_dirty(tmap, offset);
2972}
3073
74
3175static TILE_GET_INFO( get_tile_info )
3276{
3377   UINT16 code = skylncr_videoram[ tile_index ] + (skylncr_colorram[ tile_index ] << 8);
3478   SET_TILE_INFO(0, code, 0, TILE_FLIPYX( 0 ));
3579}
3680
37
38static WRITE8_HANDLER( skylncr_videoram2_w )
81static TILE_GET_INFO( get_reel_1_tile_info )
3982{
40   skylncr_videoram2[offset] = data;
41   tilemap_mark_tile_dirty(tmap2, offset);
83   UINT16 code = reeltiles_1_ram[ tile_index ] + (reeltileshigh_1_ram[ tile_index ] << 8);
84   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
4285}
4386
44static WRITE8_HANDLER( skylncr_colorram2_w )
87static TILE_GET_INFO( get_reel_2_tile_info )
4588{
46   skylncr_colorram2[offset] = data;
47   tilemap_mark_tile_dirty(tmap2, offset);
89   UINT16 code = reeltiles_2_ram[ tile_index ] + (reeltileshigh_2_ram[ tile_index ] << 8);
90   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
4891}
4992
50static TILE_GET_INFO( get_tile_info2 )
93static TILE_GET_INFO( get_reel_3_tile_info )
5194{
52   UINT16 code = skylncr_videoram2[ tile_index ] + (skylncr_colorram2[ tile_index ] << 8);
95   UINT16 code = reeltiles_3_ram[ tile_index ] + (reeltileshigh_3_ram[ tile_index ] << 8);
5396   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
5497}
5598
56#define TILES_PER_PAGE_X   (0x40)
57#define TILES_PER_PAGE_Y   (0x8)
58#define PAGES_PER_TMAP_X   (0x2)
59#define PAGES_PER_TMAP_Y   (0x2)
60
61static TILEMAP_MAPPER( skylncr_tilemap_scan_pages )
99static TILE_GET_INFO( get_reel_4_tile_info )
62100{
63   return   (col / TILES_PER_PAGE_X) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y +
64         (col % TILES_PER_PAGE_X) +
65
66         (row / TILES_PER_PAGE_Y) * TILES_PER_PAGE_X * TILES_PER_PAGE_Y * PAGES_PER_TMAP_X +
67         (row % TILES_PER_PAGE_Y) * TILES_PER_PAGE_X;
101   UINT16 code = reeltiles_4_ram[ tile_index ] + (reeltileshigh_4_ram[ tile_index ] << 8);
102   SET_TILE_INFO(1, code, 0, TILE_FLIPYX( 0 ));
68103}
69104
105
70106static VIDEO_START( skylncr )
71107{
72108
73109   tmap = tilemap_create(   machine, get_tile_info, tilemap_scan_rows,
74110                     8,8, 0x40,0x20   );
75111
76   tmap2 = tilemap_create(   machine, get_tile_info2, skylncr_tilemap_scan_pages,
77                     8,32,
78                     TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y );
112   reel_1_tilemap = tilemap_create(machine, get_reel_1_tile_info, tilemap_scan_rows, 8,32, 64,8 );
113   reel_2_tilemap = tilemap_create(machine, get_reel_2_tile_info, tilemap_scan_rows, 8,32, 64,8 );
114   reel_3_tilemap = tilemap_create(machine, get_reel_3_tile_info, tilemap_scan_rows, 8,32, 64,8 );
115   reel_4_tilemap = tilemap_create(machine, get_reel_4_tile_info, tilemap_scan_rows, 8,32, 64,8 );
79116
80   tilemap_set_transparent_pen(tmap,  0);
81   tilemap_set_transparent_pen(tmap2, 0);
117   tilemap_set_scroll_cols(reel_2_tilemap, 0x40);
118   tilemap_set_scroll_cols(reel_3_tilemap, 0x40);
119   tilemap_set_scroll_cols(reel_4_tilemap, 0x40);
120
121   tilemap_set_transparent_pen(reel_2_tilemap, 0);
122   tilemap_set_transparent_pen(reel_3_tilemap, 0);
123   tilemap_set_transparent_pen(reel_4_tilemap, 0);
124
125
126   tilemap_set_transparent_pen(tmap, 0);
82127}
83128
129// are these hardcoded, or registers?
130static const rectangle visible1 = { 0*8, (14+48)*8-1,  4*8,  (4+7)*8-1 };
131static const rectangle visible2 = { 0*8, (14+48)*8-1, 12*8, (12+7)*8-1 };
132static const rectangle visible3 = { 0*8, (14+48)*8-1, 20*8, (20+7)*8-1 };
133
134
84135static VIDEO_UPDATE( skylncr )
85136{
137   int i;
138
86139   bitmap_fill(bitmap,cliprect,0);
87   tilemap_draw(bitmap,cliprect, tmap2, 0, 0);
140   tilemap_draw(bitmap,cliprect, reel_1_tilemap, 0, 0);
141
142   for (i= 0;i < 64;i++)
143   {
144      tilemap_set_scrolly(reel_2_tilemap, i, reelscroll2[i]);
145      tilemap_set_scrolly(reel_3_tilemap, i, reelscroll3[i]);
146      tilemap_set_scrolly(reel_4_tilemap, i, reelscroll4[i]);
147   }
148
149   tilemap_draw(bitmap,&visible1,reel_2_tilemap,0,0);
150   tilemap_draw(bitmap,&visible2,reel_3_tilemap,0,0);
151   tilemap_draw(bitmap,&visible3,reel_4_tilemap,0,0);
152
153
88154   tilemap_draw(bitmap,cliprect, tmap, 0, 0);
89155   return 0;
90156}
91157
158WRITE8_HANDLER( reeltiles_1_w )
159{
160   reeltiles_1_ram[offset] = data;
161   tilemap_mark_tile_dirty(reel_1_tilemap, offset);
162}
163
164WRITE8_HANDLER( reeltiles_2_w )
165{
166   reeltiles_2_ram[offset] = data;
167   tilemap_mark_tile_dirty(reel_2_tilemap, offset);
168}
169
170WRITE8_HANDLER( reeltiles_3_w )
171{
172   reeltiles_3_ram[offset] = data;
173   tilemap_mark_tile_dirty(reel_3_tilemap, offset);
174}
175
176WRITE8_HANDLER( reeltiles_4_w )
177{
178   reeltiles_4_ram[offset] = data;
179   tilemap_mark_tile_dirty(reel_4_tilemap, offset);
180}
181
182WRITE8_HANDLER( reeltileshigh_1_w )
183{
184   reeltileshigh_1_ram[offset] = data;
185   tilemap_mark_tile_dirty(reel_1_tilemap, offset);
186}
187
188WRITE8_HANDLER( reeltileshigh_2_w )
189{
190   reeltileshigh_2_ram[offset] = data;
191   tilemap_mark_tile_dirty(reel_2_tilemap, offset);
192}
193
194WRITE8_HANDLER( reeltileshigh_3_w )
195{
196   reeltileshigh_3_ram[offset] = data;
197   tilemap_mark_tile_dirty(reel_3_tilemap, offset);
198}
199
200WRITE8_HANDLER( reeltileshigh_4_w )
201{
202   reeltileshigh_4_ram[offset] = data;
203   tilemap_mark_tile_dirty(reel_4_tilemap, offset);
204}
205
206
92207static READ8_HANDLER( ret_ff )
93208{
94209   return 0xff;
r3957r3958
146261   }
147262}
148263
264static WRITE8_HANDLER( reelscroll1_w )
265{
266   reelscroll1[offset] = data;
267}
268
269static WRITE8_HANDLER( reelscroll2_w )
270{
271   reelscroll2[offset] = data;
272}
273
274static WRITE8_HANDLER( reelscroll3_w )
275{
276   reelscroll3[offset] = data;
277}
278
279static WRITE8_HANDLER( reelscroll4_w )
280{
281   reelscroll4[offset] = data;
282}
283
284
149285static ADDRESS_MAP_START( mem_map_skylncr, ADDRESS_SPACE_PROGRAM, 8 )
150286   AM_RANGE(0x0000, 0x7fff) AM_ROM
151   AM_RANGE(0x8000, 0x87ff) AM_RAM
287   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
152288
153289   AM_RANGE(0x8800, 0x8fff) AM_READWRITE( SMH_RAM, skylncr_videoram_w ) AM_BASE( &skylncr_videoram )
154290   AM_RANGE(0x9000, 0x97ff) AM_READWRITE( SMH_RAM, skylncr_colorram_w ) AM_BASE( &skylncr_colorram )
155291
156   AM_RANGE(0x9800, 0x9fff) AM_READWRITE( SMH_RAM, skylncr_videoram2_w ) AM_BASE( &skylncr_videoram2 )
157   AM_RANGE(0xa000, 0xa7ff) AM_READWRITE( SMH_RAM, skylncr_colorram2_w ) AM_BASE( &skylncr_colorram2 )
292   AM_RANGE(0x9800, 0x99ff) AM_READWRITE( SMH_RAM, reeltiles_1_w ) AM_BASE( &reeltiles_1_ram )
293   AM_RANGE(0x9a00, 0x9bff) AM_READWRITE( SMH_RAM, reeltiles_2_w ) AM_BASE( &reeltiles_2_ram )
294   AM_RANGE(0x9c00, 0x9dff) AM_READWRITE( SMH_RAM, reeltiles_3_w ) AM_BASE( &reeltiles_3_ram )
295   AM_RANGE(0x9e00, 0x9fff) AM_READWRITE( SMH_RAM, reeltiles_4_w ) AM_BASE( &reeltiles_4_ram )
296   AM_RANGE(0xa000, 0xa1ff) AM_READWRITE( SMH_RAM, reeltileshigh_1_w ) AM_BASE( &reeltileshigh_1_ram )
297   AM_RANGE(0xa200, 0xa3ff) AM_READWRITE( SMH_RAM, reeltileshigh_2_w ) AM_BASE( &reeltileshigh_2_ram )
298   AM_RANGE(0xa400, 0xa5ff) AM_READWRITE( SMH_RAM, reeltileshigh_3_w ) AM_BASE( &reeltileshigh_3_ram )
299   AM_RANGE(0xa600, 0xa7ff) AM_READWRITE( SMH_RAM, reeltileshigh_4_w ) AM_BASE( &reeltileshigh_4_ram )
158300
159301   AM_RANGE(0xaa55, 0xaa55) AM_READ( ret_ff )
160302
161   AM_RANGE(0xb000, 0xb7ff) AM_RAM
303   AM_RANGE(0xb000, 0xb03f) AM_RAM AM_WRITE(reelscroll1_w) AM_BASE(&reelscroll1)
304   AM_RANGE(0xb040, 0xb07f) AM_RAM AM_WRITE(reelscroll1_w)
305   AM_RANGE(0xb080, 0xb0bf) AM_RAM AM_WRITE(reelscroll1_w)
306   AM_RANGE(0xb0c0, 0xb0ff) AM_RAM AM_WRITE(reelscroll1_w)
307   AM_RANGE(0xb100, 0xb13f) AM_RAM AM_WRITE(reelscroll1_w)
308   AM_RANGE(0xb140, 0xb17f) AM_RAM AM_WRITE(reelscroll1_w)
309   AM_RANGE(0xb180, 0xb1bf) AM_RAM AM_WRITE(reelscroll1_w)
310   AM_RANGE(0xb1c0, 0xb1ff) AM_RAM AM_WRITE(reelscroll1_w)
162311
312   AM_RANGE(0xb200, 0xb23f) AM_RAM AM_WRITE(reelscroll2_w) AM_BASE(&reelscroll2)
313   AM_RANGE(0xb240, 0xb27f) AM_RAM AM_WRITE(reelscroll2_w)
314   AM_RANGE(0xb280, 0xb2bf) AM_RAM AM_WRITE(reelscroll2_w)
315   AM_RANGE(0xb2c0, 0xb2ff) AM_RAM AM_WRITE(reelscroll2_w)
316   AM_RANGE(0xb300, 0xb33f) AM_RAM AM_WRITE(reelscroll2_w)
317   AM_RANGE(0xb340, 0xb37f) AM_RAM AM_WRITE(reelscroll2_w)
318   AM_RANGE(0xb380, 0xb3bf) AM_RAM AM_WRITE(reelscroll2_w)
319   AM_RANGE(0xb3c0, 0xb3ff) AM_RAM AM_WRITE(reelscroll2_w)
320
321   AM_RANGE(0xb400, 0xb43f) AM_RAM AM_WRITE(reelscroll3_w) AM_BASE(&reelscroll3)
322   AM_RANGE(0xb440, 0xb47f) AM_RAM AM_WRITE(reelscroll3_w)
323   AM_RANGE(0xb480, 0xb4bf) AM_RAM AM_WRITE(reelscroll3_w)
324   AM_RANGE(0xb4c0, 0xb4ff) AM_RAM AM_WRITE(reelscroll3_w)
325   AM_RANGE(0xb500, 0xb53f) AM_RAM AM_WRITE(reelscroll3_w)
326   AM_RANGE(0xb540, 0xb57f) AM_RAM AM_WRITE(reelscroll3_w)
327   AM_RANGE(0xb580, 0xb5bf) AM_RAM AM_WRITE(reelscroll3_w)
328   AM_RANGE(0xb5c0, 0xb5ff) AM_RAM AM_WRITE(reelscroll3_w)
329
330   AM_RANGE(0xb600, 0xb63f) AM_RAM AM_WRITE(reelscroll4_w) AM_BASE(&reelscroll4)
331   AM_RANGE(0xb640, 0xb67f) AM_RAM AM_WRITE(reelscroll4_w)
332   AM_RANGE(0xb680, 0xb6bf) AM_RAM AM_WRITE(reelscroll4_w)
333   AM_RANGE(0xb6c0, 0xb6ff) AM_RAM AM_WRITE(reelscroll4_w)
334   AM_RANGE(0xb700, 0xb73f) AM_RAM AM_WRITE(reelscroll4_w)
335   AM_RANGE(0xb740, 0xb77f) AM_RAM AM_WRITE(reelscroll4_w)
336   AM_RANGE(0xb780, 0xb7bf) AM_RAM AM_WRITE(reelscroll4_w)
337   AM_RANGE(0xb7c0, 0xb7ff) AM_RAM AM_WRITE(reelscroll4_w)
338
163339   AM_RANGE(0xc000, 0xffff) AM_ROM
164340ADDRESS_MAP_END
165341
r3957r3958
173349static ADDRESS_MAP_START( io_map_skylncr, ADDRESS_SPACE_IO, 8 )
174350   ADDRESS_MAP_GLOBAL_MASK(0xff)
175351
176   AM_RANGE(0x00, 0x00) AM_READ_PORT("SYSTEM")
177   AM_RANGE(0x01, 0x01) AM_READ_PORT("BUTTONS")
352   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN1")
353   AM_RANGE(0x01, 0x01) AM_READ_PORT("IN2")
178354   AM_RANGE(0x02, 0x02) AM_READ_PORT("DSW1")
179355   AM_RANGE(0x10, 0x10) AM_READ_PORT("DSW2")
180   AM_RANGE(0x11, 0x11) AM_READ_PORT("COIN1")
181   AM_RANGE(0x12, 0x12) AM_READ_PORT("COIN2")
356   AM_RANGE(0x11, 0x11) AM_READ_PORT("IN3")
357   AM_RANGE(0x12, 0x12) AM_READ_PORT("IN4")
182358
183359   AM_RANGE(0x20, 0x20) AM_WRITE( skylncr_coin_w )
184360
r3957r3958
214390   RGN_FRAC(1,2),
215391   8,
216392   { STEP8(0,1) },
217   { 8*0,8*4,8*1,8*5,8*2,8*6,8*3,8*7 },
218393   {
219    RGN_FRAC(1,2)+8*8*0, RGN_FRAC(0,2)+8*8*0,
220    RGN_FRAC(1,2)+8*8*1, RGN_FRAC(0,2)+8*8*1,
221    RGN_FRAC(1,2)+8*8*2, RGN_FRAC(0,2)+8*8*2,
222    RGN_FRAC(1,2)+8*8*3, RGN_FRAC(0,2)+8*8*3,
223    RGN_FRAC(1,2)+8*8*4, RGN_FRAC(0,2)+8*8*4,
224    RGN_FRAC(1,2)+8*8*5, RGN_FRAC(0,2)+8*8*5,
225    RGN_FRAC(1,2)+8*8*6, RGN_FRAC(0,2)+8*8*6,
226    RGN_FRAC(1,2)+8*8*7, RGN_FRAC(0,2)+8*8*7,
227    RGN_FRAC(1,2)+8*8*8, RGN_FRAC(0,2)+8*8*8,
228    RGN_FRAC(1,2)+8*8*9, RGN_FRAC(0,2)+8*8*9,
229    RGN_FRAC(1,2)+8*8*10,RGN_FRAC(0,2)+8*8*10,
230    RGN_FRAC(1,2)+8*8*11,RGN_FRAC(0,2)+8*8*11,
231    RGN_FRAC(1,2)+8*8*12,RGN_FRAC(0,2)+8*8*12,
232    RGN_FRAC(1,2)+8*8*13,RGN_FRAC(0,2)+8*8*13,
233    RGN_FRAC(1,2)+8*8*14,RGN_FRAC(0,2)+8*8*14,
234    RGN_FRAC(1,2)+8*8*15,RGN_FRAC(0,2)+8*8*15
235   },
236   8*16*8
237};
238
239static const gfx_layout layout8x32x8_rot =
240{
241   8,32,
242   RGN_FRAC(1,2),
243   8,
244   { STEP8(0,1) },
245   {
246394      8*0, 8*1,
247395      RGN_FRAC(1,2)+8*0, RGN_FRAC(1,2)+8*1,
248396      8*2, 8*3,
r3957r3958
255403   8*32*8/2
256404};
257405
258static const gfx_layout mz_layout8x8x8 =
406/* this will decode the big x2 x3 'correctly' however, maybe they're
407   simply not meant to appear correct? */
408static const gfx_layout layout8x32x8_rot =
259409{
260   8,8,
261   RGN_FRAC(1,2),
262   8,
263   { STEP8(0,1) },
264   {
265      8*0,8*1,
266      RGN_FRAC(1,2)+8*0,RGN_FRAC(1,2)+8*1,
267      8*2,8*3,
268      RGN_FRAC(1,2)+8*2,RGN_FRAC(1,2)+8*3
269   },
270   { STEP8(0,8*4) },
271   8*8*4
272};
273
274static const gfx_layout mz_layout8x32x8 =
275{
276410   8,32,
277411   RGN_FRAC(1,2),
278412   8,
279413   { STEP8(0,1) },
280   { 8*0,8*1,8*2,8*3,8*4,8*5,8*6,8*7 },
281414   {
282    RGN_FRAC(1,2)+8*8*0, RGN_FRAC(0,2)+8*8*0,
283    RGN_FRAC(1,2)+8*8*1, RGN_FRAC(0,2)+8*8*1,
284    RGN_FRAC(1,2)+8*8*2, RGN_FRAC(0,2)+8*8*2,
285    RGN_FRAC(1,2)+8*8*3, RGN_FRAC(0,2)+8*8*3,
286    RGN_FRAC(1,2)+8*8*4, RGN_FRAC(0,2)+8*8*4,
287    RGN_FRAC(1,2)+8*8*5, RGN_FRAC(0,2)+8*8*5,
288    RGN_FRAC(1,2)+8*8*6, RGN_FRAC(0,2)+8*8*6,
289    RGN_FRAC(1,2)+8*8*7, RGN_FRAC(0,2)+8*8*7,
290    RGN_FRAC(1,2)+8*8*8, RGN_FRAC(0,2)+8*8*8,
291    RGN_FRAC(1,2)+8*8*9, RGN_FRAC(0,2)+8*8*9,
292    RGN_FRAC(1,2)+8*8*10,RGN_FRAC(0,2)+8*8*10,
293    RGN_FRAC(1,2)+8*8*11,RGN_FRAC(0,2)+8*8*11,
294    RGN_FRAC(1,2)+8*8*12,RGN_FRAC(0,2)+8*8*12,
295    RGN_FRAC(1,2)+8*8*13,RGN_FRAC(0,2)+8*8*13,
296    RGN_FRAC(1,2)+8*8*14,RGN_FRAC(0,2)+8*8*14,
297    RGN_FRAC(1,2)+8*8*15,RGN_FRAC(0,2)+8*8*15
298   },
299   8*16*8
300};
301
302static const gfx_layout mz_layout8x32x8_rot =
303{
304   8,32,
305   RGN_FRAC(1,2),
306   8,
307   { STEP8(0,1) },
308   {
309415      8*0, 8*1,
310      RGN_FRAC(1,2)+8*0, RGN_FRAC(1,2)+8*1,
416      RGN_FRAC(1,2)+8*1, RGN_FRAC(1,2)+8*0,
311417      8*2, 8*3,
312      RGN_FRAC(1,2)+8*2, RGN_FRAC(1,2)+8*3
418      RGN_FRAC(1,2)+8*3, RGN_FRAC(1,2)+8*2
313419   },
314420   {
315421      STEP16(0,8*4),
r3957r3958
320426
321427static GFXDECODE_START( skylncr )
322428   GFXDECODE_ENTRY( "gfx1", 0, layout8x8x8,      0, 2 )
429   GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8,      0, 2 )
323430   GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8_rot,   0, 2 )
324   GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8,      0, 2 )
325431GFXDECODE_END
326432
327static GFXDECODE_START( madzoo )
328   GFXDECODE_ENTRY( "gfx1", 0, mz_layout8x8x8,         0, 2 )
329   GFXDECODE_ENTRY( "gfx2", 0, mz_layout8x32x8_rot,   0, 2 )
330   GFXDECODE_ENTRY( "gfx2", 0, mz_layout8x32x8,      0, 2 )
331GFXDECODE_END
332433
333434static INPUT_PORTS_START( skylncr )
334   PORT_START("SYSTEM")   /* $0 "PORT0 A" */
335   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1)
336   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2)
337   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START3)
338   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START4)
339   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1)
340   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2)
341   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3)
342   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4)
435   PORT_START("IN1")   /* $0 "PORT0 A" */
436   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6) PORT_NAME("Stop 2") PORT_CODE(KEYCODE_X)
437   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN)
438   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5) PORT_NAME("Stop 1") PORT_CODE(KEYCODE_Z)
439   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
440   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7) PORT_NAME("Stop 3") PORT_CODE(KEYCODE_C)
441   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
442   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN)
443   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
343444
344   PORT_START("BUTTONS")   /* $1 "PORT0 B" */
345   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1)
346   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2)
347   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3)
348   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4)
349   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2)   // skip test
350   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2)
351   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2)
352   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_PLAYER(2)
445   PORT_START("IN2")   /* $1 "PORT0 B" */
446   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("Bet")             PORT_CODE(KEYCODE_2)
447   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN)
448   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9) PORT_NAME("Option 2 (D-UP)") PORT_CODE(KEYCODE_S)
449   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
450   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("Start")           PORT_CODE(KEYCODE_1)
451   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
452   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN)
453   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
353454
455   PORT_START("IN3")   /* $11 "PORT1 B" */
456   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
457   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
458   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2)
459   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key In")          PORT_CODE(KEYCODE_Q)
460   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Option 1 (D-UP)") PORT_CODE(KEYCODE_A)
461   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("D-UP")            PORT_CODE(KEYCODE_3)
462   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
463   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Take Score")      PORT_CODE(KEYCODE_4)
464
465   PORT_START("IN4")   /* $12 "PORT1 C" */
466   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN)
467   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Reset")    PORT_CODE(KEYCODE_R)
468   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Stats")    PORT_CODE(KEYCODE_0)
469   PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )   /* Settings */
470   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN)
471   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN)
472   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN)
473   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Key Out")  PORT_CODE(KEYCODE_W)
474
354475   PORT_START("DSW1")   /* $2 "DSW1" */
355   PORT_DIPNAME( 0x01, 0x01, "DSW1" )
356   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
357   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
358   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
359   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
360   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
361   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
362   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
363   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
364   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
365   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
366   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
367   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
368   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
369   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
370   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
371   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
372   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
373   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
374   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
375   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
376   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
377   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
378   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
476   PORT_DIPNAME( 0x11, 0x01, "D-UP Percentage" )
477   PORT_DIPSETTING(    0x11, "60%" )
478   PORT_DIPSETTING(    0x01, "70%" )
479   PORT_DIPSETTING(    0x10, "80%" )
480   PORT_DIPSETTING(    0x00, "90%" )
481   PORT_DIPNAME( 0x0e, 0x0e, "Main Game Percentage" )
482   PORT_DIPSETTING(    0x0e, "75%" )
483   PORT_DIPSETTING(    0x0c, "78%" )
484   PORT_DIPSETTING(    0x0a, "81%" )
485   PORT_DIPSETTING(    0x08, "84%" )
486   PORT_DIPSETTING(    0x06, "87%" )
487   PORT_DIPSETTING(    0x04, "90%" )
488   PORT_DIPSETTING(    0x02, "93%" )
489   PORT_DIPSETTING(    0x00, "96%" )
490   PORT_DIPNAME( 0x20, 0x20, "Reels Speed" )
491   PORT_DIPSETTING(    0x20, "Slow" )
492   PORT_DIPSETTING(    0x00, "Fast" )
493   PORT_DIPNAME( 0x40, 0x40, "Bonus Score" )
494   PORT_DIPSETTING(    0x40, "32" )
495   PORT_DIPSETTING(    0x00, "24" )
496   PORT_DIPNAME( 0x80, 0x00, "Key Out" )
497   PORT_DIPSETTING(    0x80, "x100" )
498   PORT_DIPSETTING(    0x00, "x1" )
379499
380500   PORT_START("DSW2")   /* $10 "DSW2" */
381501   PORT_DIPNAME( 0x01, 0x01, "DSW2" )
r3957r3958
384504   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
385505   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
386506   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
387   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
388   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
389   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
390   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
391   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
392   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
393   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
394   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
395   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
507   PORT_DIPNAME( 0x04, 0x04, "Double-Up" )
508   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
509   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
510   PORT_DIPNAME( 0x18, 0x08, "Payout Limit" )
511   PORT_DIPSETTING(    0x00, "0" )
512   PORT_DIPSETTING(    0x08, "5000" )
513   PORT_DIPSETTING(    0x10, "2000" )
514   PORT_DIPSETTING(    0x18, "1000" )
396515   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
397516   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
398517   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
399   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
400   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
401   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
402   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
403   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
404   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
518   PORT_DIPNAME( 0xc0, 0xc0, "Clown Percentage" )
519   PORT_DIPSETTING(    0xc0, "60%" )
520   PORT_DIPSETTING(    0x80, "70%" )
521   PORT_DIPSETTING(    0x40, "80%" )
522   PORT_DIPSETTING(    0x00, "90%" )
405523
406   PORT_START("COIN1")   /* $11 "PORT1 B" */
407   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1   ) PORT_IMPULSE(5)
408   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
409   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
410   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
411   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
412   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
413   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
414   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
415
416   PORT_START("COIN2")   /* $12 "PORT1 C" */
417   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2)
418   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
419   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
420   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
421   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
422   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
423   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
424   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
425
426   PORT_START("DSW4")   /* AY8910 port A */
427   PORT_DIPNAME( 0x01, 0x01, "DSW4" )
428   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
429   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
430   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
431   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
432   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
433   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
434   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
435   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
524   PORT_START("DSW3")   /* AY8910 port A */
525   PORT_DIPNAME( 0x07, 0x07, "Coinage A, B & C" )
526   PORT_DIPSETTING(    0x00, "1 Coin / 1 Credit" )
527   PORT_DIPSETTING(    0x01, "1 Coin / 5 Credits" )
528   PORT_DIPSETTING(    0x02, "1 Coin / 10 Credits" )
529   PORT_DIPSETTING(    0x03, "1 Coin / 20 Credits" )
530   PORT_DIPSETTING(    0x04, "1 Coin / 30 Credits" )
531   PORT_DIPSETTING(    0x05, "1 Coin / 40 Credits" )
532   PORT_DIPSETTING(    0x06, "1 Coin / 50 Credits" )
533   PORT_DIPSETTING(    0x07, "1 Coin / 100 Credit" )
436534   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
437535   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
438536   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
439537   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
440538   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
441539   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
442   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
443   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
444   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
445   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
446   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
447   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
448   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
449   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
450   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
540   PORT_DIPNAME( 0x20, 0x20, "Max Win Bonus" )
541   PORT_DIPSETTING(    0x20, "10000" )
542   PORT_DIPSETTING(    0x00, "20000" )
543   PORT_DIPNAME( 0xc0, 0xc0, "Minimum Bet" )
544   PORT_DIPSETTING(    0xc0, "0" )
545   PORT_DIPSETTING(    0x80, "8" )
546   PORT_DIPSETTING(    0x40, "16" )
547   PORT_DIPSETTING(    0x00, "32" )
451548
452   PORT_START("DSW3")   /* AY8910 port B */
453   PORT_DIPNAME( 0x01, 0x01, "DSW3" )
454   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
455   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
456   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
457   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
458   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
459   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
460   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
461   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
462   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
463   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
464   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
465   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
466   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
467   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
549   PORT_START("DSW4")   /* AY8910 port B */
550   PORT_DIPNAME( 0x07, 0x07, "Remote Credits" )
551   PORT_DIPSETTING(    0x00, "1 Pulse / 100 Credits" )
552   PORT_DIPSETTING(    0x01, "1 Pulse / 110 Credits" )
553   PORT_DIPSETTING(    0x02, "1 Pulse / 120 Credits" )
554   PORT_DIPSETTING(    0x03, "1 Pulse / 130 Credits" )
555   PORT_DIPSETTING(    0x04, "1 Pulse / 200 Credits" )
556   PORT_DIPSETTING(    0x05, "1 Pulse / 400 Credits" )
557   PORT_DIPSETTING(    0x06, "1 Pulse / 500 Credits" )
558   PORT_DIPSETTING(    0x07, "1 Pulse / 1000 Credits" )
559   PORT_DIPNAME( 0x18, 0x00, "Max Bet" )
560   PORT_DIPSETTING(    0x18, "32" )
561   PORT_DIPSETTING(    0x10, "64" )
562   PORT_DIPSETTING(    0x08, "72" )
563   PORT_DIPSETTING(    0x00, "80" )
468564   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
469565   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
470566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r3957r3958
474570   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
475571   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
476572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
477
478573INPUT_PORTS_END
479574
575
480576static const ay8910_interface ay8910_config =
481577{
482578   AY8910_LEGACY_OUTPUT,
r3957r3958
497593static MACHINE_DRIVER_START( skylncr )
498594
499595   /* basic machine hardware */
500   MDRV_CPU_ADD("main", Z80, 12000000/4)
596   MDRV_CPU_ADD("main", Z80, MASTER_CLOCK/4)
501597   MDRV_CPU_PROGRAM_MAP(mem_map_skylncr,0)
502598   MDRV_CPU_IO_MAP(io_map_skylncr,0)
503599   MDRV_CPU_VBLANK_INT("main", skylncr_vblank_interrupt)
504600
601   MDRV_NVRAM_HANDLER(generic_0fill)
602
505603   /* video hardware */
506604   MDRV_SCREEN_ADD("main", RASTER)
507605   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
518616
519617   /* sound hardware */
520618   MDRV_SPEAKER_STANDARD_MONO("mono")
521   MDRV_SOUND_ADD("ay", AY8910, 12000000/8)
619   MDRV_SOUND_ADD("ay", AY8910, MASTER_CLOCK/8)
522620   MDRV_SOUND_CONFIG(ay8910_config)
523621   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
524622MACHINE_DRIVER_END
525623
526static MACHINE_DRIVER_START( madzoo )
527
528   /* basic machine hardware */
529   MDRV_IMPORT_FROM(skylncr)
530
531   /* video hardware */
532   MDRV_GFXDECODE(madzoo)
533MACHINE_DRIVER_END
534
535624/*
536625
537626Sky Lancer PCB Layout
r3957r3958
573662   ROM_LOAD( "574200.u33", 0x00000, 0x80000, CRC(19b25221) SHA1(2f32d337125a9fd0bc7f50713b05e564fd4f81b2) )
574663ROM_END
575664
665ROM_START( butrfly )
666   ROM_REGION( 0x80000, "main", 0 )
667   ROM_LOAD( "butterfly.prg",  0x00000, 0x10000, CRC(b35b289c) SHA1(5a02bfb6e1fb608099b9f491c10795ef888a3b36) )
668
669   ROM_REGION( 0x80000, "gfx1", 0 )
670   ROM_LOAD16_BYTE( "u29", 0x00000, 0x20000, CRC(2ff775ea) SHA1(2219c75cbac2969485607446ab116587bdee7278) )
671   ROM_LOAD16_BYTE( "u31", 0x00001, 0x20000, CRC(029d2214) SHA1(cf8256157db0b297ed457b3da6b6517907128843) )
672   ROM_LOAD16_BYTE( "u33", 0x40000, 0x20000, CRC(37bad677) SHA1(c077f0c07b097b376a01e5637446e4c4f82d9e28) )
673   ROM_LOAD16_BYTE( "u35", 0x40001, 0x20000, CRC(d14c7713) SHA1(c229ef64f3b0a04ff8e27bc56cff6a55ca34b80c) )
674
675   ROM_REGION( 0x80000, "gfx2", 0 )
676   ROM_LOAD16_BYTE( "u52", 0x00000, 0x20000, CRC(15051537) SHA1(086c38c05c605f297a7bc470eb51763a7648e72c) )
677   ROM_LOAD16_BYTE( "u54", 0x00001, 0x20000, CRC(8e34d029) SHA1(ae316f2f34768938a07d62db110ce59d2751abaa) )
678   ROM_LOAD16_BYTE( "u56", 0x40000, 0x20000, CRC(a53daaef) SHA1(7b88bb986bd5e47576163d6999f8770c720c5bfc) )
679   ROM_LOAD16_BYTE( "u58", 0x40001, 0x20000, CRC(21ca47f8) SHA1(b192be06a2eb817776309580dc64fd76772a8d50) )
680ROM_END
681
576682/*
577683
578684Mad Zoo PCB Layout
r3957r3958
608714   ROM_LOAD( "27512.u9",  0x00000, 0x10000, CRC(98b1c9fe) SHA1(9ca1706d25038a078fb07ba5c2e6681ed468bc88) )
609715
610716   ROM_REGION( 0x80000, "gfx1", 0 )
611   ROM_LOAD( "27c301.u29", 0x00000, 0x20000, CRC(4d58ab1d) SHA1(a6c9a855de6c7c502deea6afe2061dbbc6a1dfce) )
612   ROM_LOAD( "27c301.u31", 0x20000, 0x20000, CRC(511a8d19) SHA1(d49cc025b7b44a1f364b843dbe215fd2aa1e8986) )
613   ROM_LOAD( "27c301.u33", 0x40000, 0x20000, CRC(63e7ec89) SHA1(5184c164c356976325c7ad715d0f32a16bd44061) )
614   ROM_LOAD( "27c301.u35", 0x60000, 0x20000, CRC(a1ef51d1) SHA1(76508de6ab9effd1c8e27753403f161da073014c) )
717   ROM_LOAD16_BYTE( "27c301.u29", 0x00000, 0x20000, CRC(44645bb8) SHA1(efaf88d63e09029aa023ddaf72dbd9ee1df10315) )
718   ROM_LOAD16_BYTE( "27c301.u31", 0x00001, 0x20000, CRC(58267dbc) SHA1(dd64e4b44d10e2d93ded255622891f058b2b8bb9) )
719   ROM_LOAD16_BYTE( "27c301.u33", 0x40000, 0x20000, CRC(6adb1c2c) SHA1(d782a778a34e6240a3ae09cd11124790864a9149) )
720   ROM_LOAD16_BYTE( "27c301.u35", 0x40001, 0x20000, CRC(a8d3a174) SHA1(b668bb1db1d27aff52e808aa9b972f24693161b3) )
615721
616722   ROM_REGION( 0x80000, "gfx2", 0 )
617   ROM_LOAD( "27c301.u52", 0x00000, 0x20000, CRC(00cd5c9d) SHA1(68c2ffdba4018bcb03fe8a96c4a269d3ec7379d8) )
618   ROM_LOAD( "27c301.u54", 0x20000, 0x20000, CRC(9bd8af17) SHA1(5f32523ea797821205c5bb0f3c53c09ca784555b) )
619   ROM_LOAD( "27c301.u56", 0x40000, 0x20000, CRC(d73278a6) SHA1(2865659d80c76d73f19b178748cf67d792cd6a84) )
620   ROM_LOAD( "27c301.u58", 0x60000, 0x20000, CRC(895b2dac) SHA1(2a6dfec2a18a63f0cc4344506653ab7b14c31a59) )
723   ROM_LOAD16_BYTE( "27c301.u52", 0x00000, 0x20000, CRC(dd1997ed) SHA1(9197a0b4a0b6284ae7eeb6364c87589f6f8a614d) )
724   ROM_LOAD16_BYTE( "27c301.u54", 0x00001, 0x20000, CRC(a654a6df) SHA1(54292953df1103ad830e1f40fdf96c48e0e13be7) )
725   ROM_LOAD16_BYTE( "27c301.u56", 0x40000, 0x20000, CRC(f2e3c394) SHA1(8e09516fe822d7c125be57b154c896ab3e024f98) )
726   ROM_LOAD16_BYTE( "27c301.u58", 0x40001, 0x20000, CRC(65d2015b) SHA1(121494a2684276276e2504d6f853718e93f4d458) )
621727ROM_END
622728
729ROM_START( leader )
730   ROM_REGION( 0x80000, "main", 0 )
731   ROM_LOAD( "leader.prg",  0x00000, 0x10000, CRC(1a6e1129) SHA1(639f687e7720bab89628b377dca0475f17a35041) )
623732
733   ROM_REGION( 0x80000, "gfx1", 0 )
734   ROM_LOAD16_BYTE( "leadergfx1.dmp11", 0x00000, 0x20000, CRC(08acae31) SHA1(8b93066a2159e56607499fe1b1748a70a73a326c) )
735   ROM_LOAD16_BYTE( "leadergfx1.dmp21", 0x00001, 0x20000, CRC(88cd7a49) SHA1(f7187c7e3e584180de03998f376001f8d5966882) )
736   ROM_LOAD16_BYTE( "leadergfx1.dmp12", 0x40000, 0x20000, CRC(e57e145e) SHA1(3f6169ed1d907de3438787c02dc53c73ca6bdb73) )
737   ROM_LOAD16_BYTE( "leadergfx1.dmp22", 0x40001, 0x20000, CRC(e8368d29) SHA1(19e7d7d6e320f5f06e91013cb4c92b3987dbe24e) )
738
739   ROM_REGION( 0x80000, "gfx2", 0 )
740   ROM_LOAD16_BYTE( "leadergfx2.dmp11", 0x00000, 0x20000, CRC(1d62edf4) SHA1(7ba43bf0d0d0cadd5c7fcbe940ecf3fab5c9127b) )
741   ROM_LOAD16_BYTE( "leadergfx2.dmp21", 0x00001, 0x20000, CRC(57b9d159) SHA1(ee98aea160653d55017bd893cc253d23c7b1faf4) )
742   ROM_LOAD16_BYTE( "leadergfx2.dmp12", 0x40000, 0x20000, CRC(91e73bf9) SHA1(90a9c1119ae05bbd66a4d3c2266ec02cc53969bd) )
743   ROM_LOAD16_BYTE( "leadergfx2.dmp22", 0x40001, 0x20000, CRC(04cc0118) SHA1(016ccbe7daf8c4676830aadcc906a64e2826d11a) )
744ROM_END
745
746
624747static DRIVER_INIT( skylncr )
625748{
626749   paletteram   = auto_malloc(0x100*3);
r3957r3958
632755                   Game Drivers
633756*****************************************************/
634757
635GAME( 1995, skylncr, 0, skylncr, skylncr, skylncr, ROT0, "Bordun International", "Sky Lancer (Bordun International)", GAME_NOT_WORKING )
636GAME( 1995, madzoo,  0, madzoo,  skylncr, skylncr, ROT0, "Bordun International", "Mad Zoo",                           GAME_NOT_WORKING )
758/*    YEAR  NAME      PARENT   MACHINE   INPUT     INIT     ROT    COMPANY                 FULLNAME                            FLAGS  */
759GAME( 1995, skylncr,  0,       skylncr,  skylncr,  skylncr, ROT0, "Bordun International", "Sky Lancer (Bordun, ver.U450C)",    0 )
760GAME( 1995, butrfly,  0,       skylncr,  skylncr,  skylncr, ROT0, "Bordun International", "Butterfly Video Game (ver.U350C)",  0 )
761GAME( 1995, madzoo,   0,       skylncr,  skylncr,  skylncr, ROT0, "Bordun International", "Mad Zoo (ver.U450C)",               0 )
762GAME( 1995, leader,   0,       skylncr,  skylncr,  skylncr, ROT0, "Bootleg",              "Leader",                            GAME_NOT_WORKING )
src/mame/drivers/darkseal.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/m68000/m68000.h"
1718#include "cpu/h6280/h6280.h"
1819#include "sound/2203intf.h"
1920#include "sound/2151intf.h"
src/mame/drivers/20pacgal.c
r3957r3958
3636***************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/z180/z180.h"
3940#include "machine/eeprom.h"
4041#include "sound/namco.h"
4142#include "sound/dac.h"
r3957r3958
6566{
6667   int bit = data & 1;
6768
68   cpu_interrupt_enable(0, bit);
69   cpu_interrupt_enable(space->machine->cpu[0], bit);
6970
7071   if (!bit)
7172      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE );
src/mame/drivers/seicross.c
r3957r3958
4343***************************************************************************/
4444
4545#include "driver.h"
46#include "cpu/z80/z80.h"
47#include "cpu/m6800/m6800.h"
4648#include "sound/ay8910.h"
4749#include "sound/dac.h"
4850
r3957r3958
98100{
99101//logerror("PC %04x: 8910 port B = %02x\n",cpu_get_pc(space->cpu),data);
100102   /* bit 0 is IRQ enable */
101   cpu_interrupt_enable(0,data & 1);
103   cpu_interrupt_enable(space->machine->cpu[0],data & 1);
102104
103105   /* bit 1 flips screen */
104106
r3957r3958
410412   MDRV_CPU_ADD("mcu", NSC8105, 6000000)   /* ??? */
411413   MDRV_CPU_PROGRAM_MAP(mcu_nvram_map,0)
412414
413   MDRV_INTERLEAVE(20)   /* 20 CPU slices per frame - an high value to ensure proper */
415   MDRV_QUANTUM_TIME(HZ(1200))   /* 20 CPU slices per frame - an high value to ensure proper */
414416                  /* synchronization of the CPUs */
415417   MDRV_MACHINE_RESET(friskyt)
416418   MDRV_NVRAM_HANDLER(seicross)
src/mame/drivers/spbactn.c
r3957r3958
126126*******************************************************************************/
127127
128128#include "driver.h"
129#include "cpu/z80/z80.h"
130#include "cpu/m68000/m68000.h"
129131#include "sound/okim6295.h"
130132#include "sound/3812intf.h"
131133
src/mame/drivers/system16.c
r3957r3958
793793
794794static MACHINE_RESET( dduxbl )
795795{
796   sys16_patch_code( 0x1eb2e, 0x01 );
797   sys16_patch_code( 0x1eb2f, 0x01 );
798   sys16_patch_code( 0x1eb3c, 0x00 );
799   sys16_patch_code( 0x1eb3d, 0x00 );
800   sys16_patch_code( 0x23132, 0x01 );
801   sys16_patch_code( 0x23133, 0x01 );
802   sys16_patch_code( 0x23140, 0x00 );
803   sys16_patch_code( 0x23141, 0x00 );
804   sys16_patch_code( 0x24a9a, 0x01 );
805   sys16_patch_code( 0x24a9b, 0x01 );
806   sys16_patch_code( 0x24aa8, 0x00 );
807   sys16_patch_code( 0x24aa9, 0x00 );
796   static const sys16_patch patch[] =
797   {
798      { 0x1eb2e, 0x01 },
799      { 0x1eb2f, 0x01 },
800      { 0x1eb3c, 0x00 },
801      { 0x1eb3d, 0x00 },
802      { 0x23132, 0x01 },
803      { 0x23133, 0x01 },
804      { 0x23140, 0x00 },
805      { 0x23141, 0x00 },
806      { 0x24a9a, 0x01 },
807      { 0x24a9b, 0x01 },
808      { 0x24aa8, 0x00 },
809      { 0x24aa9, 0x00 }
810   };
811
812   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
808813}
809814
810815static DRIVER_INIT( dduxbl )
r3957r3958
923928      2,3,   6,7,
924929      10,11,   14,15
925930   };
931   static const sys16_patch patch[] =
932   {
933      { 0x3897, 0x11 }
934   };
935
936   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
937
926938   sys16_obj_bank = bank;
927939   sys16_sprxoffset = -0x23c;
928940
929   sys16_patch_code( 0x3897, 0x11 );
930941
931942   sys16_update_proc = eswatbl_update_proc;
932943}
r3957r3958
10161027
10171028static MACHINE_RESET( fpointbl )
10181029{
1019   sys16_patch_code( 0x454, 0x33 );
1020   sys16_patch_code( 0x455, 0xf8 );
1021   sys16_patch_code( 0x456, 0xe0 );
1022   sys16_patch_code( 0x457, 0xe2 );
1023   sys16_patch_code( 0x8ce8, 0x16 );
1024   sys16_patch_code( 0x8ce9, 0x66 );
1025   sys16_patch_code( 0x17687, 0x00 );
1026   sys16_patch_code( 0x7bed, 0x04 );
1030   static const sys16_patch patch[] =
1031   {
1032      { 0x454, 0x33 },
1033      { 0x455, 0xf8 },
1034      { 0x456, 0xe0 },
1035      { 0x457, 0xe2 },
1036      { 0x8ce8, 0x16 },
1037      { 0x8ce9, 0x66 },
1038      { 0x17687, 0x00 },
1039      { 0x7bed, 0x04 },
10271040
1028   sys16_patch_code( 0x7ea8, 0x61 );
1029   sys16_patch_code( 0x7ea9, 0x00 );
1030   sys16_patch_code( 0x7eaa, 0x84 );
1031   sys16_patch_code( 0x7eab, 0x16 );
1032   sys16_patch_code( 0x2c0, 0xe7 );
1033   sys16_patch_code( 0x2c1, 0x48 );
1034   sys16_patch_code( 0x2c2, 0xe7 );
1035   sys16_patch_code( 0x2c3, 0x49 );
1036   sys16_patch_code( 0x2c4, 0x04 );
1037   sys16_patch_code( 0x2c5, 0x40 );
1038   sys16_patch_code( 0x2c6, 0x00 );
1039   sys16_patch_code( 0x2c7, 0x10 );
1040   sys16_patch_code( 0x2c8, 0x4e );
1041   sys16_patch_code( 0x2c9, 0x75 );
1041      { 0x7ea8, 0x61 },
1042      { 0x7ea9, 0x00 },
1043      { 0x7eaa, 0x84 },
1044      { 0x7eab, 0x16 },
1045      { 0x2c0, 0xe7 },
1046      { 0x2c1, 0x48 },
1047      { 0x2c2, 0xe7 },
1048      { 0x2c3, 0x49 },
1049      { 0x2c4, 0x04 },
1050      { 0x2c5, 0x40 },
1051      { 0x2c6, 0x00 },
1052      { 0x2c7, 0x10 },
1053      { 0x2c8, 0x4e },
1054      { 0x2c9, 0x75 }
1055   };
10421056
1057   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
10431058   sys16_update_proc = fpoint_update_proc;
10441059}
10451060
r3957r3958
12491264      2,3,6,7,
12501265      10,11,0,0
12511266   };
1267#if 0
1268   // protection patch; no longer needed
1269   static const sys16_patch patch =
1270   {
1271      { 0x3CB2, 0x60 },
1272      { 0x3CB3, 0x1e }
1273   };
1274   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
1275#endif
1276
12521277   sys16_obj_bank = bank;
12531278
1254// protection patch; no longer needed
1255//  sys16_patch_code( 0x3CB2, 0x60 );
1256//  sys16_patch_code( 0x3CB3, 0x1e );
12571279
12581280   sys16_sprxoffset = -0xb8;
12591281   sys16_update_proc = goldnaxe_update_proc;
r3957r3958
14511473
14521474static MACHINE_RESET( passsht )
14531475{
1476   // fix name entry
1477   static const sys16_patch patch[] =
1478   {
1479      { 0x13a8,0xc0 }
1480   };
1481
1482   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
14541483   sys16_sprxoffset = -0x48;
14551484   sys16_spritesystem = sys16_sprite_passshot;
14561485
1457   // fix name entry
1458   sys16_patch_code( 0x13a8,0xc0);
1459
14601486   sys16_update_proc = passsht_update_proc;
14611487}
14621488
14631489static MACHINE_RESET( passht4b )
14641490{
1491   // fix name entry
1492   static const sys16_patch patch[] =
1493   {
1494      { 0x138a,0xc0 }
1495   };
1496
1497   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
14651498   sys16_sprxoffset = -0xb8;
14661499   sys16_spritesystem = sys16_sprite_passshot;
14671500
1468   // fix name entry
1469   sys16_patch_code( 0x138a,0xc0);
1470
14711501   sys16_update_proc = passht4b_update_proc;
14721502}
14731503
r3957r3958
17751805
17761806static MACHINE_RESET( tetrisbl )
17771807{
1778//  sys16_patch_code( 0xba6, 0x4e );
1779//  sys16_patch_code( 0xba7, 0x71 );
1808#if 0
1809   static const sys16_patch patch[] =
1810   {
1811      { 0xba6, 0x4e },
1812      { 0xba7, 0x71 }
1813   };
17801814
1815   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
1816#endif
1817
17811818   sys16_sprxoffset = -0x40;
17821819   sys16_update_proc = tetris_bootleg_update_proc;
17831820}
r3957r3958
21022139      0,1,
21032140      0,0
21042141   };
2105   sys16_obj_bank = bank;
21062142#if 1
2107   sys16_patch_code( 0x17058, 0x4e );
2108   sys16_patch_code( 0x17059, 0xb9 );
2109   sys16_patch_code( 0x1705a, 0x00 );
2110   sys16_patch_code( 0x1705b, 0x00 );
2111   sys16_patch_code( 0x1705c, 0x09 );
2112   sys16_patch_code( 0x1705d, 0xdc );
2113   sys16_patch_code( 0x1705e, 0x4e );
2114   sys16_patch_code( 0x1705f, 0xf9 );
2115   sys16_patch_code( 0x17060, 0x00 );
2116   sys16_patch_code( 0x17061, 0x01 );
2117   sys16_patch_code( 0x17062, 0x70 );
2118   sys16_patch_code( 0x17063, 0xe0 );
2119   sys16_patch_code( 0x1a3a, 0x31 );
2120   sys16_patch_code( 0x1a3b, 0x7c );
2121   sys16_patch_code( 0x1a3c, 0x80 );
2122   sys16_patch_code( 0x1a3d, 0x00 );
2123   sys16_patch_code( 0x23df8, 0x14 );
2124   sys16_patch_code( 0x23df9, 0x41 );
2125   sys16_patch_code( 0x23dfa, 0x10 );
2126   sys16_patch_code( 0x23dfd, 0x14 );
2127   sys16_patch_code( 0x23dff, 0x1c );
2143   static const sys16_patch patch[] =
2144   {
2145      { 0x17058, 0x4e },
2146      { 0x17059, 0xb9 },
2147      { 0x1705a, 0x00 },
2148      { 0x1705b, 0x00 },
2149      { 0x1705c, 0x09 },
2150      { 0x1705d, 0xdc },
2151      { 0x1705e, 0x4e },
2152      { 0x1705f, 0xf9 },
2153      { 0x17060, 0x00 },
2154      { 0x17061, 0x01 },
2155      { 0x17062, 0x70 },
2156      { 0x17063, 0xe0 },
2157      { 0x1a3a, 0x31 },
2158      { 0x1a3b, 0x7c },
2159      { 0x1a3c, 0x80 },
2160      { 0x1a3d, 0x00 },
2161      { 0x23df8, 0x14 },
2162      { 0x23df9, 0x41 },
2163      { 0x23dfa, 0x10 },
2164      { 0x23dfd, 0x14 },
2165      { 0x23dff, 0x1c }
2166   };
2167
2168   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
21282169#endif
2170   sys16_obj_bank = bank;
21292171   sys16_update_proc = wb3bbl_update_proc;
21302172}
21312173
src/mame/drivers/deniam.c
r3957r3958
3232***************************************************************************/
3333
3434#include "driver.h"
35#include "cpu/m68000/m68000.h"
3536#include "cpu/z80/z80.h"
3637#include "sound/okim6295.h"
3738#include "sound/3812intf.h"
r3957r3958
262263static void irqhandler(running_machine *machine, int linestate)
263264{
264265   /* system 16c doesn't have the sound CPU */
265   if (machine->config->cpu[1].type != CPU_DUMMY)
266   if (machine->cpu[1] != NULL)
266267      cpu_set_input_line(machine->cpu[1],0,linestate);
267268}
268269
src/mame/drivers/nyny.c
r3957r3958
402402static const mc6845_interface mc6845_intf =
403403{
404404   "main",               /* screen we are acting on */
405   CRTC_CLOCK,          /* the clock (pin 21) of the chip */
406405   8,                  /* number of pixels per video memory address */
407406   begin_update,         /* before pixel update callback */
408407   update_row,            /* row update callback */
r3957r3958
684683   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
685684   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256)   /* temporary, CRTC will configure screen */
686685
687   MDRV_DEVICE_ADD("crtc", MC6845)
688   MDRV_DEVICE_CONFIG(mc6845_intf)
686   MDRV_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf)
689687
690688   /* 74LS123 */
691689
692   MDRV_DEVICE_ADD("ic48_1", TTL74123)
693   MDRV_DEVICE_CONFIG(ic48_1_config)
690   MDRV_TTL74123_ADD("ic48_1", ic48_1_config)
694691
695692   /* audio hardware */
696693   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/limenko.c
r3957r3958
2424*/
2525
2626#include "driver.h"
27#include "cpu/e132xs/e132xs.h"
2728#include "machine/eeprom.h"
2829#include "sound/okim6295.h"
2930#include "cpu/mcs51/mcs51.h"
r3957r3958
380381      gfxdata   = base_gfx + 64 * code;
381382
382383      /* prepare GfxElement on the fly */
384      gfx.machine = machine;
383385      gfx.width = width;
384386      gfx.height = height;
385387      gfx.total_elements = 1;
src/mame/drivers/mcr3.c
r3957r3958
8383
8484
8585#include "driver.h"
86#include "cpu/z80/z80.h"
8687#include "deprecat.h"
8788#include "machine/z80ctc.h"
8889#include "audio/mcr.h"
r3957r3958
260261static WRITE8_HANDLER( rampage_op6_w )
261262{
262263   /* bit 5 controls reset of the Sounds Good board */
263   soundsgood_reset_w((~data >> 5) & 1);
264   soundsgood_reset_w(space->machine, (~data >> 5) & 1);
264265
265266   /* low 5 bits go directly to the Sounds Good board */
266267   soundsgood_data_w(space, offset, data);
r3957r3958
304305static WRITE8_HANDLER( powerdrv_op6_w )
305306{
306307   /* bit 5 controls reset of the Sounds Good board */
307   soundsgood_reset_w((~data >> 5) & 1);
308   soundsgood_reset_w(space->machine, (~data >> 5) & 1);
308309
309310   /* low 5 bits go directly to the Sounds Good board */
310311   soundsgood_data_w(space, offset, data);
r3957r3958
347348static WRITE8_HANDLER( stargrds_op6_w )
348349{
349350   /* bit 6 controls reset of the Sounds Good board */
350   soundsgood_reset_w((~data >> 6) & 1);
351   soundsgood_reset_w(space->machine, (~data >> 6) & 1);
351352
352353   /* unline the other games, the STROBE is in the high bit instead of the low bit */
353354   soundsgood_data_w(space, offset, (data << 1) | (data >> 7));
r3957r3958
10551056   MDRV_CPU_CONFIG(mcr_daisy_chain)
10561057   MDRV_CPU_VBLANK_INT_HACK(mcr_interrupt,2)
10571058
1058   MDRV_Z80CTC_ADD("ctc", mcr_ctc_intf)
1059   MDRV_Z80CTC_ADD("ctc", MASTER_CLOCK/4 /* same as "main" */, mcr_ctc_intf)
10591060
10601061   MDRV_WATCHDOG_VBLANK_INIT(16)
10611062   MDRV_MACHINE_START(mcr)
src/mame/drivers/pipeline.c
r3957r3958
4848*/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "machine/z80ctc.h"
5253#include "sound/2203intf.h"
5354#include "machine/8255ppi.h"
r3957r3958
292293
293294static const z80ctc_interface ctc_intf =
294295{
295   "audio",         // clock from audio CPU
296   0,               // clock
297296   0,               // timer disables
298297   ctc0_interrupt,      // interrupt handler
299298   0,               // ZC/TO0 callback
r3957r3958
379378   MDRV_CPU_ADD("mcu", M68705, 7372800/2)
380379   MDRV_CPU_PROGRAM_MAP(mcu_mem, 0)
381380
382   MDRV_Z80CTC_ADD( "ctc", ctc_intf )
381   MDRV_Z80CTC_ADD( "ctc", 7372800/2 /* same as "audio" */, ctc_intf )
383382
384383   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
385384   MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
src/mame/drivers/pengo.c
r3957r3958
6262***************************************************************************/
6363
6464#include "driver.h"
65#include "cpu/z80/z80.h"
6566#include "machine/segacrpt.h"
6667#include "pacman.h"
6768#include "sound/namco.h"
src/mame/drivers/stadhero.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/m68000/m68000.h"
1011#include "cpu/m6502/m6502.h"
1112#include "sound/2203intf.h"
1213#include "sound/3812intf.h"
src/mame/drivers/prehisle.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
13#include "cpu/m68000/m68000.h"
1214#include "sound/upd7759.h"
1315#include "sound/3812intf.h"
1416
src/mame/drivers/wwfsstar.c
r3957r3958
138138*******************************************************************************/
139139
140140#include "driver.h"
141#include "deprecat.h"
142141#include "cpu/m68000/m68000.h"
143142#include "cpu/z80/z80.h"
144143#include "sound/2151intf.h"
145144#include "sound/okim6295.h"
146145
146#define MASTER_CLOCK      XTAL_20MHz
147#define CPU_CLOCK         MASTER_CLOCK / 2
148#define PIXEL_CLOCK      MASTER_CLOCK / 4
149
147150/* in (video/wwfsstar.c) */
148151VIDEO_START( wwfsstar );
149152VIDEO_UPDATE( wwfsstar );
r3957r3958
157160static WRITE16_HANDLER ( wwfsstar_soundwrite );
158161static WRITE16_HANDLER ( wwfsstar_scrollwrite );
159162
160static int vblank;
163static int vblank = 0;
161164
162165/*******************************************************************************
163166 Memory Maps
r3957r3958
222225
223226static WRITE16_HANDLER( wwfsstar_flipscreen_w )
224227{
225   flip_screen_set(data & 1);
228   flip_screen_set(space->machine, data & 1);
226229}
227230
228231static WRITE16_HANDLER( wwfsstar_irqack_w )
229232{
230   if(offset == 0)
233   if (offset == 0)
231234      cpu_set_input_line(space->machine->cpu[0], 6, CLEAR_LINE);
232235
233236   else
r3957r3958
247250    A hack is required: raise the vblank bit a scanline early.
248251*/
249252
250static INTERRUPT_GEN( wwfsstars_interrupt )
253static TIMER_DEVICE_CALLBACK( wwfsstar_scanline )
251254{
252   int scanline = 271 - cpu_getiloops(device);
255   int scanline = param;
253256
254   /* Vblank is lowered on scanline 0 (8) */
257   /* Vblank is lowered on scanline 0 */
255258   if (scanline == 0)
256259   {
257260      vblank = 0;
258261   }
259262   /* Hack */
260   else if (scanline==239)
263   else if (scanline == (240-1))      /* -1 is an hack needed to avoid deadlocks */
261264   {
262265      vblank = 1;
263266   }
264   /* Vblank is raised on scanline 240 (248) */
265   else if (scanline==240)
267
268   /* An interrupt is generated every 16 scanlines */
269   if (scanline % 16 == 0)
266270   {
267      video_screen_update_partial(device->machine->primary_screen, scanline);
268      cpu_set_input_line(device, 6, ASSERT_LINE);
271      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
272      cpu_set_input_line(timer->machine->cpu[0], 5, ASSERT_LINE);
269273   }
270274
271   /* An interrupt is generated every 16 scanlines */
272   if (scanline%16 == 0)
275   /* Vblank is raised on scanline 240 */
276   if (scanline == 240)
273277   {
274      video_screen_update_partial(device->machine->primary_screen, scanline);
275      cpu_set_input_line(device, 5, ASSERT_LINE);
278      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
279      cpu_set_input_line(timer->machine->cpu[0], 6, ASSERT_LINE);
276280   }
281
282   /* Adjust for next scanline */
283   if (++scanline >= video_screen_get_height(timer->machine->primary_screen))
284   {
285      scanline = 0;
286   }
277287}
278288
279289static CUSTOM_INPUT( wwfsstar_vblank_r )
r3957r3958
432442static MACHINE_DRIVER_START( wwfsstar )
433443
434444   /* basic machine hardware */
435   MDRV_CPU_ADD("main", M68000, XTAL_20MHz / 2)
445   MDRV_CPU_ADD("main", M68000, CPU_CLOCK)
436446   MDRV_CPU_PROGRAM_MAP(main_map, 0)
437   MDRV_CPU_VBLANK_INT_HACK(wwfsstars_interrupt, 272)
447   MDRV_TIMER_ADD_SCANLINE("scantimer", wwfsstar_scanline, "main", 0, 1)
438448
439449   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz)
440450   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
441451
442452   /* video hardware */
443453   MDRV_SCREEN_ADD("main", RASTER)
444   MDRV_SCREEN_REFRESH_RATE(57.44)
445   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
446454   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
447   MDRV_SCREEN_SIZE(32*8, 32*8)
448   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
455   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 320, 0, 256, 272, 8, 248)   /* HTOTAL and VTOTAL are guessed */
449456
450457   MDRV_GFXDECODE(wwfsstar)
451458   MDRV_PALETTE_LENGTH(384)
src/mame/drivers/model1.c
r3957r3958
625625*/
626626
627627#include "driver.h"
628#include "cpu/v60/v60.h"
628629#include "deprecat.h"
629630#include "machine/eeprom.h"
630631#include "system16.h"
src/mame/drivers/polepos.c
r3957r3958
211211***************************************************************************/
212212
213213#include "driver.h"
214#include "cpu/z80/z80.h"
215#include "cpu/mb88xx/mb88xx.h"
214216#include "deprecat.h"
215217#include "machine/namcoio.h"
216218#include "sound/namco.h"
r3957r3958
286288   switch (offset)
287289   {
288290      case 0x00:   /* IRQON */
289         cpu_interrupt_enable(0,bit);
291         cpu_interrupt_enable(space->machine->cpu[0],bit);
290292         if (!bit)
291293            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
292294         break;
r3957r3958
330332{
331333   data &= 1;
332334
333   cpu_interrupt_enable(cpu_get_index(space->cpu),data);
335   cpu_interrupt_enable(space->cpu,data);
334336   if (!data)
335337      cpu_set_input_line(space->cpu, 0, CLEAR_LINE);
336338}
r3957r3958
857859
858860   MDRV_WATCHDOG_VBLANK_INIT(16)   // 128V clocks the same as VBLANK
859861
860   MDRV_INTERLEAVE(100)   /* some interleaving */
862   MDRV_QUANTUM_TIME(HZ(6000))   /* some interleaving */
861863
862864   MDRV_MACHINE_RESET(polepos)
863865   MDRV_NVRAM_HANDLER(generic_1fill)
src/mame/drivers/taito_b.c
r3957r3958
168168***************************************************************************/
169169
170170#include "driver.h"
171#include "deprecat.h"
171#include "cpu/z80/z80.h"
172172#include "taitoipt.h"
173173#include "cpu/m68000/m68000.h"
174174#include "video/taitoic.h"
r3957r3958
341341   {
342342      if (offset==0)
343343      {
344         MB87078_data_w(0, data>>8, 0);
344         MB87078_data_w(space->machine, 0, data>>8, 0);
345345            //logerror("MB87078 dsel=0 data=%4x\n",data);
346346      }
347347      else
348348      {
349         MB87078_data_w(0, data>>8, 1);
349         MB87078_data_w(space->machine, 0, data>>8, 1);
350350            //logerror("MB87078 dsel=1 data=%4x\n",data);
351351      }
352352   }
r3957r3958
23872387    Both ym2610 and ym2610b generate 3 (PSG like) + 2 (fm left,right) channels.
23882388    I use mixer_set_volume() to emulate the effect.
23892389*/
2390static void mb87078_gain_changed(int channel, int percent)
2390static void mb87078_gain_changed(running_machine *machine, int channel, int percent)
23912391{
23922392   if (channel==1)
23932393   {
2394      sound_type type = Machine->config->sound[0].type;
2394      sound_type type = machine->config->sound[0].type;
23952395      sndti_set_output_gain(type, 0, 0, percent / 100.0);
23962396      sndti_set_output_gain(type, 1, 0, percent / 100.0);
23972397      sndti_set_output_gain(type, 2, 0, percent / 100.0);
r3957r3958
24072407
24082408static MACHINE_RESET( mb87078 )
24092409{
2410   MB87078_start(0, &mb87078_interface); /*chip #0*/
2410   MB87078_start(machine, 0, &mb87078_interface); /*chip #0*/
24112411/*
24122412    {
24132413        int i;
r3957r3958
24282428   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
24292429   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
24302430
2431   MDRV_INTERLEAVE(10)
2431   MDRV_QUANTUM_TIME(HZ(600))
24322432
24332433   /* video hardware */
24342434   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
24662466   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
24672467   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
24682468
2469   MDRV_INTERLEAVE(10)
2469   MDRV_QUANTUM_TIME(HZ(600))
24702470
24712471   /* video hardware */
24722472   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
25042504   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
25052505   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
25062506
2507   MDRV_INTERLEAVE(10)
2507   MDRV_QUANTUM_TIME(HZ(600))
25082508
25092509   /* video hardware */
25102510   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
25422542   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
25432543   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
25442544
2545   MDRV_INTERLEAVE(10)
2545   MDRV_QUANTUM_TIME(HZ(600))
25462546
25472547   /* video hardware */
25482548   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
25792579   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
25802580   MDRV_CPU_PROGRAM_MAP(masterw_sound_readmem,masterw_sound_writemem)
25812581
2582   MDRV_INTERLEAVE(10)
2582   MDRV_QUANTUM_TIME(HZ(600))
25832583
25842584   /* video hardware */
25852585   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
26172617   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
26182618   MDRV_CPU_PROGRAM_MAP(viofight_sound_readmem, viofight_sound_writemem)
26192619
2620   MDRV_INTERLEAVE(10)
2620   MDRV_QUANTUM_TIME(HZ(600))
26212621
26222622   /* video hardware */
26232623   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
26612661   MDRV_CPU_ADD("audio", Z80, XTAL_24MHz/6)   /* verified on pcb */
26622662   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
26632663
2664   MDRV_INTERLEAVE(10)
2664   MDRV_QUANTUM_TIME(HZ(600))
26652665
26662666   /* video hardware */
26672667   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
26992699   MDRV_CPU_ADD("audio", Z80, XTAL_24MHz/6)   /* verified on pcb */
27002700   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
27012701
2702   MDRV_INTERLEAVE(10)
2702   MDRV_QUANTUM_TIME(HZ(600))
27032703
27042704   /* video hardware */
27052705   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
27372737   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
27382738   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
27392739
2740   MDRV_INTERLEAVE(10)
2740   MDRV_QUANTUM_TIME(HZ(600))
27412741
27422742   MDRV_MACHINE_RESET(mb87078)
27432743   MDRV_NVRAM_HANDLER(taito_b)
r3957r3958
27782778   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
27792779   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
27802780
2781   MDRV_INTERLEAVE(10)
2781   MDRV_QUANTUM_TIME(HZ(600))
27822782
27832783   MDRV_MACHINE_RESET(mb87078)
27842784   MDRV_NVRAM_HANDLER(taito_b)
r3957r3958
28192819   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
28202820   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
28212821
2822   MDRV_INTERLEAVE(10)
2822   MDRV_QUANTUM_TIME(HZ(600))
28232823
28242824   /* video hardware */
28252825   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
28572857   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
28582858   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
28592859
2860   MDRV_INTERLEAVE(10)
2860   MDRV_QUANTUM_TIME(HZ(600))
28612861
28622862   MDRV_MACHINE_RESET(mb87078)
28632863   MDRV_NVRAM_HANDLER(taito_b)
r3957r3958
28982898   MDRV_CPU_ADD("audio", Z80, 6000000)   /* 6 MHz verified */
28992899   MDRV_CPU_PROGRAM_MAP(viofight_sound_readmem, viofight_sound_writemem)
29002900
2901   MDRV_INTERLEAVE(10)
2901   MDRV_QUANTUM_TIME(HZ(600))
29022902
29032903   /* video hardware */
29042904   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
29402940   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
29412941   MDRV_CPU_PROGRAM_MAP(masterw_sound_readmem,masterw_sound_writemem)
29422942
2943   MDRV_INTERLEAVE(10)
2943   MDRV_QUANTUM_TIME(HZ(600))
29442944
29452945   /* video hardware */
29462946   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
29792979   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
29802980   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
29812981
2982   MDRV_INTERLEAVE(10)
2982   MDRV_QUANTUM_TIME(HZ(600))
29832983
29842984   /* video hardware */
29852985   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
30173017   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
30183018   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
30193019
3020   MDRV_INTERLEAVE(10)
3020   MDRV_QUANTUM_TIME(HZ(600))
30213021
30223022   /* video hardware */
30233023   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
30643064   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
30653065   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
30663066
3067   MDRV_INTERLEAVE(10)
3067   MDRV_QUANTUM_TIME(HZ(600))
30683068
30693069   /* video hardware */
30703070   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
31093109   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz */
31103110   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
31113111
3112   MDRV_INTERLEAVE(10)
3112   MDRV_QUANTUM_TIME(HZ(600))
31133113
31143114   /* video hardware */
31153115   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/jackal.c
r3957r3958
9292static WRITE8_HANDLER( jackal_flipscreen_w )
9393{
9494   irq_enable = data & 0x02;
95   flip_screen_set(data & 0x08);
95   flip_screen_set(space->machine, data & 0x08);
9696}
9797
9898/* Memory Maps */
r3957r3958
307307   MDRV_CPU_ADD("slave", M6809, MASTER_CLOCK/12) // verified on pcb
308308   MDRV_CPU_PROGRAM_MAP(slave_map, 0)
309309
310   MDRV_INTERLEAVE(100)
310   MDRV_QUANTUM_TIME(HZ(6000))
311311
312312   MDRV_MACHINE_RESET(jackal)
313313
src/mame/drivers/tank8.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89#include "tank8.h"
910#include "sound/discrete.h"
1011
src/mame/drivers/viper.c
r3957r3958
590590   devtag_reset(machine, IDE_CONTROLLER, "ide");
591591}
592592
593static const timekeeper_config timekeeper_intf =
594{
595   "m48t58"
596};
597
598593static MACHINE_DRIVER_START(viper)
599594
600595   /* basic machine hardware */
r3957r3958
627622   /* sound hardware */
628623   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
629624
630   MDRV_DEVICE_ADD( "m48t58", M48T58 )
631   MDRV_DEVICE_CONFIG( timekeeper_intf )
625   MDRV_M48T58_ADD( "m48t58" )
632626MACHINE_DRIVER_END
633627
634628/*****************************************************************************/
src/mame/drivers/paranoia.c
r3957r3958
3434****************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/z80/z80.h"
38#include "cpu/i8085/i8085.h"
3739#include "deprecat.h"
3840#include "machine/pcecommn.h"
3941#include "video/vdc.h"
r3957r3958
135137   MDRV_CPU_IO_MAP(pce_io, 0)
136138   MDRV_CPU_VBLANK_INT_HACK(pce_interrupt, VDC_LPF)
137139
138   MDRV_INTERLEAVE(1)
140   MDRV_QUANTUM_TIME(HZ(60))
139141
140142   MDRV_CPU_ADD("sub", 8085A, 18000000/3)
141143   MDRV_CPU_PROGRAM_MAP(paranoia_8085_map,0)
src/mame/drivers/mw8080bw.c
r3957r3958
141141****************************************************************************/
142142
143143#include "driver.h"
144#include "cpu/i8085/i8085.h"
144145#include "rendlay.h"
145146#include "machine/rescap.h"
146147#include "mw8080bw.h"
r3957r3958
834835   MDRV_IMPORT_FROM(mw8080bw_root)
835836   MDRV_CPU_MODIFY("main")
836837   MDRV_CPU_IO_MAP(zzzap_io_map,0)
837   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_M(1), CAP_U(1)))) /* 1.1s */
838   MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_M(1), CAP_U(1)))) /* 1.1s */
838839
839840   /* audio hardware */
840841   /* MDRV_IMPORT_FROM(zzzap_audio) */
r3957r3958
946947   MDRV_CPU_MODIFY("main")
947948   MDRV_CPU_IO_MAP(maze_io_map,0)
948949   MDRV_MACHINE_START(maze)
949   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
950   MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
950951
951952   /* audio hardware */
952953   MDRV_IMPORT_FROM(maze_audio)
r3957r3958
10371038   MDRV_CPU_MODIFY("main")
10381039   MDRV_CPU_IO_MAP(boothill_io_map,0)
10391040   MDRV_MACHINE_START(boothill)
1040   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
1041   MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
10411042
10421043   /* audio hardware */
10431044   MDRV_IMPORT_FROM(boothill_audio)
r3957r3958
11391140   MDRV_IMPORT_FROM(mw8080bw_root)
11401141   MDRV_CPU_MODIFY("main")
11411142   MDRV_CPU_IO_MAP(checkmat_io_map,0)
1142   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
1143   MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_MONOSTABLE_NSEC(RES_K(270), CAP_U(10)))) /* 2.97s */
11431144
11441145   /* audio hardware */
11451146   MDRV_IMPORT_FROM(checkmat_audio)
r3957r3958
12751276   MDRV_CPU_MODIFY("main")
12761277   MDRV_CPU_IO_MAP(desertgu_io_map,0)
12771278   MDRV_MACHINE_START(desertgu)
1278   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1279   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
12791280
12801281   /* audio hardware */
12811282   MDRV_IMPORT_FROM(desertgu_audio)
r3957r3958
14721473   MDRV_IMPORT_FROM(mw8080bw_root)
14731474   MDRV_CPU_MODIFY("main")
14741475   MDRV_CPU_IO_MAP(dplay_io_map,0)
1475   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1476   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
14761477
14771478   /* audio hardware */
14781479   MDRV_IMPORT_FROM(dplay_audio)
r3957r3958
16541655   MDRV_CPU_MODIFY("main")
16551656   MDRV_CPU_IO_MAP(m4_io_map,0)
16561657   MDRV_MACHINE_START(m4)
1657   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1658   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
16581659
16591660   /* audio hardware */
16601661   MDRV_IMPORT_FROM(m4_audio)
r3957r3958
18281829   MDRV_CPU_MODIFY("main")
18291830   MDRV_CPU_IO_MAP(clowns_io_map,0)
18301831   MDRV_MACHINE_START(clowns)
1831   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1832   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
18321833
18331834   /* audio hardware */
18341835   MDRV_IMPORT_FROM(clowns_audio)
r3957r3958
19061907   MDRV_IMPORT_FROM(mw8080bw_root)
19071908   MDRV_CPU_MODIFY("main")
19081909   MDRV_CPU_IO_MAP(shuffle_io_map,0)
1909   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1910   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
19101911
19111912   /* audio hardware */
19121913   /* MDRV_IMPORT_FROM(shuffle_audio) */
r3957r3958
19911992   MDRV_CPU_IO_MAP(dogpatch_io_map,0)
19921993   /* the watch dog time is unknown, but all other */
19931994   /* Midway boards of the era used the same circuit */
1994   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
1995   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
19951996
19961997   /* audio hardware */
19971998   MDRV_IMPORT_FROM(dogpatch_audio)
r3957r3958
21572158   MDRV_CPU_MODIFY("main")
21582159   MDRV_CPU_IO_MAP(spcenctr_io_map,0)
21592160   MDRV_MACHINE_START(spcenctr)
2160   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2161   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
21612162
21622163   /* timers */
21632164   MDRV_TIMER_ADD_PERIODIC("strobeon", spcenctr_strobe_timer_callback, HZ(SPCENCTR_STROBE_FREQ))
r3957r3958
22652266   MDRV_CPU_MODIFY("main")
22662267   MDRV_CPU_IO_MAP(phantom2_io_map,0)
22672268   MDRV_MACHINE_START(phantom2)
2268   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2269   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
22692270
22702271   /* video hardware */
22712272   MDRV_VIDEO_UPDATE(phantom2)
r3957r3958
24012402   MDRV_IMPORT_FROM(mw8080bw_root)
24022403   MDRV_CPU_MODIFY("main")
24032404   MDRV_CPU_IO_MAP(bowler_io_map,0)
2404   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2405   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
24052406
24062407   /* audio hardware */
24072408   MDRV_IMPORT_FROM(bowler_audio)
r3957r3958
26272628   MDRV_CPU_MODIFY("main")
26282629   MDRV_CPU_IO_MAP(invaders_io_map,0)
26292630   MDRV_MACHINE_START(invaders)
2630   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2631   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
26312632
26322633   /* video hardware */
26332634   MDRV_VIDEO_UPDATE(invaders)
r3957r3958
27062707   MDRV_IMPORT_FROM(mw8080bw_root)
27072708   MDRV_CPU_MODIFY("main")
27082709   MDRV_CPU_IO_MAP(blueshrk_io_map,0)
2709   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2710   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
27102711
27112712   /* audio hardware */
27122713   MDRV_IMPORT_FROM(blueshrk_audio)
r3957r3958
28042805   MDRV_IMPORT_FROM(mw8080bw_root)
28052806   MDRV_CPU_MODIFY("main")
28062807   MDRV_CPU_IO_MAP(invad2ct_io_map,0)
2807   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
2808   MDRV_WATCHDOG_TIME_INIT(USEC(255000000 / (MW8080BW_PIXEL_CLOCK / MW8080BW_HTOTAL / MW8080BW_VTOTAL)))
28082809
28092810   /* audio hardware */
28102811   MDRV_IMPORT_FROM(invad2ct_audio)
src/mame/drivers/namcos86.c
r3957r3958
175175*******************************************************************/
176176
177177#include "driver.h"
178#include "cpu/m6809/m6809.h"
178179#include "cpu/m6800/m6800.h"
179180#include "sound/2151intf.h"
180181#include "sound/namco.h"
r3957r3958
10691070   MDRV_CPU_IO_MAP(mcu_port_map,0)
10701071   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
10711072
1072   MDRV_INTERLEAVE(800)   /* heavy interleaving needed to avoid hangs in rthunder */
1073   MDRV_QUANTUM_TIME(HZ(48000))   /* heavy interleaving needed to avoid hangs in rthunder */
10731074
10741075   MDRV_MACHINE_RESET(namco86)
10751076
src/mame/drivers/suna8.c
r3957r3958
501501*/
502502static WRITE8_HANDLER( hardhead_flipscreen_w )
503503{
504   flip_screen_set(    data & 0x04);
504   flip_screen_set(space->machine,     data & 0x04);
505505   coin_lockout_w ( 0,   data & 0x08);
506506   coin_lockout_w ( 1,   data & 0x10);
507507}
r3957r3958
559559
560560   memory_set_bank(space->machine, 1, bank);
561561
562   flip_screen_set(    data & 0x20);
562   flip_screen_set(space->machine,     data & 0x20);
563563   coin_lockout_w ( 0,   data & 0x40);
564564   coin_lockout_w ( 1,   data & 0x80);
565565}
r3957r3958
642642{
643643   suna8_spritebank = (data >> 1) & 1;
644644   if (data & ~0x03)    logerror("CPU #0 - PC %04X: unknown spritebank bits: %02X\n",cpu_get_pc(space->cpu),data);
645   flip_screen_set( data & 0x01 );
645   flip_screen_set(space->machine, data & 0x01 );
646646}
647647
648648static WRITE8_HANDLER( brickzn_unknown_w )
r3957r3958
711711*/
712712static WRITE8_HANDLER( hardhea2_flipscreen_w )
713713{
714   flip_screen_set(data & 0x01);
714   flip_screen_set(space->machine, data & 0x01);
715715   if (data & ~0x01)    logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(space->cpu),data);
716716}
717717
r3957r3958
876876*/
877877static WRITE8_HANDLER( sparkman_flipscreen_w )
878878{
879   flip_screen_set(data & 0x01);
879   flip_screen_set(space->machine, data & 0x01);
880880   if (data & ~0x01)    logerror("CPU #0 - PC %04X: unknown flipscreen bits: %02X\n",cpu_get_pc(space->cpu),data);
881881}
882882
src/mame/drivers/vaportra.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/m68000/m68000.h"
1213#include "cpu/h6280/h6280.h"
1314#include "sound/2203intf.h"
1415#include "sound/2151intf.h"
src/mame/drivers/chanbara.c
r3957r3958
4747****************************************************************************************/
4848
4949#include "driver.h"
50#include "cpu/m6809/m6809.h"
5051#include "sound/2203intf.h"
5152
5253static tilemap *bg_tilemap;
src/mame/drivers/cps1.c
r3957r3958
230230***************************************************************************/
231231
232232#include "driver.h"
233#include "cpu/z80/z80.h"
234#include "cpu/pic16c5x/pic16c5x.h"
235#include "cpu/m68000/m68000.h"
233236#include "machine/eeprom.h"
234237#include "sound/2151intf.h"
235238#include "sound/okim6295.h"
src/mame/drivers/nova2001.c
r3957r3958
118118******************************************************************************/
119119
120120#include "driver.h"
121#include "cpu/z80/z80.h"
121122#include "deprecat.h"
122123#include "sound/ay8910.h"
123124#include "nova2001.h"
r3957r3958
743744   MDRV_CPU_PROGRAM_MAP(ninjakun_cpu2_map,0)
744745   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) /* ? */
745746
746   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame */
747   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame */
747748
748749   MDRV_MACHINE_START(ninjakun)
749750
r3957r3958
819820   MDRV_CPU_PROGRAM_MAP(raiders5_cpu2_map,0)
820821   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* ? */
821822
822   MDRV_INTERLEAVE(400)
823   MDRV_QUANTUM_TIME(HZ(24000))
823824
824825   /* video hardware */
825826   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/jantotsu.c
r0r3958
1/*******************************************************************************************
2
34nin-uchi Mahjong Jantotsu (c) 1983 Sanritsu
4
5driver by David Haywood and Angelo Salese
6
7Notes:
8-The 1-2 Player tiles on hand are actually shown on different screen sides.The Service Mode
9 is for adjusting these screens (to not let the human opponent to read your tiles).
10
11TODO:
12-Video buffering? If you coin up,you can see the "credit 1" msg that gets build into the
13 video bitmaps...
14-According to the flyer,color bitplanes might be wrong on the A-N mahjong charset,might be a
15 BTANB however...
16-I need schematics / pcb photos (component + solder sides) to understand if the background
17 color is hard-wired to the DIP-Switches or there's something else wrong.
18-Missing MSM5205 samples;
19
20============================================================================================
21Debug cheats:
22
23c01b-c028 player-1 tiles
24c02b-c038 right computer tiles
25c03b-c048 up computer tiles / player-2 tiles
26c04b-c058 left computer tiles
27
28============================================================================================
29
304nin-uchi mahjong Jantotsu
31(c)1983 Sanritsu
32
33C2-00159_A
34
35CPU: Z80
36Sound: SN76489ANx2 MSM5205
37OSC: 18.432MHz
38
39ROMs:
40JAT-00.2B (2764)
41JAT-01.3B
42JAT-02.4B
43JAT-03.2E
44JAT-04.3E
45JAT-05.4E
46
47JAT-40.6B
48JAT-41.7B
49JAT-42.8B
50JAT-43.9B
51
52JAT-60.10P (7051) - color PROM
53
54This game requires special control panel.
55Standard mahjong control panel + these 3 buttons.
56- 9syu nagare
57- Continue Yes
58- Continue No
59
60dumped by sayu
61
62*******************************************************************************************/
63
64#include "driver.h"
65#include "cpu/z80/z80.h"
66#include "sound/sn76496.h"
67
68static UINT8 *jan_bitmap_1,*jan_bitmap_2,*jan_bitmap_3,*jan_bitmap_4;
69static UINT8 vram_bank,col_bank;
70static UINT8 mux_data;
71
72VIDEO_START(jantotsu)
73{
74   jan_bitmap_1 = auto_malloc(0x2000);
75   jan_bitmap_2 = auto_malloc(0x2000);
76   jan_bitmap_3 = auto_malloc(0x2000);
77   jan_bitmap_4 = auto_malloc(0x2000);
78   vram_bank = 0;
79}
80
81VIDEO_UPDATE(jantotsu)
82{
83   int x,y,i;
84   int count;
85
86   count = 0;
87   for(y=0;y<256;y++)
88   {
89      for(x=0;x<256;x+=8)
90      {
91         int pen[4],color;
92
93         for (i=0;i<8;i++)
94         {
95            pen[0] = (jan_bitmap_1[count])>>(7-i);
96            pen[1] = (jan_bitmap_2[count])>>(7-i);
97            pen[2] = (jan_bitmap_3[count])>>(7-i);
98            pen[3] = (jan_bitmap_4[count])>>(7-i);
99
100            color = ((pen[0] & 1)<<0);
101            color|= ((pen[1] & 1)<<1);
102            color|= ((pen[2] & 1)<<2);
103            color|= ((pen[3] & 1)<<3);
104            color|= col_bank;
105
106            if((x+i)<=video_screen_get_visible_area(screen)->max_x && ((y)+0)<video_screen_get_visible_area(screen)->max_y)
107               *BITMAP_ADDR32(bitmap, y, x+i) = screen->machine->pens[color];
108         }
109
110         count++;
111      }
112   }
113
114   return 0;
115}
116
117static READ8_HANDLER( jantotsu_bitmap_r )
118{
119   switch(vram_bank & 3)
120   {
121      case 0: return jan_bitmap_1[offset];
122      case 1: return jan_bitmap_2[offset];
123      case 2: return jan_bitmap_3[offset];
124      case 3: return jan_bitmap_4[offset];
125   }
126   return 0;
127}
128
129static WRITE8_HANDLER( jantotsu_bitmap_w )
130{
131   switch(vram_bank & 3)
132   {
133      case 0: jan_bitmap_1[offset] = data; break;
134      case 1: jan_bitmap_2[offset] = data; break;
135      case 2: jan_bitmap_3[offset] = data; break;
136      case 3: jan_bitmap_4[offset] = data; break;
137   }
138}
139
140static WRITE8_HANDLER( bankaddr_w )
141{
142   vram_bank = ((data & 0xc0)>>6); // top 2 bits?
143
144   // looks like the top 2 bits and bottom 2 bits are used..
145   // multiple buffers? different read / write ?
146
147//  printf("%02x\n",data & 0x03);
148}
149
150static PALETTE_INIT( jantotsu )
151{
152   int   bit0, bit1, bit2 , r, g, b;
153   int   i;
154
155   for (i = 0; i < 0x20; ++i)
156   {
157      bit0 = (color_prom[0] >> 0) & 0x01;
158      bit1 = (color_prom[0] >> 1) & 0x01;
159      bit2 = (color_prom[0] >> 2) & 0x01;
160      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
161      bit0 = (color_prom[0] >> 3) & 0x01;
162      bit1 = (color_prom[0] >> 4) & 0x01;
163      bit2 = (color_prom[0] >> 5) & 0x01;
164      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
165      bit0 = 0;
166      bit1 = (color_prom[0] >> 6) & 0x01;
167      bit2 = (color_prom[0] >> 7) & 0x01;
168      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
169
170      palette_set_color(machine, i, MAKE_RGB(r, g, b));
171      color_prom++;
172   }
173}
174
175/*Multiplexer is mapped as 6-bits reads,bits 6 & 7 are always connected to the coin mechs.*/
176static READ8_HANDLER( jantotsu_mux_r )
177{
178   static UINT8 coin_port;
179
180   coin_port = input_port_read(space->machine, "COINS");
181
182//  printf("%02x\n",mux_data);
183
184   switch(mux_data)
185   {
186      case 1:    return input_port_read(space->machine, "PL1_1") | coin_port;
187      case 2:    return input_port_read(space->machine, "PL1_2") | coin_port;
188      case 4:    return input_port_read(space->machine, "PL1_3") | coin_port;
189      case 8:    return input_port_read(space->machine, "PL1_4") | coin_port;
190      case 0x10: return input_port_read(space->machine, "PL2_1") | coin_port;
191      case 0x20: return input_port_read(space->machine, "PL2_2") | coin_port;
192      case 0x40: return input_port_read(space->machine, "PL2_3") | coin_port;
193      case 0x80: return input_port_read(space->machine, "PL2_4") | coin_port;
194   }
195
196   return coin_port;
197}
198
199static WRITE8_HANDLER( jantotsu_mux_w )
200{
201   mux_data = ~data;
202}
203
204/*If bits 6 & 7 doesn't return 0x80,the game hangs until this bit is set,
205  so I'm guessing that these bits can't be read by the z80 at all but directly
206  hard-wired to the video chip.However I need the schematics / pcb snaps and/or
207  a side-by-side test (to know if the background colors really works) to be sure. */
208static READ8_HANDLER( jantotsu_dsw2_r )
209{
210   return (input_port_read(space->machine, "DSW2") & 0x3f) | 0x80;
211}
212
213static ADDRESS_MAP_START( jantotsu_map, ADDRESS_SPACE_PROGRAM, 8 )
214   AM_RANGE(0x0000, 0xbfff) AM_ROM
215   AM_RANGE(0xc000, 0xc7ff) AM_RAM
216   AM_RANGE(0xe000, 0xffff) AM_READWRITE(jantotsu_bitmap_r,jantotsu_bitmap_w)
217ADDRESS_MAP_END
218
219static ADDRESS_MAP_START( jantotsu_io, ADDRESS_SPACE_IO, 8 )
220   ADDRESS_MAP_GLOBAL_MASK(0xff)
221   AM_RANGE(0x00, 0x00) AM_READ_PORT("DSW1") AM_WRITE(sn76496_0_w)
222   AM_RANGE(0x01, 0x01) AM_READ(jantotsu_dsw2_r) AM_WRITE(sn76496_1_w)
223   //02-03 MSM samples
224   AM_RANGE(0x04, 0x04) AM_READWRITE(jantotsu_mux_r,jantotsu_mux_w)
225   AM_RANGE(0x07, 0x07) AM_WRITE(bankaddr_w)
226ADDRESS_MAP_END
227
228static INPUT_PORTS_START( jantotsu )
229   PORT_START("COINS")
230   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
231   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
232   PORT_START("DSW1")
233   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1")
234   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
235   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
236   PORT_DIPUNUSED_DIPLOC( 0x02, 0x00, "SW1:2" )
237   PORT_DIPNAME( 0x1c, 0x00, "Player vs. CPU timer decrement speed") PORT_DIPLOCATION("SW1:3,4,5") //in msecs I suppose
238   PORT_DIPSETTING(    0x00, "30")
239   PORT_DIPSETTING(    0x08, "50" )
240   PORT_DIPSETTING(    0x04, "70")
241   PORT_DIPSETTING(    0x0c, "90" )
242   PORT_DIPSETTING(    0x10, "110" )
243   PORT_DIPSETTING(    0x18, "130" )
244   PORT_DIPSETTING(    0x14, "150" )
245   PORT_DIPSETTING(    0x1c, "170" )
246   PORT_DIPNAME( 0xe0, 0x00, "Player vs. Player timer decrement speed" ) PORT_DIPLOCATION("SW1:6,7,8") //in msecs I suppose
247   PORT_DIPSETTING(    0x00, "100" )
248   PORT_DIPSETTING(    0x40, "120" )
249   PORT_DIPSETTING(    0x20, "140" )
250   PORT_DIPSETTING(    0x60, "160" )
251   PORT_DIPSETTING(    0x80, "180" )
252   PORT_DIPSETTING(    0xc0, "200" )
253   PORT_DIPSETTING(    0xa0, "220" )
254   PORT_DIPSETTING(    0xe0, "240" )
255   PORT_START("DSW2")
256   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2,3")
257   PORT_DIPSETTING(    0x07, DEF_STR( Easy ) )
258   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
259   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
260   PORT_DIPUNUSED_DIPLOC( 0x08, 0x00, "SW2:4" )
261   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Service_Mode ) ) PORT_DIPLOCATION("SW2:5")
262   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
263   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
264   PORT_DIPNAME( 0x20, 0x00, "Play BGM") PORT_DIPLOCATION("SW2:6")
265   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
266   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
267   PORT_DIPNAME( 0xc0, 0x40, "Background Color" ) PORT_DIPLOCATION("SW2:7,8")
268   PORT_DIPSETTING(    0xc0, "Purple" )
269   PORT_DIPSETTING(    0x80, "Green" )
270   PORT_DIPSETTING(    0x40, "Blue" )
271   PORT_DIPSETTING(    0x00, "Black" )
272   PORT_START("PL1_1")
273   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
274   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Mahjong Nagare") PORT_CODE(KEYCODE_S)
275   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Continue Button Yes") PORT_CODE(KEYCODE_Y)
276   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Continue Button No") PORT_CODE(KEYCODE_O)
277   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
278   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
279   PORT_START("PL1_2")
280   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M )
281   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N )
282   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
283   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
284   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
285   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
286   PORT_START("PL1_3")
287   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_G )
288   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
289   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
290   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J )
291   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_K )
292   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_L )
293   PORT_START("PL1_4")
294   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
295   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B )
296   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C )
297   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D )
298   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E )
299   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_F )
300   PORT_START("PL2_1")
301   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
302   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Mahjong Nagare") PORT_PLAYER(2)
303   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Continue Button Yes") PORT_PLAYER(2)
304   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P2 Continue Button No") PORT_PLAYER(2)
305   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
306   PORT_START("PL2_2")
307   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
308   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
309   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
310   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
311   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
312   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
313   PORT_START("PL2_3")
314   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
315   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
316   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
317   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
318   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
319   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
320   PORT_START("PL2_4")
321   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2)
322   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
323   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
324   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
325   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2)
326   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
327INPUT_PORTS_END
328
329static INTERRUPT_GEN( jantotsu_irq )
330{
331   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE );
332}
333
334static MACHINE_RESET( jantotsu )
335{
336   mux_data = 0;
337   /*Load hard-wired background color.*/
338   col_bank = (input_port_read(machine, "DSW2") & 0xc0)>>3;
339}
340
341static MACHINE_DRIVER_START( jantotsu )
342   /* basic machine hardware */
343   MDRV_CPU_ADD("main", Z80,18432000/4)
344   MDRV_CPU_PROGRAM_MAP(0,jantotsu_map)
345   MDRV_CPU_IO_MAP(0,jantotsu_io)
346   MDRV_CPU_VBLANK_INT("main", jantotsu_irq)
347
348   MDRV_MACHINE_RESET(jantotsu)
349   /* video hardware */
350   MDRV_SCREEN_ADD("main", RASTER)
351   MDRV_SCREEN_REFRESH_RATE(60)
352   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) //not accurate
353   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
354   MDRV_SCREEN_SIZE(256, 256)
355   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1)
356
357   MDRV_PALETTE_INIT(jantotsu)
358   MDRV_PALETTE_LENGTH(0x20)
359
360   MDRV_VIDEO_START(jantotsu)
361   MDRV_VIDEO_UPDATE(jantotsu)
362
363   /* sound hardware */
364   MDRV_SPEAKER_STANDARD_MONO("mono")
365
366   MDRV_SOUND_ADD("sn1", SN76489A, 18432000/4)
367   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
368
369   MDRV_SOUND_ADD("sn2", SN76489A, 18432000/4)
370   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
371MACHINE_DRIVER_END
372
373
374
375ROM_START( jantotsu )
376   ROM_REGION( 0x10000, "main", 0 )
377   ROM_LOAD( "jat-00.2b", 0x00000, 0x02000, CRC(bed10f86) SHA1(c5ac845b32fa295b0ff205b1401bcc071d604d6e) )
378   ROM_LOAD( "jat-01.3b", 0x02000, 0x02000, CRC(cc9312e9) SHA1(b08d38cc58d92378305c015c5a001b4da072188b) )
379   ROM_LOAD( "jat-02.4b", 0x04000, 0x02000, CRC(292969f1) SHA1(e7cb93b67296e84ea012fcceb72df712c7e0f135) )
380   ROM_LOAD( "jat-03.2e", 0x06000, 0x02000, CRC(7452ff63) SHA1(b258674e77eee5548a065419a3092877957dec66) )
381   ROM_LOAD( "jat-04.3e", 0x08000, 0x02000, CRC(734e029f) SHA1(75aa13397847b4db32c41aaa6ff2ac82f16bd7a2) )
382   ROM_LOAD( "jat-05.4e", 0x0a000, 0x02000, CRC(1a725e1a) SHA1(1d39d607850f47b9389f41147d4570da8814f639) )
383
384   ROM_REGION( 0x8000, "gfx1", 0 )
385   ROM_LOAD( "jat-40.6b", 0x00000, 0x02000, CRC(2275253e) SHA1(64e9415faf2775c6b9ab497dce7fda8c4775192e) )
386   ROM_LOAD( "jat-41.7b", 0x02000, 0x02000, CRC(ce08ed71) SHA1(8554e5e7ec178f57bed5fbdd5937e3a35f72c454) )
387   ROM_LOAD( "jat-42.8b", 0x04000, 0x02000, CRC(3ac3efbf) SHA1(846faea7c7c01fb7500aa33a70d4b54e878c0e41) )
388   ROM_LOAD( "jat-43.9b", 0x06000, 0x02000, CRC(3c1d843c) SHA1(7a836e66cad4e94916f0d80a439efde49306a0e1) )
389
390   ROM_REGION( 0x20, "proms", 0 )
391   ROM_LOAD( "jat-60.10p", 0x00, 0x20,  CRC(65528ae0) SHA1(6e3bf27d10ec14e3c6a494667b03b68726fcff14) )
392ROM_END
393
394GAME( 1983, jantotsu,  0,    jantotsu, jantotsu,  0, ROT270, "Sanritsu", "4nin-uchi Mahjong Jantotsu", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mame/drivers/yunsun16.c
r3957r3958
8686***************************************************************************/
8787
8888#include "driver.h"
89#include "cpu/z80/z80.h"
90#include "cpu/m68000/m68000.h"
8991#include "sound/okim6295.h"
9092#include "sound/3812intf.h"
9193
src/mame/drivers/scobra.c
r3957r3958
3333***************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
3637#include "machine/8255ppi.h"
3738#include "galaxold.h"
3839#include "sound/ay8910.h"
src/mame/drivers/wiz.c
r3957r3958
158158***************************************************************************/
159159
160160#include "driver.h"
161#include "cpu/z80/z80.h"
161162#include "deprecat.h"
162163#include "sound/ay8910.h"
163164#include "sound/discrete.h"
src/mame/drivers/stactics.c
r3957r3958
4141****************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/i8085/i8085.h"
4445#include "stactics.h"
4546#include "stactics.lh"
4647
src/mame/drivers/mermaid.c
r3957r3958
114114***************************************************************************/
115115
116116#include "driver.h"
117#include "cpu/z80/z80.h"
117118#include "sound/ay8910.h"
118119
119120extern UINT8* mermaid_videoram2;
src/mame/drivers/calorie.c
r3957r3958
7878*/
7979
8080#include "driver.h"
81#include "cpu/z80/z80.h"
8182#include "machine/segacrpt.h"
8283#include "sound/ay8910.h"
8384
r3957r3958
141142      ypos = 0xff - calorie_sprites[x+2];
142143      xpos = calorie_sprites[x+3];
143144
144      if(flip_screen_get())
145      if(flip_screen_get(screen->machine))
145146      {
146147         if( calorie_sprites[x+1] & 0x10 )
147148            ypos = 0xff - ypos + 32;
r3957r3958
185186
186187static WRITE8_HANDLER( calorie_flipscreen_w )
187188{
188   flip_screen_set(data & 1);
189   flip_screen_set(space->machine, data & 1);
189190}
190191
191192static READ8_HANDLER( calorie_soundlatch_r )
src/mame/drivers/drtomy.c
r3957r3958
88*/
99
1010#include "driver.h"
11#include "cpu/m68000/m68000.h"
1112#include "sound/okim6295.h"
1213
1314static UINT16 *drtomy_spriteram;
src/mame/drivers/gaelco3d.c
r3957r3958
143143**************************************************************************/
144144
145145#include "driver.h"
146#include "cpu/m68000/m68000.h"
146147#include "gaelco3d.h"
147148#include "cpu/tms32031/tms32031.h"
148149#include "cpu/adsp2100/adsp2100.h"
r3957r3958
193194      adsp_ram_base[i] = opcode;
194195   }
195196
196   /* initialize the ADSP Tx callback */
197   adsp21xx_set_tx_handler(machine->cpu[2], adsp_tx_callback);
198
199197   /* allocate a timer for feeding the autobuffer */
200198   adsp_autobuffer_timer = timer_alloc(machine, adsp_autobuffer_irq, NULL);
201199
r3957r3958
242240
243241static INTERRUPT_GEN( vblank_gen )
244242{
245   gaelco3d_render();
243   gaelco3d_render(device->machine->primary_screen);
246244   cpu_set_input_line(device, 2, ASSERT_LINE);
247245}
248246
r3957r3958
907905 *
908906 *************************************/
909907
908static const adsp21xx_config adsp_config =
909{
910   NULL,               /* callback for serial receive */
911   adsp_tx_callback,      /* callback for serial transmit */
912   NULL               /* callback for timer fired */
913};
914
910915static const tms32031_config tms_config =
911916{
912917   0x1000,
r3957r3958
924929   MDRV_CPU_VBLANK_INT("main", vblank_gen)
925930
926931   MDRV_CPU_ADD("tms", TMS32031, 60000000)
932   MDRV_CPU_CONFIG(tms_config)
927933   MDRV_CPU_PROGRAM_MAP(tms_map,0)
928   MDRV_CPU_CONFIG(tms_config)
929934
930935   MDRV_CPU_ADD("adsp", ADSP2115, 16000000)
936   MDRV_CPU_CONFIG(adsp_config)
931937   MDRV_CPU_PROGRAM_MAP(adsp_program_map,0)
932938   MDRV_CPU_DATA_MAP(adsp_data_map, 0)
933939
934940   MDRV_MACHINE_RESET(gaelco3d)
935941   MDRV_NVRAM_HANDLER(93C66B)
936942
937   MDRV_INTERLEAVE(100)
943   MDRV_QUANTUM_TIME(HZ(6000))
938944
939945   /* video hardware */
940946   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/avalnche.c
r3957r3958
2828***************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/m6502/m6502.h"
3132#include "deprecat.h"
3233#include "sound/discrete.h"
3334#include "avalnche.h"
src/mame/drivers/namcos11.c
r3957r3958
638638
639639static UINT32 m_n_bankoffset;
640640
641INLINE void bankswitch_rom8( int n_bank, int n_data )
641INLINE void bankswitch_rom8( const address_space *space, int n_bank, int n_data )
642642{
643   memory_set_bank( Machine,  n_bank + 1, ( ( n_data & 0xc0 ) >> 4 ) + ( n_data & 0x03 ) );
643   memory_set_bank( space->machine,  n_bank + 1, ( ( n_data & 0xc0 ) >> 4 ) + ( n_data & 0x03 ) );
644644}
645645
646646static WRITE32_HANDLER( bankswitch_rom32_w )
r3957r3958
649649
650650   if( ACCESSING_BITS_0_15 )
651651   {
652      bankswitch_rom8( ( offset * 2 ), data & 0xffff );
652      bankswitch_rom8( space, ( offset * 2 ), data & 0xffff );
653653   }
654654   if( ACCESSING_BITS_16_31 )
655655   {
656      bankswitch_rom8( ( offset * 2 ) + 1, data >> 16 );
656      bankswitch_rom8( space, ( offset * 2 ) + 1, data >> 16 );
657657   }
658658}
659659
r3957r3958
671671   }
672672}
673673
674INLINE void bankswitch_rom64( int n_bank, int n_data )
674INLINE void bankswitch_rom64( const address_space *space, int n_bank, int n_data )
675675{
676676   /* todo: verify behaviour */
677   memory_set_bank( Machine,  n_bank + 1, ( ( ( ( n_data & 0xc0 ) >> 3 ) + ( n_data & 0x07 ) ) ^ m_n_bankoffset ) );
677   memory_set_bank( space->machine,  n_bank + 1, ( ( ( ( n_data & 0xc0 ) >> 3 ) + ( n_data & 0x07 ) ) ^ m_n_bankoffset ) );
678678}
679679
680680static WRITE32_HANDLER( bankswitch_rom64_w )
r3957r3958
683683
684684   if( ACCESSING_BITS_0_15 )
685685   {
686      bankswitch_rom64( ( offset * 2 ), data & 0xffff );
686      bankswitch_rom64( space, ( offset * 2 ), data & 0xffff );
687687   }
688688   if( ACCESSING_BITS_16_31 )
689689   {
690      bankswitch_rom64( ( offset * 2 ) + 1, data >> 16 );
690      bankswitch_rom64( space, ( offset * 2 ) + 1, data >> 16 );
691691   }
692692}
693693
r3957r3958
894894   NAMCO_C7X_MCU_SHARED(16384000)
895895   NAMCO_C7X_SOUND(16384000)
896896
897   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
897   MDRV_AT28C16_ADD( "at28c16", NULL )
898898MACHINE_DRIVER_END
899899
900900static MACHINE_DRIVER_START( coh110 )
src/mame/drivers/dcon.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/m68000/m68000.h"
1617#include "cpu/z80/z80.h"
1718#include "audio/seibu.h"
1819
src/mame/drivers/kickgoal.c
r3957r3958
3535*/
3636
3737#include "driver.h"
38#include "cpu/m68000/m68000.h"
3839#include "cpu/pic16c5x/pic16c5x.h"
3940#include "machine/eeprom.h"
4041#include "sound/okim6295.h"
src/mame/drivers/itech8.c
r3957r3958
495495
496496
497497#include "driver.h"
498#include "cpu/z80/z80.h"
499#include "cpu/m68000/m68000.h"
500#include "cpu/hd6309/hd6309.h"
498501#include "cpu/m6809/m6809.h"
499502#include "machine/6821pia.h"
500503#include "machine/6522via.h"
r3957r3958
589592
590593void itech8_update_interrupts(running_machine *machine, int periodic, int tms34061, int blitter)
591594{
595   cpu_type main_cpu_type = cpu_get_type(machine->cpu[0]);
596
592597   /* update the states */
593598   if (periodic != -1) periodic_int = periodic;
594599   if (tms34061 != -1) tms34061_int = tms34061;
595600   if (blitter != -1) blitter_int = blitter;
596601
597602   /* handle the 6809 case */
598   if (machine->config->cpu[0].type == CPU_M6809 || machine->config->cpu[0].type == CPU_HD6309)
603   if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309)
599604   {
600605      /* just modify lines that have changed */
601606      if (periodic != -1) cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, periodic ? ASSERT_LINE : CLEAR_LINE);
r3957r3958
673678
674679static MACHINE_RESET( itech8 )
675680{
681   cpu_type main_cpu_type = cpu_get_type(machine->cpu[0]);
682
676683   /* make sure bank 0 is selected */
677   if (machine->config->cpu[0].type == CPU_M6809 || machine->config->cpu[0].type == CPU_HD6309)
684   if (main_cpu_type == CPU_M6809 || main_cpu_type == CPU_HD6309)
678685   {
679686      memory_set_bankptr(machine, 1, &memory_region(machine, "main")[0x4000]);
680      cpu_reset(machine->cpu[0]);
687      device_reset(machine->cpu[0]);
681688   }
682689
683690   /* reset the PIA (if used) */
src/mame/drivers/othldrby.c
r3957r3958
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/m68000/m68000.h"
1819#include "sound/okim6295.h"
1920
2021
src/mame/drivers/bbusters.c
r3957r3958
198198***************************************************************************/
199199
200200#include "driver.h"
201#include "cpu/z80/z80.h"
202#include "cpu/m68000/m68000.h"
201203#include "sound/2608intf.h"
202204#include "sound/2610intf.h"
203205
src/mame/drivers/gstriker.c
r3957r3958
3333******************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
37#include "cpu/m68000/m68000.h"
3638#include "gstriker.h"
3739#include "sound/2610intf.h"
3840
src/mame/drivers/snk.c
r3957r3958
258258***************************************************************************/
259259
260260#include "driver.h"
261#include "cpu/z80/z80.h"
261262#include "snk.h"
262263#include "sound/snkwave.h"
263264#include "sound/ay8910.h"
r3957r3958
35843585   MDRV_CPU_IO_MAP(marvins_sound_portmap,0)
35853586   MDRV_CPU_PERIODIC_INT(nmi_line_assert, 244)   // schematics show a separate 244Hz timer
35863587
3587   MDRV_INTERLEAVE(100)
3588   MDRV_QUANTUM_TIME(HZ(6000))
35883589
35893590   /* video hardware */
35903591   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r3957r3958
36453646   MDRV_CPU_IO_MAP(jcross_sound_portmap,0)
36463647   MDRV_CPU_PERIODIC_INT(irq0_line_assert, 244)   // Marvin's frequency, sounds ok
36473648
3648   MDRV_INTERLEAVE(100)
3649   MDRV_QUANTUM_TIME(HZ(6000))
36493650
36503651   /* video hardware */
36513652   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r3957r3958
37283729   MDRV_CPU_ADD("audio", Z80, XTAL_8MHz/2) /* verified on pcb */
37293730   MDRV_CPU_PROGRAM_MAP(tnk3_YM3526_sound_map,0)
37303731
3731   MDRV_INTERLEAVE(100)
3732   MDRV_QUANTUM_TIME(HZ(6000))
37323733
37333734   /* video hardware */
37343735   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r3957r3958
38193820   MDRV_CPU_ADD("audio", Z80, XTAL_8MHz/2) /* verified on pcb */
38203821   MDRV_CPU_PROGRAM_MAP(YM3526_YM3526_sound_map,0)
38213822
3822   MDRV_INTERLEAVE(100)
3823   MDRV_QUANTUM_TIME(HZ(6000))
38233824
38243825   /* video hardware */
38253826   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
r3957r3958
38793880   MDRV_CPU_ADD("audio", Z80, XTAL_8MHz/2) /* verified on pcb */
38803881   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
38813882
3882   MDRV_INTERLEAVE(400)
3883   MDRV_QUANTUM_TIME(HZ(24000))
38833884
38843885   /* video hardware */
38853886   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
39903991   MDRV_CPU_ADD("audio", Z80, 4000000)
39913992   MDRV_CPU_PROGRAM_MAP(YM3526_Y8950_sound_map,0)
39923993
3993   MDRV_INTERLEAVE(100)
3994   MDRV_QUANTUM_TIME(HZ(6000))
39943995
39953996   /* video hardware */
39963997   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/hyprduel.c
r3957r3958
3838***************************************************************************/
3939
4040#include "driver.h"
41#include "cpu/m68000/m68000.h"
4142#include "deprecat.h"
4243#include "sound/2151intf.h"
4344#include "sound/okim6295.h"
src/mame/drivers/arcadecl.c
r3957r3958
6767
6868
6969#include "driver.h"
70#include "cpu/m68000/m68000.h"
7071#include "machine/atarigen.h"
7172#include "arcadecl.h"
7273#include "sound/okim6295.h"
src/mame/drivers/namconb1.c
r3957r3958
270270                    Custom 169     (120 pin PQFP)
271271*/
272272#include "driver.h"
273#include "cpu/m68000/m68000.h"
273274#include "deprecat.h"
274275#include "namconb1.h"
275276#include "namcos2.h"
src/mame/drivers/flstory.c
r3957r3958
668668   MDRV_CPU_ADD("mcu", M68705,XTAL_18_432MHz/6)   /* verified on pcb */
669669   MDRV_CPU_PROGRAM_MAP(flstory_m68705_map,0)
670670
671   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
671   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
672672                     /* synchronization of the CPUs */
673673   MDRV_MACHINE_RESET(ta7630)
674674
r3957r3958
725725//  MDRV_CPU_ADD("mcu", M68705,4000000)  /* ??? */
726726//  MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
727727
728   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
728   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
729729                     /* synchronization of the CPUs */
730730   MDRV_MACHINE_RESET(ta7630)
731731
r3957r3958
782782//  MDRV_CPU_ADD("mcu", M68705,4000000)  /* ??? */
783783//  MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
784784
785   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
785   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
786786                     /* synchronization of the CPUs */
787787   MDRV_MACHINE_RESET(ta7630)
788788
src/mame/drivers/fcrash.c
r3957r3958
3333*/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
3637#include "cpu/m68000/m68000.h"
3738#include "cps1.h"
3839#include "sound/2203intf.h"
r3957r3958
210211   int videocontrol=cps1_cps_a_regs[0x22/2];
211212
212213
213   flip_screen_set(videocontrol & 0x8000);
214   flip_screen_set(screen->machine, videocontrol & 0x8000);
214215
215216    layercontrol = cps1_cps_b_regs[0x20/2];
216217
r3957r3958
281282   int videocontrol=cps1_cps_a_regs[0x22/2];
282283
283284
284   flip_screen_set(videocontrol & 0x8000);
285   flip_screen_set(screen->machine, videocontrol & 0x8000);
285286
286287    layercontrol = cps1_cps_b_regs[0x20/2];
287288
src/mame/drivers/suprslam.c
r3957r3958
8181******************************************************************************/
8282
8383#include "driver.h"
84#include "cpu/z80/z80.h"
85#include "cpu/m68000/m68000.h"
8486#include "video/konamiic.h"
8587#include "sound/2610intf.h"
8688
src/mame/drivers/f-32.c
r3957r3958
1212*********************************************************************/
1313
1414#include "driver.h"
15#include "cpu/e132xs/e132xs.h"
1516#include "machine/eeprom.h"
1617#include "sound/2151intf.h"
1718#include "sound/okim6295.h"
src/mame/drivers/calomega.c
r3957r3958
616616#define SND_CLOCK   (MASTER_CLOCK/8)
617617
618618#include "driver.h"
619#include "cpu/m6502/m6502.h"
619620#include "video/mc6845.h"
620621#include "machine/6821pia.h"
621622#include "machine/6850acia.h"
r3957r3958
19291930   MDRV_VIDEO_START(calomega)
19301931   MDRV_VIDEO_UPDATE(calomega)
19311932
1932   MDRV_DEVICE_ADD("crtc", MC6845)
1933   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
19331934
19341935   /* sound hardware */
19351936   MDRV_SPEAKER_STANDARD_MONO("mono")
r3957r3958
19381939   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
19391940
19401941   /* acia */
1941   MDRV_DEVICE_ADD("acia6850_0", ACIA6850)
1942   MDRV_DEVICE_CONFIG(acia6850_intf)
1942   MDRV_ACIA6850_ADD("acia6850_0", acia6850_intf)
19431943MACHINE_DRIVER_END
19441944
19451945static MACHINE_DRIVER_START( sys905 )
src/mame/drivers/strnskil.c
r3957r3958
1515*****************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/z80/z80.h"
1819#include "deprecat.h"
1920#include "sound/sn76496.h"
2021
r3957r3958
345346   MDRV_CPU_PROGRAM_MAP(strnskil_readmem2,strnskil_writemem2)
346347   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
347348
348   MDRV_INTERLEAVE(100)
349   MDRV_QUANTUM_TIME(HZ(6000))
349350
350351   /* video hardware */
351352   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/sfkick.c
r3957r3958
441441
442442static INTERRUPT_GEN( sfkick_interrupt )
443443{
444   v9938_interrupt(0);
444   v9938_interrupt(device->machine, 0);
445445}
446446static void irqhandler(running_machine *machine, int irq)
447447{
r3957r3958
465465   MDRV_CPU_IO_MAP(main_io,0)
466466   MDRV_CPU_VBLANK_INT_HACK(sfkick_interrupt,262)
467467
468   MDRV_INTERLEAVE(1000)
468   MDRV_QUANTUM_TIME(HZ(60000))
469469
470470   MDRV_CPU_ADD("sound",Z80,MASTER_CLOCK/6)
471471   MDRV_CPU_PROGRAM_MAP(sound_mem,0)
src/mame/drivers/dgpix.c
r3957r3958
5050*********************************************************************/
5151
5252#include "driver.h"
53#include "cpu/e132xs/e132xs.h"
5354
5455static UINT32 *vram;
5556static int vbuffer = 0;
src/mame/drivers/cosmic.c
r3957r3958
2727
2828
2929#include "driver.h"
30#include "cpu/tms9900/tms9900.h"
3031#include "deprecat.h"
3132#include "cpu/z80/z80.h"
3233#include "sound/samples.h"
r3957r3958
461462
462463static WRITE8_HANDLER( flip_screen_w )
463464{
464   flip_screen_set(data&0x80);
465   flip_screen_set(space->machine, data&0x80);
465466}
466467
467468
src/mame/drivers/4roses.c
r3957r3958
173173#define MASTER_CLOCK   XTAL_16MHz
174174
175175#include "driver.h"
176#include "cpu/m6502/m6502.h"
176177#include "video/mc6845.h"
177178#include "sound/ay8910.h"
178179
r3957r3958
380381   MDRV_VIDEO_START(funworld)
381382   MDRV_VIDEO_UPDATE(funworld)
382383
383   MDRV_DEVICE_ADD("crtc", MC6845)
384   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
384385
385386    /* sound hardware */
386387   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/sangho.c
r3957r3958
212212{
213213   v9938_set_sprite_limit(0, 0);
214214   v9938_set_resolution(0, 2);
215   v9938_interrupt(0);
215   v9938_interrupt(device->machine, 0);
216216}
217217
218218
src/mame/drivers/shaolins.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/m6809/m6809.h"
1011#include "deprecat.h"
1112#include "sound/sn76496.h"
1213
src/mame/drivers/model2.c
r3957r3958
353353
354354   // copy the 68k vector table into RAM
355355   memcpy(model2_soundram, memory_region(machine, "audio")+0x80000, 16);
356   cpu_reset(cputag_get_cpu(machine, "audio"));
356   device_reset(cputag_get_cpu(machine, "audio"));
357357}
358358
359359static MACHINE_RESET(model2)
r3957r3958
18901890   //MDRV_CPU_CONFIG(sharc_cfg)
18911891   //MDRV_CPU_DATA_MAP(geo_sharc_map, 0)
18921892
1893   MDRV_INTERLEAVE(300)
1893   MDRV_QUANTUM_TIME(HZ(18000))
18941894
18951895   MDRV_MACHINE_RESET(model2b)
18961896   MDRV_NVRAM_HANDLER( model2 )
src/mame/drivers/ataxx.c
r3957r3958
2626
2727
2828#include "driver.h"
29#include "cpu/i86/i86.h"
2930#include "machine/eeprom.h"
3031#include "cpu/z80/z80.h"
3132#include "leland.h"
src/mame/drivers/sshangha.c
r3957r3958
5252***************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/z80/z80.h"
56#include "cpu/m68000/m68000.h"
5557#include "sound/2203intf.h"
5658#include "sound/okim6295.h"
5759
src/mame/drivers/kyugo.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/z80/z80.h"
2526#include "deprecat.h"
2627#include "kyugo.h"
2728#include "sound/ay8910.h"
r3957r3958
4041{
4142   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
4243   // must start with interrupts and sub CPU disabled
43   cpu_interrupt_enable(0, 0);
44   cpu_interrupt_enable(machine->cpu[0], 0);
4445   kyugo_sub_cpu_control_w(space, 0, 0);
4546}
4647
r3957r3958
472473   MDRV_CPU_IO_MAP(gyrodine_sub_portmap,0)
473474   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
474475
475   MDRV_INTERLEAVE(100)
476   MDRV_QUANTUM_TIME(HZ(6000))
476477
477478   MDRV_MACHINE_RESET(kyugo)
478479
src/mame/drivers/leland.c
r3957r3958
4242
4343
4444#include "driver.h"
45#include "cpu/i86/i86.h"
4546#include "machine/eeprom.h"
4647#include "cpu/z80/z80.h"
4748#include "leland.h"
src/mame/drivers/mjsiyoub.c
r3957r3958
3131*/
3232
3333#include "driver.h"
34#include "cpu/z80/z80.h"
3435#include "sound/ay8910.h"
3536#include "sound/msm5205.h"
3637
src/mame/drivers/popeye.c
r3957r3958
444444static WRITE8_HANDLER( popeye_portB_w )
445445{
446446   /* bit 0 flips screen */
447   flip_screen_set(data & 1);
447   flip_screen_set(space->machine, data & 1);
448448
449449   /* bits 1-3 select DSW1 bit to read */
450450   dswbit = (data & 0x0e) >> 1;
src/mame/drivers/gstream.c
r3957r3958
9595*********************************************************************/
9696
9797#include "driver.h"
98#include "cpu/e132xs/e132xs.h"
9899#include "sound/okim6295.h"
99100
100101static UINT32 *gstream_vram;
src/mame/drivers/taxidrvr.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/z80/z80.h"
89#include "machine/8255ppi.h"
910#include "taxidrvr.h"
1011#include "sound/ay8910.h"
r3957r3958
4950
5051   /* bit 2 toggles during gameplay */
5152
52   flip_screen_set(data & 8);
53   flip_screen_set(device->machine, data & 8);
5354
5455//  popmessage("%02x",data&0x0f);
5556}
r3957r3958
373374   MDRV_CPU_IO_MAP(cpu3_port_map,0)
374375   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)   /* ??? */
375376
376   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
377   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
377378                     /* synchronization of the CPUs */
378379
379380   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
src/mame/drivers/blockade.c
r3957r3958
2929****************************************************************************/
3030
3131#include "driver.h"
32#include "cpu/i8085/i8085.h"
3233#include "includes/blockade.h"
3334#include "sound/samples.h"
3435#include "sound/discrete.h"
src/mame/drivers/compgolf.c
r3957r3958
1111****************************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/m6809/m6809.h"
1415#include "sound/2203intf.h"
1516
1617extern UINT8 *compgolf_bg_ram;
src/mame/drivers/cps2.c
r3957r3958
584584***************************************************************************/
585585
586586#include "driver.h"
587#include "cpu/z80/z80.h"
587588#include "deprecat.h"
588589#include "machine/eeprom.h"
589590#include "cpu/m68000/m68000.h"
r3957r3958
81168117   ROM_LOAD16_WORD_SWAP( "msh.12m",   0x200000, 0x200000, CRC(de092570) SHA1(a03d0df901f6ea79685eaed67db65bee14ec29c6) )
81178118ROM_END
81188119
8119ROM_START( sfz2aad )
8120ROM_START( sfz2ald )
81208121   ROM_REGION( CODE_SIZE, "main", 0 )      /* 68000 code */
81218122   ROM_LOAD16_WORD_SWAP( "szaad.03", 0x000000, 0x80000, CRC(89f9483b) SHA1(5da4f82ddc79d9b5697ba2fea96dcaf460118248) )
81228123   ROM_LOAD16_WORD_SWAP( "szaad.04", 0x080000, 0x80000, CRC(aef27ae5) SHA1(5877a05e7355195d686a4d0a97062aacbd3277ee) )
r3957r3958
85088509GAME( 1996, spf2xjd,  spf2t,   dead_cps2, cps2_2p2b, cps2,   ROT0,   "bootleg", "Super Puzzle Fighter II X (Japan 960531 Phoenix Edition) (bootleg)", 0 )
85098510GAME( 1996, ddsomud,  ddsom,   dead_cps2, cps2_4p4b, cps2,   ROT0,   "bootleg", "Dungeons & Dragons: Shadow over Mystara (USA 960619 Phoenix Edition) (bootleg)", 0 )
85108511GAME( 1996, megamn2d, megaman2,dead_cps2, cps2_2p3b, cps2,   ROT0,   "bootleg", "Mega Man 2: The Power Fighters (USA 960708 Phoenix Edition) (bootleg)", 0 )
8511GAME( 1996, sfz2aad,  sfa2,    dead_cps2, cps2_2p6b, cps2,   ROT0,   "bootleg", "Street Fighter Zero 2 Alpha (Asia 960826 Phoenix Edition) (bootleg)", 0 )
8512GAME( 1996, sfz2ald,  sfz2al,  dead_cps2, cps2_2p6b, cps2,   ROT0,   "bootleg", "Street Fighter Zero 2 Alpha (Asia 960826 Phoenix Edition) (bootleg)", 0 )
85128513GAME( 1996, xmvsfu1d, xmvsf,   dead_cps2, cps2_2p6b, cps2,   ROT0,   "bootleg", "X-Men Vs. Street Fighter (USA 961004 Phoenix Edition) (bootleg)", 0 )
85138514GAME( 1997, batcird,  batcir,  dead_cps2, cps2_4p2b, cps2,   ROT0,   "bootleg", "Battle Circuit (Euro 970319 Phoenix Edition) (bootleg)", 0 )
85148515GAME( 1997, vsavd,    vsav,    dead_cps2, cps2_2p6b, cps2,   ROT0,   "bootleg", "Vampire Savior: The Lord of Vampire (Euro 970519 Phoenix Edition) (bootleg)", 0 )
src/mame/drivers/lordgun.c
r3957r3958
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
30#include "cpu/m68000/m68000.h"
2931#include "machine/8255ppi.h"
3032#include "machine/eeprom.h"
3133#include "sound/3812intf.h"
src/mame/drivers/lemmings.c
r3957r3958
1616***************************************************************************/
1717
1818#include "driver.h"
19#include "cpu/m6809/m6809.h"
20#include "cpu/m68000/m68000.h"
1921#include "lemmings.h"
2022#include "sound/2151intf.h"
2123#include "sound/okim6295.h"
src/mame/drivers/pushman.c
r3957r3958
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/m68000/m68000.h"
2728#include "cpu/z80/z80.h"
2829#include "cpu/m6805/m6805.h"
2930#include "sound/2203intf.h"
r3957r3958
4243{
4344   if (ACCESSING_BITS_8_15)
4445   {
45      flip_screen_set(data & 0x0200);
46      flip_screen_set(space->machine, data & 0x0200);
4647      coin_counter_w(0, data & 0x4000);
4748      coin_counter_w(1, data & 0x8000);
4849   }
r3957r3958
463464   MDRV_CPU_ADD("mcu", M68705, 4000000)   /* No idea */
464465   MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
465466
466   MDRV_INTERLEAVE(60)
467   MDRV_QUANTUM_TIME(HZ(3600))
467468
468469   /* video hardware */
469470   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
501502   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
502503   MDRV_CPU_IO_MAP(sound_io_map,0)
503504
504   MDRV_INTERLEAVE(60)
505   MDRV_QUANTUM_TIME(HZ(3600))
505506
506507   MDRV_MACHINE_RESET(bballs)
507508
src/mame/drivers/zerozone.c
r3957r3958
2727
2828***************************************************************************/
2929#include "driver.h"
30#include "cpu/z80/z80.h"
31#include "cpu/m68000/m68000.h"
3032#include "sound/okim6295.h"
3133
3234VIDEO_START( zerozone );
r3957r3958
181183   MDRV_CPU_ADD("audio", Z80, 1000000)   /* 1 MHz ??? */
182184   MDRV_CPU_PROGRAM_MAP(sound_map,0)
183185
184   MDRV_INTERLEAVE(10)
186   MDRV_QUANTUM_TIME(HZ(600))
185187
186188   /* video hardware */
187189   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/espial.c
r3957r3958
1919static TIMER_CALLBACK( interrupt_disable )
2020{
2121   //interrupt_enable = 0;
22   cpu_interrupt_enable(0,0);
22   cpu_interrupt_enable(machine->cpu[0],0);
2323}
2424
2525MACHINE_RESET( espial )
src/mame/drivers/hyperspt.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/z80/z80.h"
89#include "machine/konami1.h"
910#include "cpu/m6809/m6809.h"
1011#include "sound/vlm5030.h"
src/mame/drivers/tiamc1.c
r3957r3958
115115*/
116116
117117#include "driver.h"
118#include "cpu/i8085/i8085.h"
118119#include "includes/tiamc1.h"
119120
120121static UINT8 *video_ram;
src/mame/drivers/toaplan1.c
r3957r3958
6262***************************************************************************/
6363
6464#include "driver.h"
65#include "cpu/z80/z80.h"
66#include "cpu/m68000/m68000.h"
6567#include "cpu/tms32010/tms32010.h"
6668#include "toaplan1.h"
6769#include "sound/3812intf.h"
r3957r3958
12491251   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
12501252   MDRV_CPU_IO_MAP(rallybik_sound_io_map, 0)
12511253
1252   MDRV_INTERLEAVE(10)
1254   MDRV_QUANTUM_TIME(HZ(600))
12531255
12541256   MDRV_MACHINE_RESET(toaplan1)
12551257
r3957r3958
12891291   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
12901292   MDRV_CPU_IO_MAP(truxton_sound_io_map, 0)
12911293
1292   MDRV_INTERLEAVE(10)
1294   MDRV_QUANTUM_TIME(HZ(600))
12931295
12941296   MDRV_MACHINE_RESET(toaplan1)
12951297
r3957r3958
13291331   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
13301332   MDRV_CPU_IO_MAP(hellfire_sound_io_map, 0)
13311333
1332   MDRV_INTERLEAVE(10)
1334   MDRV_QUANTUM_TIME(HZ(600))
13331335
13341336   MDRV_MACHINE_RESET(toaplan1)
13351337
r3957r3958
13691371   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
13701372   MDRV_CPU_IO_MAP(zerowing_sound_io_map, 0)
13711373
1372   MDRV_INTERLEAVE(10)
1374   MDRV_QUANTUM_TIME(HZ(600))
13731375
13741376   MDRV_MACHINE_RESET(zerozone)
13751377
r3957r3958
14131415   MDRV_CPU_PROGRAM_MAP(DSP_program_map,0)
14141416   MDRV_CPU_IO_MAP(DSP_io_map,0)
14151417
1416   MDRV_INTERLEAVE(10)
1418   MDRV_QUANTUM_TIME(HZ(600))
14171419
14181420   MDRV_MACHINE_RESET(demonwld)
14191421
r3957r3958
14871489   MDRV_CPU_PROGRAM_MAP(toaplan1_sound_map, 0)
14881490   MDRV_CPU_IO_MAP(outzone_sound_io_map, 0)
14891491
1490   MDRV_INTERLEAVE(10)
1492   MDRV_QUANTUM_TIME(HZ(600))
14911493
14921494   MDRV_MACHINE_RESET(zerozone)
14931495
src/mame/drivers/segag80r.c
r3957r3958
172172
173173static MACHINE_RESET( pignewt )
174174{
175   sega_usb_reset(0x10);
175   sega_usb_reset(machine, 0x10);
176176}
177177
178178
src/mame/drivers/magic10.c
r3957r3958
7171
7272
7373#include "driver.h"
74#include "cpu/m68000/m68000.h"
7475#include "sound/okim6295.h"
7576#include "sgsafari.lh"
7677
src/mame/drivers/hnayayoi.c
r3957r3958
3333****************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
3637#include "sound/2203intf.h"
3738#include "sound/msm5205.h"
3839
src/mame/drivers/shanghai.c
r3957r3958
2323***************************************************************************/
2424
2525#include "driver.h"
26#include "cpu/nec/nec.h"
2627#include "audio/seibu.h"
2728#include "video/hd63484.h"
2829
r3957r3958
496497
497498   SEIBU3A_SOUND_SYSTEM_CPU(14318180/4)
498499
499   MDRV_INTERLEAVE(200)
500   MDRV_QUANTUM_TIME(HZ(12000))
500501
501502   MDRV_MACHINE_RESET(seibu_sound)
502503
src/mame/drivers/jpmimpct.c
r3957r3958
7878****************************************************************************/
7979
8080#include "driver.h"
81#include "cpu/m68000/m68000.h"
8182#include "cpu/tms34010/tms34010.h"
8283#include "sound/upd7759.h"
8384#include "jpmimpct.h"
r3957r3958
850851   MDRV_CPU_CONFIG(tms_config)
851852   MDRV_CPU_PROGRAM_MAP(tms_program_map, 0)
852853
853   MDRV_INTERLEAVE(500)
854   MDRV_QUANTUM_TIME(HZ(30000))
854855   MDRV_MACHINE_RESET(jpmimpct)
855856   MDRV_NVRAM_HANDLER(generic_0fill)
856857
src/mame/drivers/namcos12.c
r3957r3958
922922*/
923923
924924#include "driver.h"
925#include "deprecat.h"
926925#include "cpu/mips/psx.h"
927926#include "cpu/h83002/h8.h"
928927#include "includes/psx.h"
r3957r3958
10161015   verboselog( space->machine, 1, "dmaoffset_w( %08x, %08x, %08x ) %08x\n", offset, data, mem_mask, m_n_dmaoffset );
10171016}
10181017
1019static void namcos12_rom_read( UINT32 n_address, INT32 n_size )
1018static void namcos12_rom_read( running_machine *machine, UINT32 n_address, INT32 n_size )
10201019{
1021   running_machine *machine = Machine;
10221020   const char *n_region;
10231021   int n_offset;
10241022
r3957r3958
15051503   MDRV_SOUND_ROUTE(2, "right", 1.00)
15061504   MDRV_SOUND_ROUTE(3, "left", 1.00)
15071505
1508   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
1506   MDRV_AT28C16_ADD( "at28c16", NULL )
15091507MACHINE_DRIVER_END
15101508
15111509static INPUT_PORTS_START( namcos12 )
src/mame/drivers/raiden2.c
r3957r3958
136136*/
137137
138138#include "driver.h"
139#include "cpu/nec/nec.h"
139140#include "cpu/z80/z80.h"
140141#include "audio/seibu.h"
141142#include "machine/eeprom.h"
src/mame/drivers/zodiack.c
r3957r3958
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "cpu/z80/z80.h"
2223#include "deprecat.h"
2324#include "sound/ay8910.h"
2425#include "includes/espial.h"
src/mame/drivers/scramble.c
r3957r3958
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
2930#include "cpu/s2650/s2650.h"
3031#include "machine/8255ppi.h"
3132#include "sound/ay8910.h"
src/mame/drivers/mogura.c
r3957r3958
11/* Mogura Desse */
22
33#include "driver.h"
4#include "cpu/z80/z80.h"
45#include "sound/dac.h"
56
67static UINT8 *mogura_tileram;
src/mame/drivers/mole.c
r3957r3958
4242// 0x3E7                    round point/passing point control?
4343
4444#include "driver.h"
45#include "cpu/m6502/m6502.h"
4546#include "sound/ay8910.h"
4647
4748
src/mame/drivers/system18.c
r3957r3958
840840}
841841
842842static MACHINE_RESET( mwalkbl ){
843   sys16_bg_priority_value=0x1000;
844   sys16_sprxoffset = -0x238;
843   static const sys16_patch patch[] =
844   {
845      { 0x70116, 0x4e },
846      { 0x70117, 0x71 },
845847
846   sys16_patch_code( 0x70116, 0x4e);
847   sys16_patch_code( 0x70117, 0x71);
848      { 0x0314a, 0x46 },
849      { 0x0314b, 0x42 },
850      { 0x0311b, 0x3f },
848851
849   sys16_patch_code( 0x314a, 0x46);
850   sys16_patch_code( 0x314b, 0x42);
852      { 0x70103, 0x00 },
853      { 0x70109, 0x00 },
854      { 0x07727, 0x00 },
855      { 0x07729, 0x00 },
856      { 0x0780d, 0x00 },
857      { 0x0780f, 0x00 },
858      { 0x07861, 0x00 },
859      { 0x07863, 0x00 },
860      { 0x07d47, 0x00 },
861      { 0x07863, 0x00 },
862      { 0x08533, 0x00 },
863      { 0x08535, 0x00 },
864      { 0x085bd, 0x00 },
865      { 0x085bf, 0x00 },
866      { 0x09a4b, 0x00 },
867      { 0x09a4d, 0x00 },
868      { 0x09b2f, 0x00 },
869      { 0x09b31, 0x00 },
870      { 0x0a05b, 0x00 },
871      { 0x0a05d, 0x00 },
872      { 0x0a23f, 0x00 },
873      { 0x0a241, 0x00 },
874      { 0x10159, 0x00 },
875      { 0x1015b, 0x00 },
876      { 0x109fb, 0x00 },
877      { 0x109fd, 0x00 },
851878
852   sys16_patch_code( 0x311b, 0x3f);
879      // * SEGA mark
880      { 0x70212, 0x4e },
881      { 0x70213, 0x71 }
882   };
853883
854   sys16_patch_code( 0x70103, 0x00);
855   sys16_patch_code( 0x70109, 0x00);
856   sys16_patch_code( 0x07727, 0x00);
857   sys16_patch_code( 0x07729, 0x00);
858   sys16_patch_code( 0x0780d, 0x00);
859   sys16_patch_code( 0x0780f, 0x00);
860   sys16_patch_code( 0x07861, 0x00);
861   sys16_patch_code( 0x07863, 0x00);
862   sys16_patch_code( 0x07d47, 0x00);
863   sys16_patch_code( 0x07863, 0x00);
864   sys16_patch_code( 0x08533, 0x00);
865   sys16_patch_code( 0x08535, 0x00);
866   sys16_patch_code( 0x085bd, 0x00);
867   sys16_patch_code( 0x085bf, 0x00);
868   sys16_patch_code( 0x09a4b, 0x00);
869   sys16_patch_code( 0x09a4d, 0x00);
870   sys16_patch_code( 0x09b2f, 0x00);
871   sys16_patch_code( 0x09b31, 0x00);
872   sys16_patch_code( 0x0a05b, 0x00);
873   sys16_patch_code( 0x0a05d, 0x00);
874   sys16_patch_code( 0x0a23f, 0x00);
875   sys16_patch_code( 0x0a241, 0x00);
876   sys16_patch_code( 0x10159, 0x00);
877   sys16_patch_code( 0x1015b, 0x00);
878   sys16_patch_code( 0x109fb, 0x00);
879   sys16_patch_code( 0x109fd, 0x00);
884   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
885   sys16_bg_priority_value=0x1000;
886   sys16_sprxoffset = -0x238;
880887
881   // * SEGA mark
882   sys16_patch_code( 0x70212, 0x4e);
883   sys16_patch_code( 0x70213, 0x71);
884
885888   sys16_update_proc = mwalkbl_update_proc;
886889}
887890
r3957r3958
989992}
990993
991994static MACHINE_RESET( astormbl ){
992   sys16_fgxoffset = sys16_bgxoffset = -9;
995   static const sys16_patch patch[] =
996   {
997      { 0x02D6E, 0x32 },
998      { 0x02D6F, 0x3c },
999      { 0x02D70, 0x80 },
1000      { 0x02D71, 0x00 },
1001      { 0x02D72, 0x33 },
1002      { 0x02D73, 0xc1 },
1003      { 0x02ea2, 0x30 },
1004      { 0x02ea3, 0x38 },
1005      { 0x02ea4, 0xec },
1006      { 0x02ea5, 0xf6 },
1007      { 0x02ea6, 0x30 },
1008      { 0x02ea7, 0x80 },
1009      { 0x02e5c, 0x30 },
1010      { 0x02e5d, 0x38 },
1011      { 0x02e5e, 0xec },
1012      { 0x02e5f, 0xe2 },
1013      { 0x02e60, 0xc0 },
1014      { 0x02e61, 0x7c },
9931015
994   sys16_patch_code( 0x2D6E, 0x32 );
995   sys16_patch_code( 0x2D6F, 0x3c );
996   sys16_patch_code( 0x2D70, 0x80 );
997   sys16_patch_code( 0x2D71, 0x00 );
998   sys16_patch_code( 0x2D72, 0x33 );
999   sys16_patch_code( 0x2D73, 0xc1 );
1000   sys16_patch_code( 0x2ea2, 0x30 );
1001   sys16_patch_code( 0x2ea3, 0x38 );
1002   sys16_patch_code( 0x2ea4, 0xec );
1003   sys16_patch_code( 0x2ea5, 0xf6 );
1004   sys16_patch_code( 0x2ea6, 0x30 );
1005   sys16_patch_code( 0x2ea7, 0x80 );
1006   sys16_patch_code( 0x2e5c, 0x30 );
1007   sys16_patch_code( 0x2e5d, 0x38 );
1008   sys16_patch_code( 0x2e5e, 0xec );
1009   sys16_patch_code( 0x2e5f, 0xe2 );
1010   sys16_patch_code( 0x2e60, 0xc0 );
1011   sys16_patch_code( 0x2e61, 0x7c );
1016      { 0x04cd8, 0x02 },
1017      { 0x04cec, 0x03 },
1018      { 0x2dc6c, 0xe9 },
1019      { 0x2dc64, 0x10 },
1020      { 0x2dc65, 0x10 },
1021      { 0x3a100, 0x10 },
1022      { 0x3a101, 0x13 },
1023      { 0x3a102, 0x90 },
1024      { 0x3a103, 0x2b },
1025      { 0x3a104, 0x00 },
1026      { 0x3a105, 0x01 },
1027      { 0x3a106, 0x0c },
1028      { 0x3a107, 0x00 },
1029      { 0x3a108, 0x00 },
1030      { 0x3a109, 0x01 },
1031      { 0x3a10a, 0x66 },
1032      { 0x3a10b, 0x06 },
1033      { 0x3a10c, 0x42 },
1034      { 0x3a10d, 0x40 },
1035      { 0x3a10e, 0x54 },
1036      { 0x3a10f, 0x8b },
1037      { 0x3a110, 0x60 },
1038      { 0x3a111, 0x02 },
1039      { 0x3a112, 0x30 },
1040      { 0x3a113, 0x1b },
1041      { 0x3a114, 0x34 },
1042      { 0x3a115, 0xc0 },
1043      { 0x3a116, 0x34 },
1044      { 0x3a117, 0xdb },
1045      { 0x3a118, 0x24 },
1046      { 0x3a119, 0xdb },
1047      { 0x3a11a, 0x24 },
1048      { 0x3a11b, 0xdb },
1049      { 0x3a11c, 0x4e },
1050      { 0x3a11d, 0x75 },
1051      { 0x0af8e, 0x66 },
10121052
1013   sys16_patch_code( 0x4cd8, 0x02 );
1014   sys16_patch_code( 0x4cec, 0x03 );
1015   sys16_patch_code( 0x2dc6c, 0xe9 );
1016   sys16_patch_code( 0x2dc64, 0x10 );
1017   sys16_patch_code( 0x2dc65, 0x10 );
1018   sys16_patch_code( 0x3a100, 0x10 );
1019   sys16_patch_code( 0x3a101, 0x13 );
1020   sys16_patch_code( 0x3a102, 0x90 );
1021   sys16_patch_code( 0x3a103, 0x2b );
1022   sys16_patch_code( 0x3a104, 0x00 );
1023   sys16_patch_code( 0x3a105, 0x01 );
1024   sys16_patch_code( 0x3a106, 0x0c );
1025   sys16_patch_code( 0x3a107, 0x00 );
1026   sys16_patch_code( 0x3a108, 0x00 );
1027   sys16_patch_code( 0x3a109, 0x01 );
1028   sys16_patch_code( 0x3a10a, 0x66 );
1029   sys16_patch_code( 0x3a10b, 0x06 );
1030   sys16_patch_code( 0x3a10c, 0x42 );
1031   sys16_patch_code( 0x3a10d, 0x40 );
1032   sys16_patch_code( 0x3a10e, 0x54 );
1033   sys16_patch_code( 0x3a10f, 0x8b );
1034   sys16_patch_code( 0x3a110, 0x60 );
1035   sys16_patch_code( 0x3a111, 0x02 );
1036   sys16_patch_code( 0x3a112, 0x30 );
1037   sys16_patch_code( 0x3a113, 0x1b );
1038   sys16_patch_code( 0x3a114, 0x34 );
1039   sys16_patch_code( 0x3a115, 0xc0 );
1040   sys16_patch_code( 0x3a116, 0x34 );
1041   sys16_patch_code( 0x3a117, 0xdb );
1042   sys16_patch_code( 0x3a118, 0x24 );
1043   sys16_patch_code( 0x3a119, 0xdb );
1044   sys16_patch_code( 0x3a11a, 0x24 );
1045   sys16_patch_code( 0x3a11b, 0xdb );
1046   sys16_patch_code( 0x3a11c, 0x4e );
1047   sys16_patch_code( 0x3a11d, 0x75 );
1048   sys16_patch_code( 0xaf8e, 0x66 );
1053      /* fix missing credit text */
1054      { 0x03f9a, 0xec },
1055      { 0x03f9b, 0x36 }
1056   };
10491057
1050   /* fix missing credit text */
1051   sys16_patch_code( 0x3f9a, 0xec );
1052   sys16_patch_code( 0x3f9b, 0x36 );
1053
1058   sys16_patch_code(machine, patch, ARRAY_LENGTH(patch));
1059   sys16_fgxoffset = sys16_bgxoffset = -9;
10541060   sys16_update_proc = astormbl_update_proc;
10551061}
10561062
src/mame/drivers/taitojc.c
r3957r3958
350350*/
351351
352352#include "driver.h"
353#include "cpu/tms32051/tms32051.h"
354#include "cpu/m68000/m68000.h"
353355#include "taito_f3.h"
354356#include "cpu/mc68hc11/mc68hc11.h"
355357#include "sound/es5506.h"
r3957r3958
13071309   MDRV_CPU_PROGRAM_MAP(tms_program_map, 0)
13081310   MDRV_CPU_DATA_MAP(tms_data_map, 0)
13091311
1310   MDRV_INTERLEAVE(100)
1312   MDRV_QUANTUM_TIME(HZ(6000))
13111313
13121314   MDRV_MACHINE_RESET(taitojc)
13131315   MDRV_NVRAM_HANDLER(93C46)
src/mame/drivers/missb2.c
r3957r3958
1414*/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
1718#include "sound/okim6295.h"
1819#include "sound/3812intf.h"
1920#include "includes/bublbobl.h"
r3957r3958
9697            x = sx + xc * 8;
9798            y = (sy + yc * 8) & 0xff;
9899
99            if (flip_screen_get())
100            if (flip_screen_get(screen->machine))
100101            {
101102               x = 248 - x;
102103               y = 248 - y;
r3957r3958
368369//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
369370   MDRV_CPU_VBLANK_INT("main", missb2_interrupt)
370371
371   MDRV_INTERLEAVE(100) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
372   MDRV_QUANTUM_TIME(HZ(6000)) // 100 CPU slices per frame - a high value to ensure proper synchronization of the CPUs
372373
373374   // video hardware
374375
src/mame/drivers/pitnrun.c
r3957r3958
6464*/
6565
6666#include "driver.h"
67#include "cpu/z80/z80.h"
6768#include "cpu/m6805/m6805.h"
6869#include "sound/ay8910.h"
6970#include "includes/pitnrun.h"
r3957r3958
8283
8384static WRITE8_HANDLER(pitnrun_hflip_w)
8485{
85   flip_screen_x_set(data);
86   flip_screen_x_set(space->machine, data);
8687}
8788
8889static WRITE8_HANDLER(pitnrun_vflip_w)
8990{
90   flip_screen_y_set(data);
91   flip_screen_y_set(space->machine, data);
9192}
9293
9394static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
r3957r3958
267268
268269   MDRV_MACHINE_RESET(pitnrun)
269270
270   MDRV_INTERLEAVE(100)
271   MDRV_QUANTUM_TIME(HZ(6000))
271272
272273   /* video hardware */
273274   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/liberatr.c
r3957r3958
134134******************************************************************************************/
135135
136136#include "driver.h"
137#include "cpu/m6502/m6502.h"
137138#include "deprecat.h"
138139#include "machine/atari_vg.h"
139140#include "sound/pokey.h"
src/mame/drivers/berzerk.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "exidy.h"
1314#include "machine/74181.h"
1415#include "sound/s14001a.h"
src/mame/drivers/tehkanwc.c
r3957r3958
671671   MDRV_CPU_IO_MAP(sound_port,0)
672672   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
673673
674   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
674   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - seems enough to keep the CPUs in sync */
675675
676676   /* video hardware */
677677   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bionicc.c
r3957r3958
5555********************************************************************/
5656
5757#include "driver.h"
58#include "cpu/z80/z80.h"
59#include "cpu/m68000/m68000.h"
5860#include "deprecat.h"
5961#include "sound/2151intf.h"
6062
src/mame/drivers/citycon.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/m6809/m6809.h"
1011#include "sound/ay8910.h"
1112#include "sound/2203intf.h"
1213
r3957r3958
2425
2526static READ8_HANDLER( citycon_in_r )
2627{
27   return input_port_read(space->machine, flip_screen_get() ? "P2" : "P1");
28   return input_port_read(space->machine, flip_screen_get(space->machine) ? "P2" : "P1");
2829}
2930
3031
src/mame/drivers/suprridr.c
r3957r3958
8080***************************************************************************/
8181
8282#include "driver.h"
83#include "cpu/z80/z80.h"
8384#include "suprridr.h"
8485#include "sound/ay8910.h"
8586
src/mame/drivers/igs009.c
r3957r3958
1111
1212- The hardware is similar to other IGS002 + IGS003 based boards.
1313  The interesting part is the background tilemap, that is designed specifically
14  for simulating the nine reels of a slot machine. The way it works is similar,
15  but more complicated than what's emulated in iqblock.c or goldstar.c.
16  It's not emulated properly yet, hence the game is not playable and marked NOT_WORKING.
14  for simulating the nine reels of a slot machine.
1715
1816***************************************************************************/
1917
r3957r3958
2725                                Video Hardware
2826***************************************************************************/
2927
30static UINT8   *fg_tile_ram, *fg_color_ram;
31static UINT8   *bg_tile_ram, *bg_scroll, *bg_scroll2;
3228
33static tilemap *fg_tilemap;
34static tilemap *bg_tilemap;
29static tilemap *gp98_reel1_tilemap;
30UINT8 *gp98_reel1_ram;
3531
36static int video_enable;
32WRITE8_HANDLER( gp98_reel1_ram_w )
33{
34   gp98_reel1_ram[offset] = data;
35   tilemap_mark_tile_dirty(gp98_reel1_tilemap,offset);
36}
3737
38static WRITE8_HANDLER( bg_scroll_w )
38static TILE_GET_INFO( get_jingbell_reel1_tile_info )
3939{
40   bg_scroll[offset] = data;
41   tilemap_set_scrolly(bg_tilemap,offset,data);
40   int code = gp98_reel1_ram[tile_index];
41
42   SET_TILE_INFO(
43         0,
44         (code)+(((tile_index+1)&0x3)*0x100),
45         0,
46         0);
4247}
4348
4449
45static TILE_GET_INFO( get_bg_tile_info )
50static TILE_GET_INFO( get_gp98_reel1_tile_info )
4651{
47   int code = bg_tile_ram[tile_index];
48   SET_TILE_INFO(0, code + ((tile_index+1) % 4) * 0x100, (code & 0x80) ? 0xc : 0, 0);
52   int code = gp98_reel1_ram[tile_index];
53
54   SET_TILE_INFO(
55         0,
56         (code*4)+(tile_index&0x3),
57         0,
58         0);
4959}
5060
51static WRITE8_HANDLER( bg_tile_w )
61static tilemap *gp98_reel2_tilemap;
62UINT8 *gp98_reel2_ram;
63
64WRITE8_HANDLER( gp98_reel2_ram_w )
5265{
53   bg_tile_ram[offset] = data;
54   tilemap_mark_tile_dirty(bg_tilemap,offset);
66   gp98_reel2_ram[offset] = data;
67   tilemap_mark_tile_dirty(gp98_reel2_tilemap,offset);
5568}
5669
70static TILE_GET_INFO( get_jingbell_reel2_tile_info )
71{
72   int code = gp98_reel2_ram[tile_index];
5773
74   SET_TILE_INFO(
75         0,
76         (code)+(((tile_index+1)&0x3)*0x100),
77         0,
78         0);
79}
80
81static TILE_GET_INFO( get_gp98_reel2_tile_info )
82{
83   int code = gp98_reel2_ram[tile_index];
84
85   SET_TILE_INFO(
86         0,
87         (code*4)+(tile_index&0x3),
88         0,
89         0);
90}
91
92
93static tilemap *gp98_reel3_tilemap;
94UINT8 *gp98_reel3_ram;
95
96WRITE8_HANDLER( gp98_reel3_ram_w )
97{
98   gp98_reel3_ram[offset] = data;
99   tilemap_mark_tile_dirty(gp98_reel3_tilemap,offset);
100}
101
102static TILE_GET_INFO( get_jingbell_reel3_tile_info )
103{
104   int code = gp98_reel3_ram[tile_index];
105
106   SET_TILE_INFO(
107         0,
108         (code)+(((tile_index+1)&0x3)*0x100),
109         0,
110         0);
111}
112
113static TILE_GET_INFO( get_gp98_reel3_tile_info )
114{
115   int code = gp98_reel3_ram[tile_index];
116
117   SET_TILE_INFO(
118         0,
119         (code*4)+(tile_index&0x3),
120         0,
121         0);
122}
123
124
125static tilemap *gp98_reel4_tilemap;
126UINT8 *gp98_reel4_ram;
127
128WRITE8_HANDLER( gp98_reel4_ram_w )
129{
130   gp98_reel4_ram[offset] = data;
131   tilemap_mark_tile_dirty(gp98_reel4_tilemap,offset);
132}
133
134static TILE_GET_INFO( get_jingbell_reel4_tile_info )
135{
136   int code = gp98_reel4_ram[tile_index];
137
138   SET_TILE_INFO(
139         0,
140         (code)+(((tile_index+1)&0x3)*0x100),
141         0,
142         0);
143}
144
145static TILE_GET_INFO( get_gp98_reel4_tile_info )
146{
147   int code = gp98_reel4_ram[tile_index];
148
149   SET_TILE_INFO(
150         0,
151         (code*4)+(tile_index&0x3),
152         0,
153         0);
154}
155
156
157
158
159static UINT8   *fg_tile_ram, *fg_color_ram;
160static UINT8   *bg_scroll, *bg_scroll2;
161
162static tilemap *fg_tilemap;
163
164static int video_enable;
165
166static WRITE8_HANDLER( bg_scroll_w )
167{
168   bg_scroll[offset] = data;
169//  tilemap_set_scrolly(bg_tilemap,offset,data);
170}
171
172
58173static TILE_GET_INFO( get_fg_tile_info )
59174{
60175   int code = fg_tile_ram[tile_index] | (fg_color_ram[tile_index] << 8);
r3957r3958
75190
76191static VIDEO_START(jingbell)
77192{
78   bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,   8, 32,   0x80,0x20);
79193   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,   8,  8,   0x80,0x20);
194   tilemap_set_transparent_pen(fg_tilemap, 0);
80195
81   tilemap_set_transparent_pen(bg_tilemap, 0);
196   gp98_reel1_tilemap = tilemap_create(machine,get_jingbell_reel1_tile_info,tilemap_scan_rows,8,32, 128, 8);
197   gp98_reel2_tilemap = tilemap_create(machine,get_jingbell_reel2_tile_info,tilemap_scan_rows,8,32, 128, 8);
198   gp98_reel3_tilemap = tilemap_create(machine,get_jingbell_reel3_tile_info,tilemap_scan_rows,8,32, 128, 8);
199   gp98_reel4_tilemap = tilemap_create(machine,get_jingbell_reel4_tile_info,tilemap_scan_rows,8,32, 128, 8);
200
201   tilemap_set_scroll_cols(gp98_reel1_tilemap, 128);
202   tilemap_set_scroll_cols(gp98_reel2_tilemap, 128);
203   tilemap_set_scroll_cols(gp98_reel3_tilemap, 128);
204   tilemap_set_scroll_cols(gp98_reel4_tilemap, 128);
205}
206
207
208static VIDEO_START(gp98)
209{
210   fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,   8,  8,   0x80,0x20);
82211   tilemap_set_transparent_pen(fg_tilemap, 0);
83212
84   tilemap_set_scroll_cols(bg_tilemap, 0x80);
213   gp98_reel1_tilemap = tilemap_create(machine,get_gp98_reel1_tile_info,tilemap_scan_rows,8,32, 128, 8);
214   gp98_reel2_tilemap = tilemap_create(machine,get_gp98_reel2_tile_info,tilemap_scan_rows,8,32, 128, 8);
215   gp98_reel3_tilemap = tilemap_create(machine,get_gp98_reel3_tile_info,tilemap_scan_rows,8,32, 128, 8);
216   gp98_reel4_tilemap = tilemap_create(machine,get_gp98_reel4_tile_info,tilemap_scan_rows,8,32, 128, 8);
217
218   tilemap_set_scroll_cols(gp98_reel1_tilemap, 128);
219   tilemap_set_scroll_cols(gp98_reel2_tilemap, 128);
220   tilemap_set_scroll_cols(gp98_reel3_tilemap, 128);
221   tilemap_set_scroll_cols(gp98_reel4_tilemap, 128);
222
85223}
86224
225
87226static VIDEO_UPDATE(jingbell)
88227{
89228   int layers_ctrl = video_enable ? -1 : 0;
r3957r3958
101240
102241   if (layers_ctrl & 1)
103242   {
104      if (1)
243      int zz,i;
244      int startclipmin = 0;
245      const rectangle *visarea = video_screen_get_visible_area(screen);
246
247
248      for (i= 0;i < 0x80;i++)
105249      {
106         // ********* experimental version of the bg rendering
107         int x,y,z, tmap, ystart = 0;
108         rectangle myclip;
250         tilemap_set_scrolly(gp98_reel1_tilemap, i, bg_scroll[i]*2);
251         tilemap_set_scrolly(gp98_reel2_tilemap, i, bg_scroll[i+0x80]*2);
252         tilemap_set_scrolly(gp98_reel3_tilemap, i, bg_scroll[i+0x100]*2);
253         tilemap_set_scrolly(gp98_reel4_tilemap, i, bg_scroll[i+0x180]*2);
254      }
109255
110         bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
111256
112         memcpy(&myclip,cliprect,sizeof(myclip));
113257
114         for (tmap = 0; tmap < 4; tmap++)
258
259      for (zz=0;zz<0x80-8;zz++) // -8 because of visible area (2*8 = 16)
260      {
261         rectangle clip;
262         int rowenable = bg_scroll2[zz];
263
264         /* draw top of screen */
265         clip.min_x = visarea->min_x;
266         clip.max_x = visarea->max_x;
267         clip.min_y = startclipmin;
268         clip.max_y = startclipmin+2;
269
270         bitmap_fill(bitmap,&clip,screen->machine->pens[rowenable]);
271
272         if (rowenable==0)
273         { // 0 and 1 are the same? or is there a global switchoff?
274            tilemap_draw(bitmap,&clip,gp98_reel1_tilemap,0,0);
275         }
276         else if (rowenable==1)
115277         {
116            myclip.min_y = ystart;
117            myclip.max_y = ystart+0x0100/4 - 1;
118            for (y = 0; y < 0x8; y++)
119            {
120               for (x = 0; x < 0x80; x++)
121               {
122                  int code = bg_tile_ram[x + y * 0x80 + bg_scroll2[tmap*0x20 + 4] * 0x80 * 0x8];
123                  for (z = 0; z < 2; z++)
124                  {
125                     drawgfx(bitmap,screen->machine->gfx[0],
126                           code + ((x+1) % 4) * 0x100, (code & 0x80) ? 0xc : 0,
127                           0, 0,
128                           x * 8, ystart + (y * 32 - ((bg_scroll[x + tmap * 0x80] + tmap*0x100/4) & 0xff)) + z * 0x8 * 0x20,
129   //                              &myclip, TRANSPARENCY_PEN, 0);
130                           &myclip, TRANSPARENCY_NONE, 0);
131                  }
132               }
133            }
134            ystart += 0x100/4;
278            tilemap_draw(bitmap,&clip,gp98_reel2_tilemap,0,0);
135279         }
136         // *********
280         else if (rowenable==2)
281         {
282            tilemap_draw(bitmap,&clip,gp98_reel3_tilemap,0,0);
283         }
284         else if (rowenable==3)
285         {
286            tilemap_draw(bitmap,&clip,gp98_reel4_tilemap,0,0);
287         }
288
289
290         startclipmin+=2;
137291      }
138      else            tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_OPAQUE, 0);
292
139293   }
140294   else               bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
141295
r3957r3958
250404   return 0;
251405}
252406
407
408
409
253410static ADDRESS_MAP_START( jingbell_map, ADDRESS_SPACE_PROGRAM, 8 )
254411   AM_RANGE( 0x00000, 0x0f3ff ) AM_ROM
255412   AM_RANGE( 0x0f400, 0x0ffff ) AM_RAM AM_BASE( &generic_nvram ) AM_SIZE( &generic_nvram_size )
r3957r3958
263420   AM_RANGE( 0x2000, 0x23ff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split1_w ) AM_BASE( &paletteram )
264421   AM_RANGE( 0x2400, 0x27ff ) AM_RAM_WRITE( paletteram_xBBBBBGGGGGRRRRR_split2_w ) AM_BASE( &paletteram_2 )
265422
266   AM_RANGE( 0x3000, 0x3fff ) AM_RAM_WRITE( bg_tile_w )  AM_BASE( &bg_tile_ram )
423   AM_RANGE( 0x3000, 0x33ff ) AM_RAM_WRITE( gp98_reel1_ram_w )  AM_BASE( &gp98_reel1_ram )
424   AM_RANGE( 0x3400, 0x37ff ) AM_RAM_WRITE( gp98_reel2_ram_w )  AM_BASE( &gp98_reel2_ram )
425   AM_RANGE( 0x3800, 0x3bff ) AM_RAM_WRITE( gp98_reel3_ram_w )  AM_BASE( &gp98_reel3_ram )
426   AM_RANGE( 0x3c00, 0x3fff ) AM_RAM_WRITE( gp98_reel4_ram_w )  AM_BASE( &gp98_reel4_ram )
267427
268428   AM_RANGE( 0x4000, 0x407f ) AM_RAM AM_BASE( &bg_scroll2 )
269429
r3957r3958
426586   GFXDECODE_ENTRY( "gfx2", 0, layout_8x8x6,  0, 16 )
427587GFXDECODE_END
428588
589static const gfx_layout tiles8x8_layout =
590{
591   8,8,
592   RGN_FRAC(1,3),
593   6,
594   { RGN_FRAC(2,3)+0, RGN_FRAC(2,3)+1, RGN_FRAC(1,3)+0, RGN_FRAC(1,3)+1, RGN_FRAC(0,3)+0, RGN_FRAC(0,3)+1 },
595   { 8,10,12,14, 0, 2, 4, 6, },
596   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
597   16*8
598};
429599
600static const gfx_layout tiles8x32_layout =
601{
602   8,32,
603   RGN_FRAC(1,3),
604   6,
605   { RGN_FRAC(2,3)+0, RGN_FRAC(2,3)+1, RGN_FRAC(1,3)+0, RGN_FRAC(1,3)+1, RGN_FRAC(0,3)+0, RGN_FRAC(0,3)+1 },
606   { 8,10,12,14, 0, 2, 4, 6, },
607   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16,9*16,10*16,11*16,12*16,13*16,14*16,15*16,16*16,17*16,18*16,19*16,20*16,21*16,22*16,23*16,24*16,25*16,26*16,27*16,28*16,29*16,30*16,31*16 },
608   32*16
609};
610
611static GFXDECODE_START( gp98 )
612   GFXDECODE_ENTRY( "gfx1", 0, tiles8x32_layout, 0, 16 )
613   GFXDECODE_ENTRY( "gfx2", 0, tiles8x8_layout, 0, 16 )
614GFXDECODE_END
615
616
430617/***************************************************************************
431618                                Machine Drivers
432619***************************************************************************/
r3957r3958
479666   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
480667MACHINE_DRIVER_END
481668
669static MACHINE_DRIVER_START( gp98 )
670   MDRV_IMPORT_FROM(jingbell)
671   MDRV_GFXDECODE(gp98)
672
673   MDRV_VIDEO_START(gp98)
674MACHINE_DRIVER_END
675
676
482677/***************************************************************************
483678
484679Jingle Bell
r3957r3958
571766   rom[0x01f19] = 0x18;
572767}
573768
769ROM_START( gp98 )
770   ROM_REGION( 0x20000, "main", 0 )
771   ROM_LOAD( "prg", 0x00000, 0x20000, CRC(1c02b8cc) SHA1(b8a29cbd96581f8ae1c1028279b8ee703be29f5f) )
772
773   ROM_REGION( 0x8000, "data", 0 )
774   ROM_COPY( "main", 0x10000, 0x00000, 0x8000 )
775
776   ROM_REGION( 0x180000, "gfx1", ROMREGION_DISPOSE ) // 6bpp (2bpp per rom) font at tile # 0x4000
777   ROM_LOAD( "49", 0x000000, 0x80000, BAD_DUMP CRC(a9d9367d) SHA1(91c74740fc8394f1e1cd68feb8c993afd2042d70) )
778   ROM_LOAD( "50", 0x080000, 0x80000, CRC(48f6190d) SHA1(b430131a258b4e2fc178ac0e3e3f0010a82eac65) )
779   ROM_LOAD( "51", 0x100000, 0x80000, CRC(30a2ef85) SHA1(38ea637acd83b175eccd2969ef21879265b88992) )
780
781   ROM_REGION( 0x180000, "gfx2", ROMREGION_DISPOSE ) // 6bpp (2bpp per rom) font at tile # 0x4000
782   ROM_COPY( "gfx1", 0x00000, 0x00000, 0x180000 )
783
784   ROM_REGION( 0x20000, "oki", ROMREGION_ERASE00 )
785   /* no OKI on this */
786ROM_END
787
574788GAME( 1995?, jingbell, 0, jingbell, jingbell, jingbell, ROT0, "IGS", "Jingle Bell (Italy, V133I)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_UNEMULATED_PROTECTION )
789GAME( 19??,  gp98,  0,    gp98,  jingbell,        0,        ROT0, "unknown", "Grand Prix '98",GAME_NOT_WORKING| GAME_NO_SOUND )
src/mame/drivers/spy.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/z80/z80.h"
2122#include "cpu/m6809/m6809.h"
2223#include "video/konamiic.h"
2324#include "sound/3812intf.h"
src/mame/drivers/psikyo.c
r3957r3958
6161*****/
6262
6363#include "driver.h"
64#include "cpu/z80/z80.h"
65#include "cpu/m68000/m68000.h"
6466#include "sound/2610intf.h"
6567#include "sound/ymf278b.h"
6668
src/mame/drivers/ampoker2.c
r3957r3958
356356#define MASTER_CLOCK   XTAL_6MHz
357357
358358#include "driver.h"
359#include "cpu/z80/z80.h"
359360#include "sound/ay8910.h"
360361#include "ampoker2.lh"
361362#include "sigmapkr.lh"
r3957r3958
10241025   MDRV_CPU_PROGRAM_MAP(ampoker2_map, 0)
10251026   MDRV_CPU_IO_MAP(ampoker2_io_map, 0)
10261027   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1536)
1027   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_MSEC(200))   /* 200 ms, measured */
1028   MDRV_WATCHDOG_TIME_INIT(MSEC(200))   /* 200 ms, measured */
10281029
10291030   MDRV_NVRAM_HANDLER(generic_0fill)
10301031
src/mame/drivers/dynadice.c
r3957r3958
3232*/
3333
3434#include "driver.h"
35#include "cpu/z80/z80.h"
36#include "cpu/i8085/i8085.h"
3537#include "sound/ay8910.h"
3638
3739static tilemap *bg_tilemap,*top_tilemap;
src/mame/drivers/playmark.c
r3957r3958
4040***************************************************************************/
4141
4242#include "driver.h"
43#include "cpu/m68000/m68000.h"
4344#include "machine/eeprom.h"
4445#include "cpu/pic16c5x/pic16c5x.h"
4546#include "sound/okim6295.h"
src/mame/drivers/dacholer.c
r3957r3958
1919******************************************************************************/
2020
2121#include "driver.h"
22#include "cpu/z80/z80.h"
2223#include "sound/dac.h"
2324#include "sound/msm5205.h"
2425#include "sound/ay8910.h"
r3957r3958
5455      tilemap_mark_all_tiles_dirty(bg_tilemap);
5556   }
5657
57   flip_screen_set(data & 0xc); // probably one bit for flipx and one for flipy
58   flip_screen_set(space->machine, data & 0xc); // probably one bit for flipx and one for flipy
5859
5960}
6061
r3957r3958
316317      sx = (spriteram[offs+3] - 128) + 256 * (attr & 0x01);
317318      sy = 248 - spriteram[offs];
318319
319      if (flip_screen_get())
320      if (flip_screen_get(machine))
320321      {
321322         sx = 240 - sx;
322323         sy = 240 - sy;
src/mame/drivers/esd16.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/z80/z80.h"
45#include "cpu/m68000/m68000.h"
4446#include "deprecat.h"
4547#include "machine/eeprom.h"
4648#include "sound/okim6295.h"
src/mame/drivers/jangou.c
r3957r3958
55driver by David Haywood,Angelo Salese and Phil Bennett
66
77TODO:
8-convert the video hw to true 4bpp;
9-some charset transparency pens are wrong,likely that the buffer trigger isn't correct;
108-unemulated screen flipping;
11-jngolady: if you do a soft reset sometimes the z80<->mcu communication fails,causing a
12 black screen after the title screen.
9-jngolady: RNG in this isn't working properly...looking at the code,when the mcu isn't on
10 irq routine there's a poll to the [8] ram address,unsurprisingly it's the RNG seed.
11 The problem is that when the rti opcode occurs the program flow doesn't return to feed the
12 RNG but executes another irq,probably there are too many irq pollings and the mcu goes out
13 of cycles...for now I'm kludging it,my guess is that it can be either a cpu bug,a comms bug
14 or 8 is really connected to a RNG seed and the starting code is just for initializing it.
1315
1416============================================================================================
1517Debug cheats:
1618
19*jangou
1720$c132 coin counter
1821$c088-$c095 player tiles
1922
20============================================================================================
21
22JANGOU (C)1982 Nichibutsu
23
24CPU:   Z80 *2
25XTAL:  19.968MHz
26SOUND: AY-3-8910
27
28Location 2-P: HARRIS HCI-55536-5
29Location 3-G: MB7051
30
31---
32
33Jangou Lady
34(c)1984 Nihon Bussan
35
36CPU:    Z80 x2 (#1,#2)
37    (40pin unknown:#3)
38SOUND:  AY-3-8910
39    MSM5218RS
40OSC:    19.968MHz
41    400KHz
42
43
441.5N    chr.
452.5M
463.5L
47
484.9P    Z80#1 prg.
495.9N
506.9M
517.9L
52
538.9H    Z80#2 prg.
549.9G
5510.9F
5611.9E
5712.9D
58
59M13.13  CPU#3 prg. (?)
60
61JL.3G   color
62
6323*******************************************************************************************/
6424
6525#include "driver.h"
26#include "cpu/z80/z80.h"
27#include "cpu/m6800/m6800.h"
6628#include "sound/ay8910.h"
6729#include "sound/hc55516.h"
6830#include "sound/msm5205.h"
r3957r3958
192154   int src,x,y,h,w, flipx;
193155   blit_data[offset] = data;
194156
195   /*trigger blitter write to ram,might not be correct...*/
196157   if(offset == 5)
197158   {
198//      printf("%02x %02x %02x %02x %02x %02x\n",blit_data[0],blit_data[1],blit_data[2],blit_data[3],blit_data[4],blit_data[5]);
159      //printf("%02x %02x %02x %02x %02x %02x\n",blit_data[0],blit_data[1],blit_data[2],blit_data[3],blit_data[4],blit_data[5]);
199160      w = (blit_data[4] & 0xff)+1;
200161      h = (blit_data[5] & 0xff)+1;
201162      src = ((blit_data[1]<<8)|(blit_data[0]<<0));
r3957r3958
221182               UINT8 cur_pen_hi = pen_data[(dat & 0xf0)>>4];
222183               UINT8 cur_pen_lo = pen_data[(dat & 0x0f)>>0];
223184
224               /*TODO: simplify this when blitter internal ram is converted to 4bpp*/
225               /*don't use hi & lo user-selected bits*/
226               if((cur_pen_hi & 0x20) && (cur_pen_lo & 0x20))
185               dat = cur_pen_lo | cur_pen_hi<<4;
186
187               if((dat & 0xff) != 0)
227188                  plot_jangou_gfx_pixel(dat, drawx,drawy);
228               else if(cur_pen_lo & 0x20)//use hi pen user-selected bit
229               {
230                  dat = (pen_data[cur_pen_hi]<<4) | (dat & 0xf);
231                  plot_jangou_gfx_pixel(dat, drawx,drawy);
232               }
233               else if(cur_pen_hi & 0x20)//use lo pen user-selected bit
234               {
235                  dat = (pen_data[cur_pen_lo]) | (dat & 0xf0);
236                  plot_jangou_gfx_pixel(dat, drawx,drawy);
237               }
238               else //use hi & lo pens user-selected bits
239               {
240                  dat = (pen_data[cur_pen_lo]) | (pen_data[cur_pen_hi]<<4);
241                  plot_jangou_gfx_pixel(dat, drawx,drawy);
242               }
243189
244190               if (!flipx)   count--;
245191               else count++;
r3957r3958
249195   }
250196}
251197
252/*Every offset of these registers controls a pen.
253  If the bit 6 (0x20) is high,use the pen from the internal gfx rom.
254  If the bit 6 is low,use an user-selected pen,defined by this register.*/
198/* What is the bit 5 (0x20) for?*/
255199static WRITE8_HANDLER( blit_vregs_w )
256200{
257   pen_data[offset] = data;
201//  printf("%02x %02x\n",offset,data);
202   pen_data[offset] = data & 0xf;
258203}
259204
260
261205/*************************************
262206 *
263207 *  I/O
r3957r3958
370314 *
371315 *************************************/
372316
373static UINT8 nsc_latch;
317static UINT8 nsc_latch,z80_latch;
374318
375319static READ8_HANDLER( master_com_r )
376320{
377   return nsc_latch;
321   return z80_latch;
378322}
379323
380324static WRITE8_HANDLER( master_com_w )
r3957r3958
390334
391335static WRITE8_HANDLER( slave_com_w )
392336{
393   nsc_latch = data;
394//  cpu_set_input_line(space->machine->cpu[0], 0, HOLD_LINE);
337   z80_latch = data;
395338}
396339
397340/*************************************
r3957r3958
465408   AM_RANGE(0xf000, 0xffff) AM_ROM
466409ADDRESS_MAP_END
467410
411/*************************************
412 *
413 *  Country Girl Memory Map
414 *
415 *************************************/
468416
417static ADDRESS_MAP_START( cntrygrl_cpu0_map, ADDRESS_SPACE_PROGRAM, 8 )
418   AM_RANGE(0x0000, 0x3fff) AM_ROM
419//  AM_RANGE(0xc000, 0xc7ff) AM_RAM
420   AM_RANGE(0xe000, 0xefff) AM_RAM
421ADDRESS_MAP_END
422
423static ADDRESS_MAP_START( cntrygrl_cpu0_io, ADDRESS_SPACE_IO, 8 )
424   ADDRESS_MAP_GLOBAL_MASK(0xff)
425   AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r)
426   AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
427   AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
428   AM_RANGE(0x10,0x10) AM_READ_PORT("DSW") //dsw + blitter busy flag
429   AM_RANGE(0x10,0x10) AM_WRITE(output_w)
430   AM_RANGE(0x11,0x11) AM_WRITE(mux_w)
431   AM_RANGE(0x12,0x17) AM_WRITE(blitter_process_w)
432   AM_RANGE(0x20,0x2f) AM_WRITE(blit_vregs_w )
433   AM_RANGE(0x30,0x30) AM_WRITENOP //? polls 0x03 continously
434//  AM_RANGE(0x31,0x31) AM_WRITE(sound_latch_w)
435ADDRESS_MAP_END
436
469437/*************************************
470438 *
471439 *  Input Port Definitions
r3957r3958
547515   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
548516INPUT_PORTS_END
549517
518static INPUT_PORTS_START( cntrygrl )
519   PORT_START("PL1_1")
520   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P Keep 1") PORT_CODE(KEYCODE_Z)
521   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P Keep 2") PORT_CODE(KEYCODE_X)
522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P Keep 3") PORT_CODE(KEYCODE_C)
523   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("1P Keep 4") PORT_CODE(KEYCODE_V)
524   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("1P Keep 5") PORT_CODE(KEYCODE_B)
525   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
526   PORT_START("PL1_2")
527   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("1P Play") PORT_CODE(KEYCODE_Q)
528   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
529   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) //probably a button
530   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) //probably a button
531   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("1P Flip Flop")
532   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("1P Bonus") PORT_CODE(KEYCODE_W)
533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("1P Take") PORT_CODE(KEYCODE_A)
534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
535   PORT_START("PL2_1")
536   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("2P Keep 1")
537   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("2P Keep 2")
538   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("2P Keep 3")
539   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("2P Keep 4")
540   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) PORT_NAME("2P Keep 5")
541   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
542   PORT_START("PL2_2")
543   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) PORT_NAME("2P Play")
544   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
545   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) //probably a button
546   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )PORT_PLAYER(2) //probably a button
547   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2) PORT_NAME("2P Flip Flop")
548   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_PLAYER(2) PORT_NAME("1P Bonus")
549   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_PLAYER(2) PORT_NAME("1P Take")
550   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
551   PORT_START("PL1_3")
552   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
553   PORT_START("PL2_3")
554   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
555   PORT_START("SYSTEM")
556   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
557   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
558   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
559   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
560   PORT_DIPNAME( 0x04, 0x04, "Memory Reset" )
561   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
562   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
563   PORT_DIPNAME( 0x08, 0x08, "Analyzer" )
564   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
565   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
566   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
567   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
568   PORT_DIPNAME( 0x40, 0x40, "Credit Clear" )
569   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
570   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
571   PORT_DIPNAME( 0x80, 0x00, "Two Pairs" )  PORT_DIPLOCATION("SW1:8")
572   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
573   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
574
575   PORT_START("DSW")
576   PORT_DIPNAME( 0x03, 0x03, "Maximum Rate")  PORT_DIPLOCATION("SW1:1,2")
577   PORT_DIPSETTING(    0x00, "90" )
578   PORT_DIPSETTING(    0x01, "83" )
579   PORT_DIPSETTING(    0x02, "76" )
580   PORT_DIPSETTING(    0x03, "69" )
581   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
582   PORT_DIPSETTING(    0x00, "3" )
583   PORT_DIPSETTING(    0x04, "2")
584   PORT_DIPSETTING(    0x08, "1" )
585   PORT_DIPSETTING(    0x0c, "0" )
586   PORT_DIPNAME( 0x10, 0x10, "Maximum Bet" )  PORT_DIPLOCATION("SW1:5")
587   PORT_DIPSETTING(    0x10, "1" )
588   PORT_DIPSETTING(    0x00, "20" )
589   PORT_DIPNAME( 0x20, 0x20, "Coin A setting" )  PORT_DIPLOCATION("SW1:6")
590   PORT_DIPSETTING(    0x20, DEF_STR( 1C_1C ) )
591   PORT_DIPSETTING(    0x00, "1 Coin / 25 Credits" )
592   PORT_DIPNAME( 0x40, 0x40, "Coin B setting"  )  PORT_DIPLOCATION("SW1:7")
593   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
594   PORT_DIPSETTING(    0x00, "1 Coin / 10 Credits"  )
595   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // blitter busy flag
596INPUT_PORTS_END
597
550598static INPUT_PORTS_START( jngolady )
551599   PORT_INCLUDE( jangou )
552600
r3957r3958
652700   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
653701MACHINE_DRIVER_END
654702
703static MACHINE_DRIVER_START( cntrygrl )
704   /* basic machine hardware */
705   MDRV_IMPORT_FROM(jangou)
655706
707   MDRV_CPU_MODIFY("cpu0")
708   MDRV_CPU_PROGRAM_MAP(0, cntrygrl_cpu0_map )
709   MDRV_CPU_IO_MAP(0,cntrygrl_cpu0_io )
710
711   MDRV_CPU_REMOVE("cpu1")
712
713   /* sound hardware */
714   MDRV_SOUND_START(NULL)
715   MDRV_SOUND_REMOVE("cvsd")
716MACHINE_DRIVER_END
717
718/*
719JANGOU (C)1982 Nichibutsu
720
721CPU:   Z80 *2
722XTAL:  19.968MHz
723SOUND: AY-3-8910
724
725Location 2-P: HARRIS HCI-55536-5
726Location 3-G: MB7051
727*/
728
656729ROM_START( jangou )
657730   ROM_REGION( 0x10000, "cpu0", 0 )
658731   ROM_LOAD( "jg05.bin", 0x00000, 0x02000, CRC(a3cfe33f) SHA1(9ad34a2167568316d242c990ea6fe42dadd4ac30) )
r3957r3958
672745   ROM_LOAD( "jg3_g.bin", 0x00, 0x20,  CRC(d389549d) SHA1(763486052b34f8a38247820109b114118a9f829f) )
673746ROM_END
674747
748/*
749Jangou Lady
750(c)1984 Nihon Bussan
751
752CPU:    Z80 x2 (#1,#2)
753    (40pin unknown:#3)
754SOUND:  AY-3-8910
755    MSM5218RS
756OSC:    19.968MHz
757    400KHz
758
759
7601.5N    chr.
7612.5M
7623.5L
763
7644.9P    Z80#1 prg.
7655.9N
7666.9M
7677.9L
768
7698.9H    Z80#2 prg.
7709.9G
77110.9F
77211.9E
77312.9D
774
775M13.13  CPU#3 prg. (?)
776
777JL.3G   color
778*/
779
675780ROM_START( jngolady )
676781   ROM_REGION( 0xa000, "cpu0", 0 )
677782   ROM_LOAD( "8.9h",  0x08000, 0x02000, CRC(69e31165) SHA1(81b166c101136ed453a4f4cd88445eb1da5dd0aa) )
r3957r3958
698803   ROM_LOAD( "3.5l", 0x04000, 0x04000, CRC(14688574) SHA1(241eaf1838239e38d11dff3556fb0a609a4b46aa) )
699804ROM_END
700805
701GAME( 1983, jangou,    0,    jangou,   jangou,    0, ROT0, "Nichibutsu", "Jangou",      GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL )
702GAME( 1984, jngolady,  0,    jngolady, jngolady,  0, ROT0, "Nichibutsu", "Jangou Lady", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL )
806ROM_START( cntrygrl )
807   ROM_REGION( 0x10000, "cpu0", 0 )
808   ROM_LOAD( "rom4.bin", 0x00000, 0x02000, CRC(adba8e2f) SHA1(2aae77838e3de6e665b32a7fe4ac3f627c35b871)  )
809   ROM_LOAD( "rom5.bin", 0x02000, 0x02000, CRC(24d210ed) SHA1(6a0eae9d459975fbaad75bf21284baac3ba4f872) )
810
811   /*wtf,these 2 roms are next to the CPU roms, one is a CPU rom from Moon Quasar, the other a GFX rom from Crazy Climber,
812      I dunno what's going on,game doesn't appear to need these two....*/
813   ROM_REGION( 0x1000, "user1", 0 )
814   ROM_LOAD( "rom6.bin", 0x00000, 0x0800, CRC(33965a89) SHA1(92912cea76a472d9b709c664d9818844a07fcc32)  ) // = mq3    Moon Quasar
815   ROM_LOAD( "rom7.bin", 0x00800, 0x0800, CRC(481b64cc) SHA1(3f35c545fc784ed4f969aba2d7be6e13a5ae32b7)  ) // = cc06   Crazy Climber (US)
816
817   ROM_REGION( 0x6000, "gfx", 0 )
818   ROM_LOAD( "rom1.bin", 0x00000, 0x02000, CRC(92033f37) SHA1(aa407c2feb1cbb7cbc6c59656338453c5a670749)  )
819   ROM_LOAD( "rom2.bin", 0x02000, 0x02000, CRC(0588cc48) SHA1(f769ece2955eb9f055c499b6243a2fead9d07984)  )
820   ROM_LOAD( "rom3.bin", 0x04000, 0x02000, CRC(ce00ff56) SHA1(c5e58707a5dd0f57c34b09de542ef30e96ab95d1)  )
821
822   ROM_REGION( 0x20, "proms", 0 )
823   ROM_LOAD( "countrygirl_prom.bin", 0x00, 0x20, CRC(dc54dc52) SHA1(db91a7ae05eb6b6e4b42f91dfe20ac0da6680b46)  )
824ROM_END
825
826/*Temporary kludge for make the RNG work*/
827static READ8_HANDLER( jngolady_rng_r )
828{
829   return mame_rand(space->machine);
830}
831
832static DRIVER_INIT( jngolady )
833{
834   memory_install_read8_handler(cpu_get_address_space(machine->cpu[2], ADDRESS_SPACE_PROGRAM), 0x08, 0x08, 0, 0, jngolady_rng_r );
835}
836
837
838
839/* flyer shows a bet version of Jangou Lady too,does it truly exists?*/
840GAME( 1983, jangou,    0,    jangou,   jangou,    0,        ROT0, "Nichibutsu",   "Jangou [BET] (Japan)", GAME_NO_COCKTAIL )
841/* Jangou Night */
842GAME( 1984, jngolady,  0,    jngolady, jngolady,  jngolady, ROT0, "Nichibutsu",   "Jangou Lady (Japan)", GAME_NO_COCKTAIL )
843GAME( 1984, cntrygrl,  0,    cntrygrl, cntrygrl,  0,        ROT0, "Royal Denshi", "Country Girl (Japan)",  GAME_NO_COCKTAIL )
src/mame/drivers/model3.c
r3957r3958
359359*/
360360
361361#include "driver.h"
362#include "cpu/m68000/m68000.h"
362363#include "deprecat.h"
363364#include "cpu/powerpc/ppc.h"
364365#include "machine/eeprom.h"
r3957r3958
379380static int model3_controls_bank;
380381static UINT32 real3d_device_id;
381382
382static void real3d_dma_callback(UINT32 src, UINT32 dst, int length, int byteswap);
383static void real3d_dma_callback(running_machine *machine, UINT32 src, UINT32 dst, int length, int byteswap);
383384
384385static UINT16 *model3_soundram;
385386
r3957r3958
765766   }
766767}
767768
768static UINT32 scsi_fetch(UINT32 dsp)
769static UINT32 scsi_fetch(running_machine *machine, UINT32 dsp)
769770{
770   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
771   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
771772   UINT32 result;
772773   result = memory_read_dword(space, dsp);
773774   return FLIPENDIAN_INT32(result);
r3957r3958
825826            int length = FLIPENDIAN_INT32((UINT32)(data >> 32)) * 4;
826827            if (dma_endian & 0x80)
827828            {
828               real3d_dma_callback(dma_source, dma_dest, length, 0);
829               real3d_dma_callback(space->machine, dma_source, dma_dest, length, 0);
829830            }
830831            else
831832            {
832               real3d_dma_callback(dma_source, dma_dest, length, 1);
833               real3d_dma_callback(space->machine, dma_source, dma_dest, length, 1);
833834            }
834835            dma_irq |= 0x01;
835836            scsi_irq_callback(space->machine, 1);
r3957r3958
871872   fatalerror("real3d_dma_w: %08X, %08X%08X, %08X%08X", offset, (UINT32)(data >> 32), (UINT32)(data), (UINT32)(mem_mask >> 32), (UINT32)(mem_mask));
872873}
873874
874static void real3d_dma_callback(UINT32 src, UINT32 dst, int length, int byteswap)
875static void real3d_dma_callback(running_machine *machine, UINT32 src, UINT32 dst, int length, int byteswap)
875876{
876   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
877   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
877878   switch(dst >> 24)
878879   {
879880      case 0x88:      /* Display List End Trigger */
r3957r3958
897898      case 0x9c:      /* Unknown */
898899         break;
899900      default:
900         fatalerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, cpu_get_pc(Machine->cpu[0]));
901         fatalerror("dma_callback: %08X, %08X, %d at %08X", src, dst, length, cpu_get_pc(machine->cpu[0]));
901902         break;
902903   }
903904}
r3957r3958
981982static void configure_fast_ram(running_machine *machine)
982983{
983984   /* set conservative DRC options */
984   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS - PPCDRC_ACCURATE_SINGLES);
985   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS - PPCDRC_ACCURATE_SINGLES);
985986
986987   /* configure fast RAM regions for DRC */
987   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
988   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
989   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x007fffff);
990   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
991   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
988   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
989   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
990   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x007fffff);
991   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
992   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
992993}
993994
994995static MACHINE_START(model3_10)
995996{
996   lsi53c810_init(&scsi_intf);
997   lsi53c810_init(machine, &scsi_intf);
997998   add_exit_callback(machine, model3_exit);
998999   configure_fast_ram(machine);
9991000}
10001001static MACHINE_START(model3_15)
10011002{
1002   lsi53c810_init(&scsi_intf);
1003   lsi53c810_init(machine, &scsi_intf);
10031004   add_exit_callback(machine, model3_exit);
10041005   configure_fast_ram(machine);
10051006}
r3957r3958
10221023
10231024   // copy the 68k vector table into RAM
10241025   memcpy(model3_soundram, memory_region(machine, "audio")+0x80000, 16);
1025   cpu_reset(cputag_get_cpu(machine, "audio"));
1026   device_reset(cputag_get_cpu(machine, "audio"));
10261027
10271028   model3_machine_init(step);   // step 1.5
10281029   model3_tap_reset();
r3957r3958
43424343   MDRV_CPU_ADD("audio", M68000, 12000000)
43434344   MDRV_CPU_PROGRAM_MAP(model3_snd, 0)
43444345
4345    MDRV_INTERLEAVE(10)
4346    MDRV_QUANTUM_TIME(HZ(600))
43464347
43474348   MDRV_MACHINE_START(model3_10)
43484349   MDRV_MACHINE_RESET(model3_10)
src/mame/drivers/namcos21.c
r3957r3958
289289  JP3
290290*/
291291#include "driver.h"
292#include "cpu/m68000/m68000.h"
293#include "cpu/m6805/m6805.h"
292294#include "deprecat.h"
293295#include "namcos2.h"
294296#include "cpu/m6809/m6809.h"
r3957r3958
557559}
558560
559561static UINT16
560ReadWordFromSlaveInput( void )
562ReadWordFromSlaveInput( const address_space *space )
561563{
562564   UINT16 data = 0;
563565   if( mpDspState->slaveBytesAvailable>0 )
r3957r3958
569571      {
570572         mpDspState->slaveBytesAdvertised--;
571573      }
572      logerror( "%s:-%04x(0x%04x)\n", cpuexec_describe_context(Machine), data, mpDspState->slaveBytesAvailable );
574      logerror( "%s:-%04x(0x%04x)\n", cpuexec_describe_context(space->machine), data, mpDspState->slaveBytesAvailable );
573575   }
574576   return data;
575577} /* ReadWordFromSlaveInput */
r3957r3958
887889
888890static READ16_HANDLER(slave_port0_r)
889891{
890   return ReadWordFromSlaveInput();
892   return ReadWordFromSlaveInput(space);
891893} /* slave_port0_r */
892894
893895static WRITE16_HANDLER(slave_port0_w)
r3957r3958
15591561   MDRV_CPU_DATA_MAP(slave_dsp_data,0)
15601562   MDRV_CPU_IO_MAP(slave_dsp_io,0)
15611563
1562   MDRV_INTERLEAVE(200)
1564   MDRV_QUANTUM_TIME(HZ(12000))
15631565
15641566   MDRV_MACHINE_START(namcos2)
15651567   MDRV_MACHINE_RESET(namcos2)
r3957r3958
16331635   MDRV_CPU_DATA_MAP(winrun_dsp_data,0)
16341636   MDRV_CPU_IO_MAP(winrun_dsp_io,0)
16351637
1636   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
1638   MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame */
16371639
16381640   MDRV_MACHINE_START(namcos2)
16391641   MDRV_MACHINE_RESET(namcos2)
r3957r3958
16921694   MDRV_CPU_PROGRAM_MAP(am_gpu_winrun,0)
16931695   MDRV_CPU_VBLANK_INT("main", namcos2_68k_gpu_vblank)
16941696
1695   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
1697   MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame */
16961698
16971699   MDRV_MACHINE_START(namcos2)
16981700   MDRV_MACHINE_RESET(namcos2)
src/mame/drivers/pgm.c
r3957r3958
281281#define PGMARM7SPEEDHACK 1
282282
283283#include "driver.h"
284#include "cpu/z80/z80.h"
285#include "cpu/m68000/m68000.h"
286#include "cpu/arm7/arm7.h"
284287#include "deprecat.h"
285288#include "sound/ics2115.h"
286289#include "cpu/arm7/arm7core.h"
src/mame/drivers/iqblock.c
r3957r3958
5050***************************************************************************/
5151
5252#include "driver.h"
53#include "cpu/z80/z80.h"
54#include "cpu/z180/z180.h"
5355#include "deprecat.h"
5456#include "machine/8255ppi.h"
5557#include "iqblock.h"
src/mame/drivers/gameplan.c
r3957r3958
6464****************************************************************************/
6565
6666#include "driver.h"
67#include "cpu/m6502/m6502.h"
6768#include "machine/6532riot.h"
6869#include "machine/6522via.h"
6970#include "sound/ay8910.h"
src/mame/drivers/ikki.c
r3957r3958
99*****************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "deprecat.h"
1314#include "sound/sn76496.h"
1415
r3957r3958
201202   MDRV_CPU_PROGRAM_MAP(ikki_cpu2,0)
202203   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
203204
204   MDRV_INTERLEAVE(10)
205   MDRV_QUANTUM_TIME(HZ(600))
205206
206207   /* video hardware */
207208   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/darius.c
r3957r3958
127127***************************************************************************/
128128
129129#include "driver.h"
130#include "cpu/m68000/m68000.h"
130131#include "video/taitoic.h"
131132#include "cpu/z80/z80.h"
132133#include "audio/taitosnd.h"
r3957r3958
845846   MDRV_CPU_PROGRAM_MAP(darius_sound2_readmem,darius_sound2_writemem)
846847   MDRV_CPU_IO_MAP(darius_sound2_io_map,0)
847848
848   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame ? */
849   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame ? */
849850
850851   MDRV_MACHINE_START(darius)
851852   MDRV_MACHINE_RESET(darius)
src/mame/drivers/ssingles.c
r3957r3958
2222*/
2323
2424#include "driver.h"
25#include "cpu/z80/z80.h"
2526#include "sound/ay8910.h"
2627#include "video/mc6845.h"
2728
r3957r3958
8687static const mc6845_interface mc6845_intf =
8788{
8889      "main",
89      1000000, /* ? MHz */
9090      8,
9191      NULL,
9292      update_row,
r3957r3958
271271   MDRV_VIDEO_START(ssingles)
272272   MDRV_VIDEO_UPDATE(ssingles)
273273
274   MDRV_DEVICE_ADD("crtc", MC6845)
275   MDRV_DEVICE_CONFIG(mc6845_intf)
274   MDRV_MC6845_ADD("crtc", MC6845, 1000000 /* ? MHz */, mc6845_intf)
276275
277276   /* sound hardware */
278277   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/kinst.c
r3957r3958
190190   }
191191
192192   /* set the fastest DRC options */
193   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS);
193   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS);
194194
195195   /* configure fast RAM regions for DRC */
196   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
197   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x08000000);
198   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x087fffff);
199   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase2);
200   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
196   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
197   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x08000000);
198   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x087fffff);
199   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase2);
200   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
201201
202   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
203   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
204   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x0007ffff);
205   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
206   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
202   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
203   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
204   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x0007ffff);
205   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
206   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
207207
208   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 2);
209   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
210   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
211   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
212   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
208   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 2);
209   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
210   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
211   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
212   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
213213}
214214
215215
src/mame/drivers/cbasebal.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
1617#include "includes/cps1.h"
1718#include "machine/eeprom.h"
1819#include "sound/okim6295.h"
src/mame/drivers/st0016.c
r3957r3958
88*/
99
1010#include "driver.h"
11#include "cpu/v810/v810.h"
1112#include "deprecat.h"
1213#include "cpu/z80/z80.h"
1314#include "sound/st0016.h"
r3957r3958
452453   MDRV_CPU_IO_MAP(st0016_m2_io,0)
453454   MDRV_CPU_ADD("sub", V810, 10000000)//25 Mhz ?
454455   MDRV_CPU_PROGRAM_MAP(v810_mem,0)
455   MDRV_INTERLEAVE(1)
456   MDRV_QUANTUM_TIME(HZ(60))
456457MACHINE_DRIVER_END
457458
458459/*************************************
src/mame/drivers/cchasm.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
17#include "cpu/m68000/m68000.h"
1618#include "video/vector.h"
1719#include "machine/6840ptm.h"
1820#include "machine/z80ctc.h"
r3957r3958
161163   MDRV_CPU_PROGRAM_MAP(sound_memmap,0)
162164   MDRV_CPU_IO_MAP(sound_portmap,0)
163165
164   MDRV_Z80CTC_ADD("ctc", cchasm_ctc_intf)
166   MDRV_Z80CTC_ADD("ctc", 3584229 /* same as "audio" */, cchasm_ctc_intf)
165167
166168   MDRV_MACHINE_START(cchasm)
167169
src/mame/drivers/sbasketb.c
r3957r3958
3939***************************************************************************/
4040
4141#include "driver.h"
42#include "cpu/z80/z80.h"
4243#include "machine/konami1.h"
4344#include "cpu/m6809/m6809.h"
4445#include "sound/vlm5030.h"
src/mame/drivers/smstrv.c
r3957r3958
285285*/
286286
287287#include "driver.h"
288#include "cpu/i86/i86.h"
288289#include "sound/ay8910.h"
289290#include "machine/8255ppi.h"
290291
src/mame/drivers/funkyjet.c
r3957r3958
8888***************************************************************************/
8989
9090#include "driver.h"
91#include "cpu/m68000/m68000.h"
9192#include "cpu/h6280/h6280.h"
9293#include "sound/2151intf.h"
9394#include "sound/okim6295.h"
src/mame/drivers/skyarmy.c
r3957r3958
2121
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425#include "sound/ay8910.h"
2526
2627static UINT8 *skyarmy_videoram;
src/mame/drivers/ksayakyu.c
r3957r3958
6464*/
6565
6666#include "driver.h"
67#include "cpu/z80/z80.h"
6768#include "deprecat.h"
6869#include "sound/ay8910.h"
6970#include "sound/dac.h"
r3957r3958
249250   MDRV_CPU_PROGRAM_MAP(soundcpu_map,0)
250251   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
251252
252   MDRV_INTERLEAVE(1000)
253   MDRV_QUANTUM_TIME(HZ(60000))
253254
254255   /* video hardware */
255256   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/qix.c
r3957r3958
222222***************************************************************************/
223223
224224#include "driver.h"
225#include "cpu/m6805/m6805.h"
225226#include "rendlay.h"
226227#include "machine/6821pia.h"
227228#include "qix.h"
r3957r3958
559560
560561   /* high interleave needed to ensure correct text in service mode */
561562   /* Zookeeper settings and high score table seem especially sensitive to this */
562   MDRV_INTERLEAVE(1000)
563   MDRV_QUANTUM_TIME(HZ(60000))
563564
564565   MDRV_MACHINE_START(qix)
565566   MDRV_MACHINE_RESET(qix)
r3957r3958
603604   /* basic machine hardware */
604605   MDRV_IMPORT_FROM(qix)
605606
606   MDRV_CPU_REPLACE("main", M6809, SLITHER_CLOCK_OSC/4/4)   /* 1.34 MHz */
607   MDRV_CPU_MODIFY("main")
608   MDRV_CPU_CLOCK(SLITHER_CLOCK_OSC/4/4)   /* 1.34 MHz */
607609
608610   MDRV_MACHINE_START(slither)
609611
src/mame/drivers/suprgolf.c
r3957r3958
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/z80/z80.h"
1819#include "sound/2203intf.h"
1920
2021static tilemap *suprgolf_tilemap;
src/mame/drivers/xexex.c
r3957r3958
6262***************************************************************************/
6363
6464#include "driver.h"
65#include "cpu/m68000/m68000.h"
6566#include "deprecat.h"
6667#include "video/konamiic.h"
6768#include "cpu/z80/z80.h"
r3957r3958
463464   MDRV_CPU_ADD("audio", Z80, 8000000)
464465   MDRV_CPU_PROGRAM_MAP(sound_map,0)
465466
466   MDRV_INTERLEAVE(32)
467   MDRV_QUANTUM_TIME(HZ(1920))
467468
468469   MDRV_MACHINE_START(xexex)
469470   MDRV_MACHINE_RESET(xexex)
src/mame/drivers/wallc.c
r3957r3958
4848****************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "video/resnet.h"
5253#include "sound/ay8910.h"
5354
src/mame/drivers/marinedt.c
r3957r3958
9595*/
9696
9797#include "driver.h"
98#include "cpu/z80/z80.h"
9899
99100static bitmap_t *tile, *obj1, *obj2;
100101static tilemap *tx_tilemap;
src/mame/drivers/ironhors.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "deprecat.h"
1112#include "cpu/m6809/m6809.h"
1213#include "sound/2203intf.h"
src/mame/drivers/battlex.c
r3957r3958
4141
4242
4343#include "driver.h"
44#include "cpu/z80/z80.h"
4445#include "deprecat.h"
4546#include "sound/ay8910.h"
4647
src/mame/drivers/skullxbo.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "skullxbo.h"
src/mame/drivers/adp.c
r3957r3958
144144*/
145145
146146#include "driver.h"
147#include "cpu/m68000/m68000.h"
147148#include "sound/ay8910.h"
148149#include "video/hd63484.h"
149150#include "machine/microtch.h"
r3957r3958
174175   }
175176};
176177
177static void microtouch_tx(UINT8 data)
178static void microtouch_tx(running_machine *machine, UINT8 data)
178179{
179180   duart68681_rx_data(skattv_devices.duart68681, 0, data);
180181}
r3957r3958
196197
197198static const duart68681_config skattv_duart68681_config =
198199{
199   XTAL_8_664MHz / 2, //??
200200   duart_irq_handler,
201201   duart_tx,
202202   duart_input,
r3957r3958
535535   MDRV_MACHINE_START(skattv)
536536   MDRV_MACHINE_RESET(skattv)
537537
538   MDRV_DEVICE_ADD( "duart68681", DUART68681 )
539   MDRV_DEVICE_CONFIG( skattv_duart68681_config )
538   MDRV_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2, skattv_duart68681_config )
540539
541540   MDRV_SCREEN_ADD("main", RASTER)
542541   MDRV_SCREEN_REFRESH_RATE(30)
r3957r3958
564563   MDRV_MACHINE_START(skattv)
565564   MDRV_MACHINE_RESET(skattv)
566565
567   MDRV_DEVICE_ADD( "duart68681", DUART68681 )
568   MDRV_DEVICE_CONFIG( skattv_duart68681_config )
566   MDRV_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2, skattv_duart68681_config )
569567
570568   MDRV_SCREEN_ADD("main", RASTER)
571569   MDRV_SCREEN_REFRESH_RATE(30)
src/mame/drivers/sliver.c
r3957r3958
6565*/
6666
6767#include "driver.h"
68#include "cpu/m68000/m68000.h"
6869#include "deprecat.h"
6970#include "sound/okim6295.h"
7071#include "cpu/mcs51/mcs51.h"
src/mame/drivers/konamigq.c
r3957r3958
4646*/
4747
4848#include "driver.h"
49#include "cpu/m68000/m68000.h"
4950#include "cpu/mips/psx.h"
5051#include "includes/psx.h"
5152#include "machine/konamigx.h"
r3957r3958
278279
279280static UINT8 sector_buffer[ 512 ];
280281
281static void scsi_dma_read( UINT32 n_address, INT32 n_size )
282static void scsi_dma_read( running_machine *machine, UINT32 n_address, INT32 n_size )
282283{
283284   int i;
284285   int n_this;
r3957r3958
311312   }
312313}
313314
314static void scsi_dma_write( UINT32 n_address, INT32 n_size )
315static void scsi_dma_write( running_machine *machine, UINT32 n_address, INT32 n_size )
315316{
316317}
317318
src/mame/drivers/epos.c
r3957r3958
2929***************************************************************************/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
3233#include "machine/8255ppi.h"
3334#include "sound/ay8910.h"
3435#include "epos.h"
src/mame/drivers/mrflea.c
r3957r3958
278278   MDRV_CPU_IO_MAP(inout_io_map,0)
279279   MDRV_CPU_VBLANK_INT_HACK(mrflea_io_interrupt,2)
280280
281   MDRV_INTERLEAVE(100)
281   MDRV_QUANTUM_TIME(HZ(6000))
282282
283283   /* video hardware */
284284   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/cps3.c
r3957r3958
725725   int i;
726726
727727   // set strict verify
728   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY);
728   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY);
729729
730730   cps3_key1 = -1;
731731   cps3_key2 = -1;
src/mame/drivers/spiders.c
r3957r3958
496496static const mc6845_interface mc6845_intf =
497497{
498498   "main",               /* screen we are acting on */
499   CRTC_CLOCK,          /* the clock (pin 21) of the chip */
500499   8,                  /* number of pixels per video memory address */
501500   begin_update,         /* before pixel update callback */
502501   update_row,            /* row update callback */
r3957r3958
705704   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
706705   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256)   /* temporary, CRTC will configure screen */
707706
708   MDRV_DEVICE_ADD("crtc", MC6845)
709   MDRV_DEVICE_CONFIG(mc6845_intf)
707   MDRV_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf)
710708
711709   /* 74LS123 */
712710
713   MDRV_DEVICE_ADD("ic60", TTL74123)
714   MDRV_DEVICE_CONFIG(ic60_intf)
711   MDRV_TTL74123_ADD("ic60", ic60_intf)
715712
716713   /* audio hardware */
717714   MDRV_IMPORT_FROM(spiders_audio)
src/mame/drivers/snesb.c
r3957r3958
8080
8181***************************************************************************/
8282#include "driver.h"
83#include "cpu/spc700/spc700.h"
84#include "cpu/g65816/g65816.h"
8385#include "includes/snes.h"
8486
8587static INT8 *shared_ram;
r3957r3958
551553   MDRV_CPU_ADD("sound", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
552554   MDRV_CPU_PROGRAM_MAP(spc_mem, 0)
553555
554   MDRV_INTERLEAVE(600)
556   MDRV_QUANTUM_TIME(HZ(36000))
555557
556558   MDRV_MACHINE_START( snes )
557559   MDRV_MACHINE_RESET( snes )
src/mame/drivers/mcatadv.c
r3957r3958
136136******************************************************************************/
137137
138138#include "driver.h"
139#include "cpu/z80/z80.h"
140#include "cpu/m68000/m68000.h"
139141#include "sound/2610intf.h"
140142#include "includes/mcatadv.h"
141143
r3957r3958
490492   MDRV_GFXDECODE(mcatadv)
491493   MDRV_PALETTE_LENGTH(0x2000/2)
492494
493   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
495   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
494496
495497   MDRV_VIDEO_START(mcatadv)
496498   MDRV_VIDEO_EOF(mcatadv) // Buffer Spriteram
src/mame/drivers/toaplan2.c
r3957r3958
243243
244244
245245#include "driver.h"
246#include "cpu/z180/z180.h"
247#include "cpu/nec/nec.h"
246248#include "cpu/m68000/m68000.h"
247249#include "cpu/z80/z80.h"
248250#include "machine/eeprom.h"
r3957r3958
308310      This is important for games with common RAM; the RAM test will fail
309311      when leaving service mode if the sound CPU is not reset.
310312    */
311   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)toaplan2_reset);
313   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_RESET_CALLBACK, (genf *)toaplan2_reset);
312314}
313315
314316static MACHINE_RESET( ghox )
r3957r3958
35823584   MDRV_CPU_ADD("audio", Z80,XTAL_27MHz/8)         /* verified on pcb */
35833585   MDRV_CPU_PROGRAM_MAP(sound_z80_mem, 0)
35843586
3585   MDRV_INTERLEAVE(10)
3587   MDRV_QUANTUM_TIME(HZ(600))
35863588
35873589   MDRV_MACHINE_RESET(toaplan2)
35883590
r3957r3958
36223624                                 /* Change this to 10MHz when HD647180 gets dumped. 10MHz Oscillator */
36233625   MDRV_CPU_PROGRAM_MAP(sound_z80_mem, 0)
36243626
3625   MDRV_INTERLEAVE(10)
3627   MDRV_QUANTUM_TIME(HZ(600))
36263628
36273629   MDRV_MACHINE_RESET(toaplan2)
36283630
r3957r3958
36613663   MDRV_CPU_ADD("audio", Z80, XTAL_27MHz/8)         /* ??? 3.37MHz */
36623664   MDRV_CPU_PROGRAM_MAP(sound_z80_mem, 0)
36633665
3664   MDRV_INTERLEAVE(10)
3666   MDRV_QUANTUM_TIME(HZ(600))
36653667
36663668   MDRV_MACHINE_RESET(toaplan2)
36673669
r3957r3958
39143916   MDRV_CPU_ADD("audio", Z80, XTAL_32MHz/8)      /* 4MHz , 32MHz Oscillator */
39153917   MDRV_CPU_PROGRAM_MAP(raizing_sound_z80_mem, 0)
39163918
3917   MDRV_INTERLEAVE(10)
3919   MDRV_QUANTUM_TIME(HZ(600))
39183920
39193921   MDRV_MACHINE_RESET(toaplan2)
39203922
r3957r3958
39563958   MDRV_CPU_ADD("audio", Z80, XTAL_32MHz/8)      /* 4MHz , 32MHz Oscillator */
39573959   MDRV_CPU_PROGRAM_MAP(raizing_sound_z80_mem, 0)
39583960
3959   MDRV_INTERLEAVE(10)
3961   MDRV_QUANTUM_TIME(HZ(600))
39603962
39613963   MDRV_MACHINE_RESET(toaplan2)
39623964
r3957r3958
39984000   MDRV_CPU_ADD("audio", Z80, XTAL_32MHz/8)      /* 4MHz , 32MHz Oscillator */
39994001   MDRV_CPU_PROGRAM_MAP(bgaregga_sound_z80_mem, 0)
40004002
4001   MDRV_INTERLEAVE(100)
4003   MDRV_QUANTUM_TIME(HZ(6000))
40024004
40034005   MDRV_MACHINE_RESET(bgaregga)
40044006
r3957r3958
40414043   MDRV_CPU_PROGRAM_MAP(batrider_sound_z80_mem, 0)
40424044   MDRV_CPU_IO_MAP(batrider_sound_z80_port, 0)
40434045
4044   MDRV_INTERLEAVE(10)
4046   MDRV_QUANTUM_TIME(HZ(600))
40454047
40464048   MDRV_MACHINE_RESET(bgaregga)
40474049
r3957r3958
40874089   MDRV_CPU_IO_MAP(bbakraid_sound_z80_port, 0)
40884090   MDRV_CPU_PERIODIC_INT(bbakraid_snd_interrupt, 448)
40894091
4090   MDRV_INTERLEAVE(10)
4092   MDRV_QUANTUM_TIME(HZ(600))
40914093
40924094   MDRV_MACHINE_RESET(toaplan2)
40934095   MDRV_NVRAM_HANDLER(bbakraid)
src/mame/drivers/mjkjidai.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/z80/z80.h"
2526#include "streams.h"
2627#include "sound/sn76496.h"
2728#include "sound/okim6295.h"
r3957r3958
4647   UINT8 *base;
4748} mjkjidai_adpcm;
4849
49static void mjkjidai_adpcm_callback (void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
50static STREAM_UPDATE( mjkjidai_adpcm_callback )
5051{
5152   struct mjkjidai_adpcm_state *state = param;
5253   stream_sample_t *dest = outputs[0];
src/mame/drivers/jchan.c
r3957r3958
168168*/
169169
170170#include "driver.h"
171#include "cpu/m68000/m68000.h"
171172#include "deprecat.h"
172173#include "sound/ymz280b.h"
173174#include "includes/suprnova.h"
src/mame/drivers/jailbrek.c
r3957r3958
6161{
6262   nmi_enable = data & 0x01;
6363   irq_enable = data & 0x02;
64   flip_screen_set(data & 0x08);
64   flip_screen_set(space->machine, data & 0x08);
6565}
6666
6767static INTERRUPT_GEN( jb_interrupt )
src/mame/drivers/mlanding.c
r3957r3958
44*/
55
66#include "driver.h"
7#include "cpu/z80/z80.h"
8#include "cpu/m68000/m68000.h"
79#include "deprecat.h"
810#include "audio/taitosnd.h"
911#include "sound/2151intf.h"
src/mame/drivers/gaelco.c
r3957r3958
231231   MDRV_CPU_ADD("audio", M6809, 8867000/4)   /* 68B09, 2.21675 MHz? */
232232   MDRV_CPU_PROGRAM_MAP(bigkarnk_readmem_snd,bigkarnk_writemem_snd)
233233
234   MDRV_INTERLEAVE(10)
234   MDRV_QUANTUM_TIME(HZ(600))
235235
236236   /* video hardware */
237237   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
624624   MDRV_CPU_PROGRAM_MAP(squash_readmem,squash_writemem)
625625   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
626626
627   MDRV_INTERLEAVE(10)
627   MDRV_QUANTUM_TIME(HZ(600))
628628
629629   /* video hardware */
630630   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
775775   MDRV_CPU_PROGRAM_MAP(squash_readmem,thoop_writemem)
776776   MDRV_CPU_VBLANK_INT("main", irq6_line_hold)
777777
778   MDRV_INTERLEAVE(10)
778   MDRV_QUANTUM_TIME(HZ(600))
779779
780780   /* video hardware */
781781   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bankp.c
r3957r3958
9696
9797
9898#include "driver.h"
99#include "cpu/z80/z80.h"
99100#include "sound/sn76496.h"
100101
101102
src/mame/drivers/tankbust.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "sound/ay8910.h"
2122
2223
r3957r3958
350351   MDRV_CPU_PROGRAM_MAP(map_cpu2,0)
351352   MDRV_CPU_IO_MAP(port_map_cpu2,0)
352353
353   MDRV_INTERLEAVE(100)
354   MDRV_QUANTUM_TIME(HZ(6000))
354355
355356   MDRV_MACHINE_RESET( tankbust )
356357
src/mame/drivers/wecleman.c
r3957r3958
270270***************************************************************************/
271271
272272#include "driver.h"
273#include "cpu/z80/z80.h"
274#include "cpu/m68000/m68000.h"
273275#include "deprecat.h"
274276#include "video/konamiic.h"
275277#include "cpu/m6809/m6809.h"
r3957r3958
10891091   MDRV_CPU_ADD("audio", Z80, 3579545)
10901092   MDRV_CPU_PROGRAM_MAP(wecleman_sound_map,0)
10911093
1092   MDRV_INTERLEAVE(100)
1094   MDRV_QUANTUM_TIME(HZ(6000))
10931095
10941096   MDRV_MACHINE_RESET(wecleman)
10951097
r3957r3958
11461148
11471149   /* Amuse: every 2 ms */
11481150
1149   MDRV_INTERLEAVE(100)
1151   MDRV_QUANTUM_TIME(HZ(6000))
11501152
11511153   /* video hardware */
11521154   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/crbaloon.c
r3957r3958
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/z80/z80.h"
1819#include "crbaloon.h"
1920
2021
r3957r3958
5354}
5455
5556
56static void pc3092_update(void)
57static void pc3092_update(running_machine *machine)
5758{
58   flip_screen_set((pc3092_data[1] & 0x01) ? TRUE : FALSE);
59   flip_screen_set(machine, (pc3092_data[1] & 0x01) ? TRUE : FALSE);
5960}
6061
6162
r3957r3958
6566
6667   if (LOG_PC3092) logerror("%04X:  write PC3092 #%d = 0x%02x\n", cpu_get_pc(space->cpu), offset, pc3092_data[offset]);
6768
68   pc3092_update();
69   pc3092_update(space->machine);
6970}
7071
7172
r3957r3958
159160static WRITE8_HANDLER( port_sound_w )
160161{
161162   /* D0 - interrupt enable - also goes to PC3259 as /HTCTRL */
162   cpu_interrupt_enable(0, (data & 0x01) ? TRUE : FALSE);
163   cpu_interrupt_enable(space->machine->cpu[0], (data & 0x01) ? TRUE : FALSE);
163164   crbaloon_set_clear_collision_address((data & 0x01) ? TRUE : FALSE);
164165
165166   /* D1 - SOUND STOP */
src/mame/drivers/dmndrby.c
r3957r3958
22G4001
33Diamond Derby - Electrocoin on an SNK board
44
5this seems to be a gambling game
5SWP gambling game base on horse racing
66
7SNK/Electrocoin 1987
7SNK/Electrocoin 1986
8Re-released in 1994 (see dderbya) for changed uk gaming rules.
89
910--------------------------------------------
1011G4001UP01
r3957r3958
3334 2114              H10
3435
3536
37 Driver Improvements by Mike Green
38
3639*/
3740
3841#include "driver.h"
42#include "cpu/z80/z80.h"
43#include "sound/ay8910.h"
44#include "video/resnet.h"
3945
40static UINT8* dderby_vid;
46static UINT8* dderby_vidchars;
47static UINT8* dderby_soundmem;
48static UINT8* scroll_ram;
49static UINT8* dderby_vidattribs;
50static UINT8* sprite_ram;
51static UINT8 *nvram;
52static UINT8 *main_rom;
53static UINT8 *main_ram;
54static size_t nvram_size;
55static UINT8 *racetrack_tilemap_rom;
56static tilemap *racetrack_tilemap;
4157
42static READ8_HANDLER( dderby_random_reader )
58static NVRAM_HANDLER( dderby )
4359{
44   return mame_rand(space->machine);
60   if (read_or_write)
61      mame_fwrite(file,nvram,nvram_size);
62   else if (file)
63      mame_fread(file,nvram,nvram_size);
4564}
4665
66static WRITE8_HANDLER( dderby_sound_w )
67{
68   static UINT8 last=0;
69   if(data!=last)
70      soundlatch_w(space,0,data);
71
72   last=data;
73}
74
75
4776static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 )
48   AM_RANGE(0x0000, 0x5fff) AM_ROM
49   AM_RANGE(0x8000, 0x8fff) AM_RAM
50   AM_RANGE(0xC000, 0xC007) AM_READ(dderby_random_reader)
51   AM_RANGE(0xC802, 0xC802) AM_READ(dderby_random_reader)
52   AM_RANGE(0xC803, 0xC803) AM_READ(dderby_random_reader)
53   AM_RANGE(0xCA01, 0xCA01) AM_WRITE(SMH_NOP)
54   AM_RANGE(0xD000, 0xD7ff) AM_RAM AM_BASE(&dderby_vid)
77   AM_RANGE(0x0000, 0x5fff) AM_ROM AM_BASE(&main_rom)
78//  AM_RANGE(0x6000,0x67ff) AM_RAM AM_SHARE(1)
79//  AM_RANGE(0x8810, 0x8810) AM_WRITE(SMH_NOP) // sound hook?
80//  AM_RANGE(0x8810, 0x8810) AM_READ(dderby_ff)
81   AM_RANGE(0x8811, 0x8811) AM_READ_PORT("IN2") // ??? doubt if this is dip 2.
82//  AM_RANGE(0x8bab, 0x8bab) AM_READ_PORT("IN1") // ??? doubt if this is dip 2.
83//  AM_RANGE(0x8baa, 0x8baa) AM_READ_PORT("IN1") // ??? doubt if this is dip 2.
84//  AM_RANGE(0x8000, 0x8fff) AM_RAM AM_BASE(&main_ram)
85   AM_RANGE(0x8880, 0x8880) AM_MIRROR(0x8) AM_READ_PORT("KEY0") // ??? doubt if this is dip 2.
86   AM_RANGE(0x8881, 0x8881) AM_MIRROR(0x8) AM_READ_PORT("KEYA") // ??? doubt if this is dip 2.
87   AM_RANGE(0x8882, 0x8882) AM_READ_PORT("KEY1") //AM_MIRROR(0x8)// ??? doubt if this is dip 2.
88   AM_RANGE(0x8883, 0x8883) AM_MIRROR(0x8) AM_READ_PORT("KEY2") // ??? doubt if this is dip 2.
89   AM_RANGE(0x8884, 0x8884) AM_MIRROR(0x8) AM_READ_PORT("KEY3") // ??? doubt if this is dip 2.
90   AM_RANGE(0x8885, 0x8885) AM_MIRROR(0x8) AM_READ_PORT("KEY4") // ??? COLLECT??
91   AM_RANGE(0x8886, 0x8886) AM_MIRROR(0x8) AM_READ_PORT("KEY5") // ??? doubt if this is dip 2.
92   AM_RANGE(0x8887, 0x8887) AM_MIRROR(0x8) AM_READ_PORT("KEY6") // ??? doubt if this is dip 2.
93   AM_RANGE(0x8888, 0x8888) AM_READ_PORT("KEY7") // ??? doubt if this is dip 2.
94   AM_RANGE(0x8889, 0x8889) AM_READ_PORT("KEY8") // ??? doubt if this is dip 2.
95   AM_RANGE(0x888a, 0x888a) AM_READ_PORT("KEY9") // ??? doubt if this is dip 2.
96//  AM_RANGE(0x888e, 0x888e) AM_READ_PORT("KEY0") // ??? doubt if this is dip 2.
97/*  AM_RANGE(0x888f, 0x888f) AM_READ_PORT("KEYA") // ??? doubt if this is dip 2.
98    AM_RANGE(0x888a, 0x888a) AM_READ_PORT("KEY1") // ??? doubt if this is dip 2.
99    AM_RANGE(0x888b, 0x888b) AM_READ_PORT("KEY2") // ??? doubt if this is dip 2.
100    AM_RANGE(0x888c, 0x888c) AM_READ_PORT("KEY3") // ??? doubt if this is dip 2.
101    AM_RANGE(0x888d, 0x888d) AM_READ_PORT("KEY4") // ??? COLLECT??
102    AM_RANGE(0x888e, 0x888e) AM_READ_PORT("KEY5") // ??? doubt if this is dip 2.
103*/
104//  AM_RANGE(0x8887, 0x8887) AM_READ_PORT("KEY6") // ??? doubt if this is dip 2.
105
106//  AM_RANGE(0x8887, 0x8887) AM_READ_PORT("IN1") // ??? doubt if this is dip 2.
107//  AM_RANGE(0x8889, 0x8889) AM_READ_PORT("IN2")
108
109   AM_RANGE(0x8887, 0x8887) AM_MIRROR(0x8) AM_READ_PORT("SERVICE")
110//  AM_RANGE(0x888f, 0x888f) AM_READ_PORT("SERVICE")
111
112   AM_RANGE(0x8888, 0x8888) AM_MIRROR(0x8) AM_READ_PORT("DOOR")
113//  AM_RANGE(0x8890, 0x8890) AM_READ_PORT("DOOR")
114
115   AM_RANGE(0x8892, 0x8892) AM_MIRROR(0x8) AM_READ_PORT("DOOR2")
116//  AM_RANGE(0x889a, 0x889a) AM_READ_PORT("DOOR2")
117   AM_RANGE(0x8893, 0x8893) AM_MIRROR(0x8)AM_READ_PORT("DOOR3")
118//  AM_RANGE(0x889b, 0x889b) AM_READ_PORT("DOOR3")
119
120   AM_RANGE(0x8e00, 0x8fff) AM_RAM // nvram maybe!
121
122   AM_RANGE(0x8000, 0x8dff) AM_RAM AM_BASE(&main_ram)
123
124   AM_RANGE(0xC000, 0xC007) AM_RAM // shared ram to 2nd cpu?? battery backed ram?
125
126   AM_RANGE(0xC802, 0xC802) AM_READ_PORT("DSW") // first dip
127//  AM_RANGE(0xc803, 0xc803) AM_READ_PORT("IN1") // ??? doubt if this is dip 2.
128
129   AM_RANGE(0xCA02, 0xCA03) AM_RAM AM_WRITE(dderby_sound_w) // BEST GUESS SO FAR!
130   AM_RANGE(0xCA00, 0xCA00) AM_RAM AM_WRITE(dderby_sound_w) // BEST GUESS SO FAR!
131   AM_RANGE(0xCA00, 0xCA03) AM_RAM //AM_WRITE(SMH_NOP) // sound hook?
132
133   AM_RANGE(0xCC00, 0xCC05) AM_RAM AM_BASE(&scroll_ram)
134
135// CORRECT HERE (I THINK!)
136   AM_RANGE(0xCE08, 0XCE1F) AM_RAM AM_BASE(&sprite_ram) // horse sprites
137   AM_RANGE(0xD000, 0xD3ff) AM_RAM AM_BASE(&dderby_vidchars) // char ram
138   AM_RANGE(0xD400, 0xD7ff) AM_RAM AM_BASE(&dderby_vidattribs) // colours/ attrib ram
139
55140ADDRESS_MAP_END
56141
142static ADDRESS_MAP_START( dderby_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
143   AM_RANGE(0x0000, 0x0fff) AM_ROM
144   AM_RANGE(0x6000, 0x67ff) AM_RAM AM_BASE(&dderby_soundmem) AM_SHARE(1)
145   AM_RANGE(0x1000, 0x1000) AM_RAM
146   AM_RANGE(0x4000, 0x4000) AM_WRITE(ay8910_control_port_0_w)
147   AM_RANGE(0x4001, 0x4001) AM_READWRITE(ay8910_read_port_0_r,ay8910_write_port_0_w)
57148
149   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_r)
150
151ADDRESS_MAP_END
152
58153static INPUT_PORTS_START( dderby )
59   PORT_START("IN0")   /* 8bit */
60   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
154
155   PORT_START("SERVICE")
156   PORT_DIPNAME(0xff,0xff,"Refill Key")
157   PORT_DIPSETTING(0xff, DEF_STR( Off ))
158   PORT_DIPSETTING(0x00,DEF_STR( On ))
159   PORT_START("KEY0")
160   PORT_DIPNAME(0xff,0xff,"KEY0")
161   PORT_DIPSETTING(0xff, DEF_STR( Off ))
162   PORT_DIPSETTING(0x00,DEF_STR( On ))
163   PORT_START("KEYA")
164   PORT_DIPNAME(0xff,0xff,"KEYA")
165   PORT_DIPSETTING(0xff, DEF_STR( Off ))
166   PORT_DIPSETTING(0x00,DEF_STR( On ))
167
168
169   PORT_START("KEY1")
170   PORT_DIPNAME(0xff,0xff,"KEY1")
171   PORT_DIPSETTING(0xff, DEF_STR( Off ))
172   PORT_DIPSETTING(0x00,DEF_STR( On ))
173
174   PORT_START("KEY2")
175   PORT_DIPNAME(0xff,0xff,"KEY2")
176   PORT_DIPSETTING(0xff, DEF_STR( Off ))
177   PORT_DIPSETTING(0x00,DEF_STR( On ))
178
179   PORT_START("KEY3")
180   PORT_DIPNAME(0xff,0xff,"KEY3")
181   PORT_DIPSETTING(0xff, DEF_STR( Off ))
182   PORT_DIPSETTING(0x00,DEF_STR( On ))
183
184   PORT_START("KEY4")
185   PORT_DIPNAME(0xff,0xff,"KEY4")
186   PORT_DIPSETTING(0xff, DEF_STR( Off ))
187   PORT_DIPSETTING(0x00,DEF_STR( On ))
188
189   PORT_START("KEY5")
190   PORT_DIPNAME(0xff,0xff,"KEY5")
191   PORT_DIPSETTING(0xff, DEF_STR( Off ))
192   PORT_DIPSETTING(0x00,DEF_STR( On ))
193
194   PORT_START("KEY6")
195   PORT_DIPNAME(0xff,0xff,"KEY6")
196   PORT_DIPSETTING(0xff, DEF_STR( Off ))
197   PORT_DIPSETTING(0x00,DEF_STR( On ))
198
199   PORT_START("KEY7")
200   PORT_DIPNAME(0xff,0xff,"KEY7")
201   PORT_DIPSETTING(0xff, DEF_STR( Off ))
202   PORT_DIPSETTING(0x00,DEF_STR( On ))
203
204   PORT_START("KEY8")
205   PORT_DIPNAME(0xff,0xff,"KEY8")
206   PORT_DIPSETTING(0xff, DEF_STR( Off ))
207   PORT_DIPSETTING(0x00,DEF_STR( On ))
208
209   PORT_START("KEY9")
210   PORT_DIPNAME(0xff,0xff,"KEY9")
211   PORT_DIPSETTING(0xff, DEF_STR( Off ))
212   PORT_DIPSETTING(0x00,DEF_STR( On ))
213
214   PORT_START("DOOR")
215   PORT_DIPNAME(0x02,0x02,"Door")
216   PORT_DIPSETTING(0x02, "Open")
217   PORT_DIPSETTING(0x00," CLOSED")
218   PORT_START("DOOR2")
219   PORT_DIPNAME(0x02,0x02,"Door")
220   PORT_DIPSETTING(0x02, "Open")
221   PORT_DIPSETTING(0x00," CLOSED")
222   PORT_START("DOOR3")
223   PORT_DIPNAME(0x02,0x02,"Door")
224   PORT_DIPSETTING(0x02, "Open")
225   PORT_DIPSETTING(0x00," CLOSED")
226
227   PORT_START("DSW")   /* 8bit */
228   PORT_DIPNAME( 0x01, 0x01, " Unknown 1")
61229   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
62230   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
63   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
231   PORT_DIPNAME( 0x08, 0x08, " Unknown 2" )
232   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
233   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
234   PORT_DIPNAME( 0x06, 0x00, "Max Prize" )
235   PORT_DIPSETTING(    0x06, "240p (cash)" )
236   PORT_DIPSETTING(    0x02, "300p (cash)" )
237   PORT_DIPSETTING(    0x04, "480p (cash + tokens)" )
238   PORT_DIPSETTING(    0x00, "600p (cash + tokens)" )
239   PORT_DIPNAME( 0x30, 0x00, "Percentage Payout" )
240   PORT_DIPSETTING(    0x00, "76%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_LESSTHAN, 0x80)
241   PORT_DIPSETTING(    0x10, "80%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_LESSTHAN, 0x80)
242   PORT_DIPSETTING(    0x20, "86%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_LESSTHAN, 0x80)
243   PORT_DIPSETTING(    0x30, "88%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_LESSTHAN, 0x80)
244
245   PORT_DIPSETTING(    0x00, "78%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_NOTLESSTHAN, 0x80)
246   PORT_DIPSETTING(    0x10, "82%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_NOTLESSTHAN, 0x80)
247   PORT_DIPSETTING(    0x20, "86%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_NOTLESSTHAN, 0x80)
248   PORT_DIPSETTING(    0x30, "90%" )   PORT_CONDITION("DSW", 0xc0, PORTCOND_NOTLESSTHAN, 0x80)
249
250   PORT_DIPNAME( 0xc0, 0x80, "Price Per Game" )
251   PORT_DIPSETTING(    0x00, "2p" )
252   PORT_DIPSETTING(    0x40, "5p" )
253   PORT_DIPSETTING(    0x80, "10p" )
254   PORT_DIPSETTING(    0xc0, "20p" )
255
256   PORT_START("IN1")   /* 8bit */
257   PORT_DIPNAME( 0x01, 0x01, "Show Results")
258   PORT_DIPSETTING(    0x01, "Last Race" )
259   PORT_DIPSETTING(    0x00, "Last 6 Races" )
260   PORT_DIPNAME( 0x02, 0x02, " Unknown 2" )
64261   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
65262   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
66   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
263   PORT_DIPNAME( 0x04, 0x04, " Unknown 3" )
67264   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
68265   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
69   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
266   PORT_DIPNAME( 0x08, 0x08, " Unknown 4" )
70267   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
71268   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
72   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
269   PORT_DIPNAME( 0x10, 0x10, " Unknown 5")
73270   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
74271   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
75   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
272   PORT_DIPNAME( 0x20, 0x20, " Unknown 6" )
76273   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
77274   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
78   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
275   PORT_DIPNAME( 0x40, 0x40, " Unknown 7" )
79276   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
80277   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
81   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
278   PORT_DIPNAME( 0x80, 0x80, " Unknown 8" )
82279   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
83280   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
281
282   PORT_START("IN2")   /* 8bit */
283   PORT_DIPNAME( 0x01, 0x00, " Unknown 1") // token error ???
284   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
285   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
286   PORT_DIPNAME( 0x02, 0x02, " Unknown 2" )
287   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
288   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
289   PORT_DIPNAME( 0x04, 0x04, " Unknown 3" )
290   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
291   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
292   PORT_DIPNAME( 0x08, 0x08, " Unknown 4" )
293   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
294   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
295   PORT_DIPNAME( 0x10, 0x10, " Unknown 1")
296   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
297   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
298   PORT_DIPNAME( 0x20, 0x20, " Unknown 2" )
299   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
300   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
301   PORT_DIPNAME( 0x40, 0x40, " Unknown 3" )
302   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
303   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
304   PORT_DIPNAME( 0x80, 0x80, " Unknown 4" )
305   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
306   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
307
84308INPUT_PORTS_END
85309
310static INPUT_PORTS_START( dderbya )
311   PORT_INCLUDE( dderby )
312   PORT_MODIFY("DSW")   /* 8bit */
313   PORT_DIPNAME( 0x01, 0x01, "Price Per Play")
314   PORT_DIPSETTING(    0x01, "5p" )
315   PORT_DIPSETTING(    0x00, "10p" )
316   PORT_DIPNAME( 0x06, 0x02, "Max Prize" )
317   PORT_DIPSETTING(    0x00, "400p (cash + tokens)" )
318   PORT_DIPSETTING(    0x04, "300p (cash + tokens)" )
319   PORT_DIPSETTING(    0x02, "200p (cash)" )
320   PORT_DIPSETTING(    0x06, "150p (cash)" )
321   PORT_DIPNAME( 0x18, 0x08, "Percentage" )
322   PORT_DIPSETTING(    0x00, "76%" )
323   PORT_DIPSETTING(    0x08, "80%" )
324   PORT_DIPSETTING(    0x10, "84%" )
325   PORT_DIPSETTING(    0x18, "88%" )
326   PORT_DIPNAME( 0x20, 0x20, " Unknown 2" )
327   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
328   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
329   PORT_DIPNAME( 0x40, 0x40, " Unknown 3" )
330   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
331   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
332   PORT_DIPNAME( 0x80, 0x80, " Unknown 4" )
333   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
334   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
335
336INPUT_PORTS_END
337
86338static const gfx_layout tiles8x8_layout =
87339{
88340   8,8,
89341   RGN_FRAC(1,2),
90342   4,
91   { 0,4,RGN_FRAC(1,2)+0,RGN_FRAC(1,2)+4 },
343   { 0,4,RGN_FRAC(1,2)},
92344   { 0, 1, 2, 3,8,9,10,11 },
93345   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
94346   16*8
95347};
96348
97static const gfx_layout tiles8x8_layout2 =
349static const gfx_layout tiles16x16_layout =
98350{
99   8,8,
100   RGN_FRAC(1,1),
101   2,
102   { 0,8 },
103   { 0, 1, 2, 3,4,5,6,7},
104   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
105   16*8
106};
351   16,16,   /* 16*16 sprites */
352   RGN_FRAC(1,3),   /* 256 sprites */
353   3,      /* 3 bits per pixel */
354   { 0, RGN_FRAC(1,3), RGN_FRAC(2,3) },   // the three bitplanes are separated
355   { 0, 1, 2, 3, 4, 5, 6, 7,  16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
356   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
357   32*8   // every sprite takes 32 consecutive bytes
107358
108static const UINT32 tiles8x64_layout_yoffset[64] =
109{
110   0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8,16*8,17*8,18*8,19*8,20*8,21*8,22*8,23*8,24*8,25*8,26*8,27*8,28*8,29*8,30*8,31*8,
111   32*8,33*8,34*8,35*8,36*8,37*8,38*8,39*8,40*8,41*8,42*8,43*8,44*8,45*8,46*8,47*8,48*8,49*8,50*8,51*8,52*8,53*8,54*8,55*8,56*8,57*8,58*8,59*8,60*8,61*8,62*8,63*8
112359};
113360
114/* i'm not convinced they will be used like this, might just be used as 8x8 tiles .. */
115static const gfx_layout tiles8x64_layout =
361static const gfx_layout tiles8x8_layout2 =
116362{
117   8,64,
363   8,8, // 8x8 chars
118364   RGN_FRAC(1,3),
119365   3,
120366   { 0,RGN_FRAC(1,3),RGN_FRAC(2,3) },
121367   { 0, 1, 2, 3, 4, 5, 6, 7 },
122   EXTENDED_YOFFS,
123   64*8,
124   NULL,
125   tiles8x64_layout_yoffset
368   {0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8},
369   8*8,
126370};
127371
128372static GFXDECODE_START( dmndrby )
129   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 )
130   GFXDECODE_ENTRY( "gfx2", 0, tiles8x64_layout, 0, 16 )
131   GFXDECODE_ENTRY( "gfx3", 0, tiles8x8_layout2, 0, 16 )
373   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 32*16, 16 )
374   GFXDECODE_ENTRY( "gfx2", 0, tiles8x8_layout2, 0, 8)
375   GFXDECODE_ENTRY( "gfx3", 0, tiles16x16_layout, 16*16, 32 )
132376
133377GFXDECODE_END
134378
379
380
381
382
383static TILE_GET_INFO( get_dmndrby_tile_info )
384{
385   int code = racetrack_tilemap_rom[tile_index];
386   int attr = racetrack_tilemap_rom[tile_index+0x2000];
387
388   int col = attr&0x1f;
389   int flipx = (attr&0x40)>>6;
390
391
392   SET_TILE_INFO(
393         2,
394         code,
395         col,
396         TILE_FLIPYX(flipx) );
397}
398
399
135400static VIDEO_START(dderby)
136401{
402   racetrack_tilemap_rom = memory_region(machine,"user1");
403   racetrack_tilemap = tilemap_create(machine,get_dmndrby_tile_info,tilemap_scan_rows,16,16, 16, 512);
404   tilemap_mark_all_tiles_dirty(racetrack_tilemap);
405
137406}
138407
139408static VIDEO_UPDATE(dderby)
140409{
141410   int x,y,count;
411   int off,scrolly;
412   static int bg=0;
142413   const gfx_element *gfx = screen->machine->gfx[0];
414   const gfx_element *sprites = screen->machine->gfx[1];
415   const gfx_element *track = screen->machine->gfx[2];
143416
144417   bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
145418
419
420/* Draw racetrack
421
422racetrack seems to be stored in 4th and 5th prom.
423can we draw it with the tilemap? maybe not, the layout is a litle strange
424
425*/
426//  base = scroll_ram[0];
427
428   off=0x1900-(bg*0x100)+(scroll_ram[1])*0x100;
429   scrolly = 0xff-(scroll_ram[0]);
430   if(scroll_ram[1]==0xff) off=0x1800;
431   for(x=0;x<16;x++) {
432      for(y=0;y<16;y++) {
433         int chr = racetrack_tilemap_rom[off];
434         int col = racetrack_tilemap_rom[off+0x2000]&0x1f;
435         int flipx = racetrack_tilemap_rom[off+0x2000]&0x40;
436         drawgfx(bitmap,track,chr,col,flipx,0,y*16+scrolly,x*16,cliprect,TRANSPARENCY_NONE,0);
437         // draw another bit of track
438         // a rubbish way of doing it
439         chr = racetrack_tilemap_rom[off-0x100];
440         col = racetrack_tilemap_rom[off+0x1f00]&0x1f;
441         flipx = racetrack_tilemap_rom[off+0x1f00]&0x40;
442         drawgfx(bitmap,track,chr,col,flipx,0,y*16-256+scrolly,x*16,cliprect,TRANSPARENCY_NONE,0);
443         off++;
444      }
445   }
446
447
448//return 0;
449
450/* draw sprites
451
452 guess work  again! seems to work fine and horse labels match up
453wouldnt like to say its the most effective way though...
454 -- maybe they should be decoded as 'big sprites' instead?
455
456*/
457   for (count=5;count>=0;count-- )
458   {
459      int a=0;
460      int b=0;
461      int base = count*4;
462      int sprx=sprite_ram[base+3];
463      int spry=sprite_ram[base+2];
464      //sprite_ram[base+1];
465      int col = (sprite_ram[base+1]&0x1f);
466      int anim = (sprite_ram[base]&0x3)*0x40; // animation frame - probably wrong but seems right
467      int horse = (sprite_ram[base+1]&0x7)*8+7;  // horse label from 1 - 6
468
469      for (a=0;a<8 ;a++)
470      {
471         for(b=0;b<7;b++) {
472            drawgfx(bitmap,sprites,anim+a*8+b,col,0,0,sprx+a*8,spry+b*8,cliprect,TRANSPARENCY_PEN,0);
473         }
474      }
475      // draw the horse number
476      a=3;
477      b=3;
478      drawgfx(bitmap,sprites,anim+horse,col,0,0,sprx+a*8,spry+b*8,cliprect,TRANSPARENCY_PEN,0);
479
480
481   }
482
483
484   // char tiles. seems right - no idea about the palette
146485   count=0;
147486   for (y=0;y<32;y++)
148487   {
149488      for(x=0;x<32;x++)
150489      {
151         int tileno,bank;
490         int tileno,bank,color;
491         int trans = TRANSPARENCY_NONE;//((dderby_vidattribs[count]&0x10)==0x10)?TRANSPARENCY_PEN:TRANSPARENCY_NONE;
492         tileno=dderby_vidchars[count];
493         bank=dderby_vidattribs[count]&0x20;
494         color=((dderby_vidattribs[count]+bg)&0x1f);
495         if(tileno!=0x38) {
496            if (bank)
497               tileno+=0x100;
152498
153         tileno=dderby_vid[count];
154         bank=dderby_vid[count+0x400]&0x20;
155499
156         if (bank) tileno+=0x100;
157500
158         drawgfx(bitmap,gfx,tileno,0,0,0,x*8,y*8,cliprect,TRANSPARENCY_PEN,0);
501            drawgfx(bitmap,gfx,tileno,color,0,0,x*8,y*8,cliprect,trans,0);
502         }
503
159504         count++;
160505      }
161506   }
162507
163508
164
165509   return 0;
166510}
167511
512
168513static INTERRUPT_GEN( dderby_interrupt )
169514{
170//  cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x8);  // almost certainly wrong?
171//  cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x10); // almost certainly wrong?
172//  cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x18); // almost certainly wrong?
173//  cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0x20); // almost certainly wrong?
515   cpu_set_input_line_and_vector(cputag_get_cpu(device->machine, "main"), 0, HOLD_LINE, 0x8a); // game
174516}
175517
518
519static INTERRUPT_GEN( dderby_sound_interrupt )
520{
521   cpu_set_input_line_and_vector(cputag_get_cpu(device->machine, "audio"), 0, HOLD_LINE, 0x50);
522}
523
524
525// copied from elsewhere. maybe incorrect
526static PALETTE_INIT( dmnderby )
527{
528   static const int resistances_rg[3] = { 1000, 470, 220 };
529   static const int resistances_b [2] = { 470, 220 };
530   double rweights[3], gweights[3], bweights[2];
531   int i;
532
533   /* compute the color output resistor weights */
534   compute_resistor_weights(0,   255, -1.0,
535         3, &resistances_rg[0], rweights, 470, 0,
536         3, &resistances_rg[0], gweights, 470, 0,
537         2, &resistances_b[0],  bweights, 470, 0);
538
539   /* allocate the colortable */
540   machine->colortable = colortable_alloc(machine, 0x20);
541
542   /* create a lookup table for the palette */
543   for (i = 0; i < 0x20; i++)
544   {
545      int bit0, bit1, bit2;
546      int r, g, b;
547
548      /* red component */
549      bit0 = (color_prom[i] >> 0) & 0x01;
550      bit1 = (color_prom[i] >> 1) & 0x01;
551      bit2 = (color_prom[i] >> 2) & 0x01;
552      r = combine_3_weights(rweights, bit0, bit1, bit2);
553
554      /* green component */
555      bit0 = (color_prom[i] >> 3) & 0x01;
556      bit1 = (color_prom[i] >> 4) & 0x01;
557      bit2 = (color_prom[i] >> 5) & 0x01;
558      g = combine_3_weights(gweights, bit0, bit1, bit2);
559
560      /* blue component */
561      bit0 = (color_prom[i] >> 6) & 0x01;
562      bit1 = (color_prom[i] >> 7) & 0x01;
563      b = combine_2_weights(bweights, bit0, bit1);
564
565      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
566   }
567
568   /* color_prom now points to the beginning of the lookup table */
569   color_prom = memory_region(machine,"proms2");
570
571   /* normal tiles use colors 0-15 */
572   for (i = 0x000; i < 0x300; i++)
573   {
574      UINT8 ctabentry = color_prom[i];
575      colortable_entry_set_value(machine->colortable, i, ctabentry);
576   }
577}
578
176579static MACHINE_DRIVER_START( dderby )
177580   /* basic machine hardware */
178   MDRV_CPU_ADD("main", Z80,8000000)       /* ? MHz */
581   MDRV_CPU_ADD("main", Z80,4000000)       /* ? MHz */
179582   MDRV_CPU_PROGRAM_MAP(memmap,0)
180   MDRV_CPU_VBLANK_INT("main", dderby_interrupt)
583   MDRV_CPU_PERIODIC_INT(dderby_interrupt, 244)   // seems about right judging by countdown timer on screen (15 > 1)
584//  MDRV_CPU_VBLANK_INT("main", dderby_interrupt)
181585
586// SOUND CPU (PROBABLY WRONG)
587//
588   MDRV_CPU_ADD("audio", Z80, 4000000)   /* verified on schematics */
589   MDRV_CPU_PROGRAM_MAP(dderby_sound_map,0)
590   MDRV_CPU_PERIODIC_INT(dderby_sound_interrupt, 100)   // total guess
591
592   MDRV_QUANTUM_TIME(HZ(6000))
593   MDRV_NVRAM_HANDLER(dderby)
594
182595   /* video hardware */
183596   MDRV_SCREEN_ADD("main", RASTER)
184597   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
188601   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
189602
190603   MDRV_GFXDECODE(dmndrby)
191   MDRV_PALETTE_LENGTH(0x100)
604   MDRV_PALETTE_LENGTH(0x300)
605   MDRV_PALETTE_INIT(dmnderby)
192606
193607   MDRV_VIDEO_START(dderby)
194608   MDRV_VIDEO_UPDATE(dderby)
609
610   MDRV_SPEAKER_STANDARD_MONO("mono")
611
612   MDRV_SOUND_ADD("ay1", AY8910, 1789750) // frequency guessed
613   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
195614MACHINE_DRIVER_END
196615
616
197617ROM_START( dmndrby )
198   ROM_REGION( 0x04000, "gfx1", 0 )
199   ROM_LOAD( "dd01.e1", 0x00000, 0x02000, CRC(2e120288) SHA1(0ea29aff07e956b19080f05bd18b427195694ce8) )
200   ROM_LOAD( "dd02.e2", 0x02000, 0x02000, CRC(ca028c8c) SHA1(f882eea2191cf1f3ea57d49fd6862f98401555be) )
201
202   ROM_REGION( 0x10000, "cpu1", 0 ) /* sound cpu */
203   ROM_LOAD( "dd03.j9", 0x00000, 0x01000, CRC(660f0cae) SHA1(b3b414e52342de877a5c20886a87002a63310a94) )
204
205618   ROM_REGION( 0x10000, "main", 0 ) /* main cpu */
206619   ROM_LOAD( "dd04.m6", 0x00000, 0x02000, CRC(a3cfd28e) SHA1(7ba14876fa4409634a699e049bce3bc457522932) )
207620   ROM_LOAD( "dd05.m7", 0x02000, 0x02000, CRC(16f7ac0b) SHA1(030b8c2b294a0287f3aaf72424304fc191315888) )
208621   ROM_LOAD( "dd06.m8", 0x04000, 0x02000, CRC(914ba8f5) SHA1(d1b3f3d5d2625e42ea6cb5c777942cec7faea58e) )
209622
210   ROM_REGION( 0x18000, "gfx2", 0 )
623   ROM_REGION( 0x10000, "audio", 0 ) /* sound cpu */
624   ROM_LOAD( "dd03.j9", 0x00000, 0x01000, CRC(660f0cae) SHA1(b3b414e52342de877a5c20886a87002a63310a94) )
625
626   ROM_REGION( 0x04000, "gfx1", 0 ) /* tiles */
627   ROM_LOAD( "dd01.e1", 0x00000, 0x02000, CRC(2e120288) SHA1(0ea29aff07e956b19080f05bd18b427195694ce8) )
628   ROM_LOAD( "dd02.e2", 0x02000, 0x02000, CRC(ca028c8c) SHA1(f882eea2191cf1f3ea57d49fd6862f98401555be) )
629
630   ROM_REGION( 0x4000, "user1", 0 ) // tracerack data
631   ROM_LOAD( "dd22.n6", 0x00000, 0x02000, CRC(db6b13fc) SHA1(3415deb2ffa86679e4f8abb644b75963e5368ba0) )
632   ROM_LOAD( "dd23.n7", 0x02000, 0x02000, CRC(595fdb9b) SHA1(133d227bb156be52337da974e37973b049722e49) )
633
634   ROM_REGION( 0x18000, "gfx2", 0 ) /* horse sprites (kinda) */
211635   ROM_LOAD( "dd07.b1", 0x00000, 0x02000, CRC(207a534a) SHA1(ddbd292f79cc9fb7bd9f0ee9874da87909147789) )
212636   ROM_LOAD( "dd08.b2", 0x02000, 0x02000, CRC(f380e2c4) SHA1(860a6557ae8b81d310c353f88f9194e1ffd551ec) )
213637   ROM_LOAD( "dd09.b3", 0x04000, 0x02000, CRC(68ebf74c) SHA1(959ee6c4ce700cff86af39442063dc79b8f8913e) )
r3957r3958
226650   ROM_LOAD( "dd20.n3", 0x02000, 0x02000, CRC(1497e52f) SHA1(f08c20c97c8d2148fcc705297cf1129bc65c9b83) )
227651   ROM_LOAD( "dd21.n4", 0x04000, 0x02000, CRC(87605d44) SHA1(c985fb15eac7bcc89e92909cf588b5982d0cabd0) )
228652
229   ROM_REGION( 0x4000, "user1", 0 ) // something else
230   ROM_LOAD( "dd22.n6", 0x00000, 0x02000, CRC(db6b13fc) SHA1(3415deb2ffa86679e4f8abb644b75963e5368ba0) )
231   ROM_LOAD( "dd23.n7", 0x02000, 0x02000, CRC(595fdb9b) SHA1(133d227bb156be52337da974e37973b049722e49) )
653   ROM_REGION( 0x020, "proms", 0 ) // palette
654   ROM_LOAD( "ddprom3.h5", 0x0000, 0x0020, CRC(aea3cff6) SHA1(1139dd52c127436873a674be8a14527190091a82) )
232655
233   ROM_REGION( 0x520, "user2", 0 ) // proms
234   ROM_LOAD( "ddprom1.c1", 0x0000, 0x0100, CRC(e1c2fa1b) SHA1(6b8b0b2c1ac4b2796070452c923ba96dd8b29048) )
235   ROM_LOAD( "ddprom2.j5", 0x0100, 0x0100, CRC(3e5402dc) SHA1(2f497333f49064c54995cec8919f3aebdc17e977) )
236   ROM_LOAD( "ddprom4.h10",0x0200, 0x0100, CRC(7280f000) SHA1(bfad2b547b8abe6c67928bec08e7d00431c539d5) )
237   ROM_LOAD( "ddprom5.k1", 0x0300, 0x0100, CRC(15edbdac) SHA1(298640afb24830d32f54c0c7c5960d777f51f2bd) )
238   ROM_LOAD( "ddprom6.m12",0x0400, 0x0100, CRC(7f677b7d) SHA1(946014cb01f5954a3cb196796741ee174a0de641) )
239   ROM_LOAD( "ddprom3.h5", 0x0500, 0x0020, CRC(aea3cff6) SHA1(1139dd52c127436873a674be8a14527190091a82) )
656   ROM_REGION( 0x300, "proms2", 0 ) // lookup
657   ROM_LOAD( "ddprom4.h10",0x0000, 0x0100, CRC(7280f000) SHA1(bfad2b547b8abe6c67928bec08e7d00431c539d5) ) // HORSES
658   ROM_LOAD( "ddprom5.k1", 0x0100, 0x0100, CRC(15edbdac) SHA1(298640afb24830d32f54c0c7c5960d777f51f2bd) ) // TILES?
659   ROM_LOAD( "ddprom1.c1", 0x0200, 0x0100, CRC(e1c2fa1b) SHA1(6b8b0b2c1ac4b2796070452c923ba96dd8b29048) ) // ???
660
661   ROM_REGION( 0x200, "proms3", 0 ) // other
662   ROM_LOAD( "ddprom2.j5", 0x0000, 0x0100, CRC(3e5402dc) SHA1(2f497333f49064c54995cec8919f3aebdc17e977) )
663   ROM_LOAD( "ddprom6.m12",0x0100, 0x0100, CRC(7f677b7d) SHA1(946014cb01f5954a3cb196796741ee174a0de641) )
240664ROM_END
241665
242666ROM_START( dmndrbya )
667   ROM_REGION( 0x10000, "main", 0 )
668   ROM_LOAD( "dd4", 0x00000, 0x02000, CRC(29b06e0f) SHA1(301fc2fe25ce47c2ad5112f0b795cd6bae605071) )
669   ROM_LOAD( "dd5", 0x02000, 0x02000, CRC(5299d020) SHA1(678d338d2cee5250154454be97456d5f80bb4759) )
670   ROM_LOAD( "dd6", 0x04000, 0x02000, CRC(f7e30ec0) SHA1(bf898987366ee9def190e3575108395b0aaef2d6) )
671
672   ROM_REGION( 0x10000, "audio", 0 ) /* sound cpu */
673   ROM_LOAD( "dd03.j9", 0x00000, 0x01000, CRC(660f0cae) SHA1(b3b414e52342de877a5c20886a87002a63310a94) )
674
243675   ROM_REGION( 0x04000, "gfx1", 0 )
244676   ROM_LOAD( "dd1", 0x00000, 0x02000, CRC(7fe475a6) SHA1(008bbaff87baad7f4c2497e40bf5e3fc95f993b4) )
245677   ROM_LOAD( "dd2", 0x02000, 0x02000, CRC(54def3ee) SHA1(fb88852ada2b5b555c0e8c0a082ed9978ff27434) )
246678
247   ROM_REGION( 0x10000, "cpu1", 0 ) /* sound cpu */
248   ROM_LOAD( "dd03.j9", 0x00000, 0x01000, CRC(660f0cae) SHA1(b3b414e52342de877a5c20886a87002a63310a94) )
679   ROM_REGION( 0x4000, "user1", 0 ) // tracerack data
680   ROM_LOAD( "dd22.n6", 0x00000, 0x02000, CRC(db6b13fc) SHA1(3415deb2ffa86679e4f8abb644b75963e5368ba0) )
681   ROM_LOAD( "dd23.n7", 0x02000, 0x02000, CRC(595fdb9b) SHA1(133d227bb156be52337da974e37973b049722e49) )
249682
250   ROM_REGION( 0x10000, "main", 0 )
251   ROM_LOAD( "dd4", 0x00000, 0x02000, CRC(29b06e0f) SHA1(301fc2fe25ce47c2ad5112f0b795cd6bae605071) )
252   ROM_LOAD( "dd5", 0x02000, 0x02000, CRC(5299d020) SHA1(678d338d2cee5250154454be97456d5f80bb4759) )
253   ROM_LOAD( "dd6", 0x04000, 0x02000, CRC(f7e30ec0) SHA1(bf898987366ee9def190e3575108395b0aaef2d6) )
254
255683   ROM_REGION( 0x18000, "gfx2", 0 )
256684   ROM_LOAD( "dd07.b1", 0x00000, 0x02000, CRC(207a534a) SHA1(ddbd292f79cc9fb7bd9f0ee9874da87909147789) )
257685   ROM_LOAD( "dd08.b2", 0x02000, 0x02000, CRC(f380e2c4) SHA1(860a6557ae8b81d310c353f88f9194e1ffd551ec) )
r3957r3958
271699   ROM_LOAD( "dd20.n3", 0x02000, 0x02000, CRC(1497e52f) SHA1(f08c20c97c8d2148fcc705297cf1129bc65c9b83) )
272700   ROM_LOAD( "dd21.n4", 0x04000, 0x02000, CRC(87605d44) SHA1(c985fb15eac7bcc89e92909cf588b5982d0cabd0) )
273701
274   ROM_REGION( 0x4000, "user1", 0 ) // something else
275   ROM_LOAD( "dd22.n6", 0x00000, 0x02000, CRC(db6b13fc) SHA1(3415deb2ffa86679e4f8abb644b75963e5368ba0) )
276   ROM_LOAD( "dd23.n7", 0x02000, 0x02000, CRC(595fdb9b) SHA1(133d227bb156be52337da974e37973b049722e49) )
702   ROM_REGION( 0x020, "proms", 0 ) // palette
703   ROM_LOAD( "ddprom3.h5", 0x0000, 0x0020, CRC(aea3cff6) SHA1(1139dd52c127436873a674be8a14527190091a82) )
277704
278   ROM_REGION( 0x520, "user2", 0 ) // proms
279   ROM_LOAD( "ddprom1.c1", 0x0000, 0x0100, CRC(e1c2fa1b) SHA1(6b8b0b2c1ac4b2796070452c923ba96dd8b29048) )
280   ROM_LOAD( "ddprom2.j5", 0x0100, 0x0100, CRC(3e5402dc) SHA1(2f497333f49064c54995cec8919f3aebdc17e977) ) // wasn't in this set
281   ROM_LOAD( "ddprom4.h10",0x0200, 0x0100, CRC(7280f000) SHA1(bfad2b547b8abe6c67928bec08e7d00431c539d5) )
282   ROM_LOAD( "ddprom5.k1", 0x0300, 0x0100, CRC(15edbdac) SHA1(298640afb24830d32f54c0c7c5960d777f51f2bd) )
283   ROM_LOAD( "ddprom6.m12",0x0400, 0x0100, CRC(7f677b7d) SHA1(946014cb01f5954a3cb196796741ee174a0de641) )
284   ROM_LOAD( "ddprom3.h5", 0x0500, 0x0020, CRC(aea3cff6) SHA1(1139dd52c127436873a674be8a14527190091a82) )
705   ROM_REGION( 0x300, "proms2", 0 ) // lookup
706   ROM_LOAD( "ddprom4.h10",0x0000, 0x0100, CRC(7280f000) SHA1(bfad2b547b8abe6c67928bec08e7d00431c539d5) ) // HORSES
707   ROM_LOAD( "ddprom5.k1", 0x0100, 0x0100, CRC(15edbdac) SHA1(298640afb24830d32f54c0c7c5960d777f51f2bd) ) // TILES?
708   ROM_LOAD( "ddprom1.c1", 0x0200, 0x0100, CRC(e1c2fa1b) SHA1(6b8b0b2c1ac4b2796070452c923ba96dd8b29048) ) // ???
709
710   ROM_REGION( 0x200, "proms3", 0 ) // other
711   ROM_LOAD( "ddprom2.j5", 0x0000, 0x0100, CRC(3e5402dc) SHA1(2f497333f49064c54995cec8919f3aebdc17e977) )
712   ROM_LOAD( "ddprom6.m12",0x0100, 0x0100, CRC(7f677b7d) SHA1(946014cb01f5954a3cb196796741ee174a0de641) )
285713ROM_END
286714
287715
288
289GAME( 1986, dmndrby,  0,       dderby, dderby, 0, ROT0, "Electrocoin", "Diamond Derby (set 1)",GAME_NOT_WORKING|GAME_NO_SOUND )
290GAME( 1986, dmndrbya, dmndrby, dderby, dderby, 0, ROT0, "Electrocoin", "Diamond Derby (set 2)",GAME_NOT_WORKING|GAME_NO_SOUND )
716/*    YEAR, NAME,    PARENT,   MACHINE, INPUT,   INIT,    MONITOR, COMPANY,   FULLNAME */
717GAME( 1994, dmndrby,  0,       dderby, dderby,  0, ROT0, "Electrocoin", "Diamond Derby (Newer)",GAME_NOT_WORKING|GAME_NO_SOUND ) // hack?
718GAME( 1986, dmndrbya, dmndrby, dderby, dderbya, 0, ROT0, "Electrocoin", "Diamond Derby (Original)",GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/pastelg.c
r3957r3958
2121******************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425#include "nb1413m3.h"
2526#include "sound/ay8910.h"
2627#include "sound/dac.h"
r3957r3958
4041
4142extern WRITE8_HANDLER( pastelg_clut_w );
4243extern WRITE8_HANDLER( pastelg_romsel_w );
44extern WRITE8_HANDLER( threeds_romsel_w );
4345extern WRITE8_HANDLER( pastelg_blitter_w );
4446extern int pastelg_blitter_src_addr_r(void);
4547
r3957r3958
5658   return ROM[pastelg_blitter_src_addr_r() & 0x7fff];
5759}
5860
59
60static ADDRESS_MAP_START( readmem_pastelg, ADDRESS_SPACE_PROGRAM, 8 )
61   AM_RANGE(0x0000, 0xbfff) AM_READ(SMH_ROM)
62   AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM)
61static ADDRESS_MAP_START( pastelg_map, ADDRESS_SPACE_PROGRAM, 8 )
62   AM_RANGE(0x0000, 0xbfff) AM_ROM
63   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&nb1413m3_nvram) AM_SIZE(&nb1413m3_nvram_size)
6364ADDRESS_MAP_END
6465
65static ADDRESS_MAP_START( writemem_pastelg, ADDRESS_SPACE_PROGRAM, 8 )
66   AM_RANGE(0x0000, 0xbfff) AM_WRITE(SMH_ROM)
67   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(SMH_RAM) AM_BASE(&nb1413m3_nvram) AM_SIZE(&nb1413m3_nvram_size)
68ADDRESS_MAP_END
6966
70
71
7267static ADDRESS_MAP_START( pastelg_io_map, ADDRESS_SPACE_IO, 8 )
7368   ADDRESS_MAP_GLOBAL_MASK(0xff)
7469//  AM_RANGE(0x00, 0x00) AM_WRITE(SMH_NOP)
r3957r3958
8681   AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWC")
8782ADDRESS_MAP_END
8883
84static UINT8 mux_data;
85
86static READ8_HANDLER( threeds_inputport1_r )
87{
88   switch(mux_data)
89   {
90      case 0x01: return input_port_read(space->machine,"KEY0_PL1");
91      case 0x02: return input_port_read(space->machine,"KEY1_PL1");
92      case 0x04: return input_port_read(space->machine,"KEY2_PL1");
93      case 0x08: return input_port_read(space->machine,"KEY3_PL1");
94      case 0x10: return input_port_read(space->machine,"KEY4_PL1");
95   }
96
97   return 0xff;
98}
99
100static READ8_HANDLER( threeds_inputport2_r )
101{
102   switch(mux_data)
103   {
104      case 0x01: return input_port_read(space->machine,"KEY0_PL2");
105      case 0x02: return input_port_read(space->machine,"KEY1_PL2");
106      case 0x04: return input_port_read(space->machine,"KEY2_PL2");
107      case 0x08: return input_port_read(space->machine,"KEY3_PL2");
108      case 0x10: return input_port_read(space->machine,"KEY4_PL2");
109   }
110
111   return 0xff;
112}
113
114static WRITE8_HANDLER( threeds_inputportsel_w )
115{
116   mux_data = ~data;
117}
118
119static ADDRESS_MAP_START( threeds_io_map, ADDRESS_SPACE_IO, 8 )
120   ADDRESS_MAP_GLOBAL_MASK(0xff)
121   AM_RANGE(0x81, 0x81) AM_READ(ay8910_read_port_0_r)
122   AM_RANGE(0x82, 0x82) AM_WRITE(ay8910_write_port_0_w)
123   AM_RANGE(0x83, 0x83) AM_WRITE(ay8910_control_port_0_w)
124   AM_RANGE(0x90, 0x90) AM_READ_PORT("SYSTEM") AM_WRITE( threeds_romsel_w )
125   AM_RANGE(0xf0, 0xf6) AM_WRITE(pastelg_blitter_w)
126   AM_RANGE(0xa0, 0xa0) AM_READWRITE(threeds_inputport1_r, threeds_inputportsel_w)
127   AM_RANGE(0xb0, 0xb0) AM_READ(threeds_inputport2_r)
128   AM_RANGE(0xc0, 0xcf) AM_WRITE(pastelg_clut_w)
129   AM_RANGE(0xc0, 0xc0) AM_READ_PORT("DSWC")
130   AM_RANGE(0xd0, 0xd0) AM_READWRITE(SMH_NOP, DAC_0_WRITE)               // unknown
131ADDRESS_MAP_END
132
89133static INPUT_PORTS_START( pastelg )
90134   PORT_START("DSWA")
91135   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
r3957r3958
173217   PORT_INCLUDE( nbmjcontrols )
174218INPUT_PORTS_END
175219
220// stops the game hanging..
221CUSTOM_INPUT( nb1413m3_hackbusyflag_r )
222{
223   static int i = 0;
224   i ^= 1;
225   return i;
226}
176227
228static INPUT_PORTS_START( threeds )
229   PORT_START("DSWA")
230    PORT_DIPNAME( 0x01,   0x01, "0" )
231    PORT_DIPSETTING(      0x01, DEF_STR( Off ) )
232    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
233    PORT_DIPNAME( 0x02,   0x02, DEF_STR( Unknown ) )
234    PORT_DIPSETTING(      0x02, DEF_STR( Off ) )
235    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
236    PORT_DIPNAME( 0x04,   0x04, DEF_STR( Unknown ) )
237    PORT_DIPSETTING(      0x04, DEF_STR( Off ) )
238    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
239    PORT_DIPNAME( 0x08,   0x08, DEF_STR( Unknown ) )
240    PORT_DIPSETTING(      0x08, DEF_STR( Off ) )
241    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
242    PORT_DIPNAME( 0x10,   0x10, DEF_STR( Unknown ) )
243    PORT_DIPSETTING(      0x10, DEF_STR( Off ) )
244    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
245    PORT_DIPNAME( 0x20,   0x20, DEF_STR( Unknown ) )
246    PORT_DIPSETTING(      0x20, DEF_STR( Off ) )
247    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
248    PORT_DIPNAME( 0x40,   0x40, DEF_STR( Unknown ) )
249    PORT_DIPSETTING(      0x40, DEF_STR( Off ) )
250    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
251    PORT_DIPNAME( 0x80,   0x80, DEF_STR( Unknown ) )
252    PORT_DIPSETTING(      0x80, DEF_STR( Off ) )
253    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
254
255   PORT_START("DSWB")
256    PORT_DIPNAME( 0x01,   0x01, "1" )
257    PORT_DIPSETTING(      0x01, DEF_STR( Off ) )
258    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
259    PORT_DIPNAME( 0x02,   0x02, DEF_STR( Unknown ) )
260    PORT_DIPSETTING(      0x02, DEF_STR( Off ) )
261    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
262    PORT_DIPNAME( 0x04,   0x04, DEF_STR( Unknown ) )
263    PORT_DIPSETTING(      0x04, DEF_STR( Off ) )
264    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
265    PORT_DIPNAME( 0x08,   0x08, DEF_STR( Unknown ) )
266    PORT_DIPSETTING(      0x08, DEF_STR( Off ) )
267    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
268    PORT_DIPNAME( 0x10,   0x10, DEF_STR( Unknown ) )
269    PORT_DIPSETTING(      0x10, DEF_STR( Off ) )
270    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
271    PORT_DIPNAME( 0x20,   0x20, DEF_STR( Unknown ) )
272    PORT_DIPSETTING(      0x20, DEF_STR( Off ) )
273    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
274    PORT_DIPNAME( 0x40,   0x40, DEF_STR( Unknown ) )
275    PORT_DIPSETTING(      0x40, DEF_STR( Off ) )
276    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
277    PORT_DIPNAME( 0x80,   0x80, DEF_STR( Unknown ) )
278    PORT_DIPSETTING(      0x80, DEF_STR( Off ) )
279    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
280
281   PORT_START("DSWC")
282    PORT_DIPNAME( 0x01,   0x01, "2" )
283    PORT_DIPSETTING(      0x01, DEF_STR( Off ) )
284    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
285    PORT_DIPNAME( 0x02,   0x02, DEF_STR( Unknown ) )
286    PORT_DIPSETTING(      0x02, DEF_STR( Off ) )
287    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
288    PORT_DIPNAME( 0x04,   0x04, DEF_STR( Unknown ) )
289    PORT_DIPSETTING(      0x04, DEF_STR( Off ) )
290    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
291    PORT_DIPNAME( 0x08,   0x08, DEF_STR( Unknown ) )
292    PORT_DIPSETTING(      0x08, DEF_STR( Off ) )
293    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
294    PORT_DIPNAME( 0x10,   0x10, DEF_STR( Unknown ) )
295    PORT_DIPSETTING(      0x10, DEF_STR( Off ) )
296    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
297    PORT_DIPNAME( 0x20,   0x20, DEF_STR( Unknown ) )
298    PORT_DIPSETTING(      0x20, DEF_STR( Off ) )
299    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
300    PORT_DIPNAME( 0x40,   0x40, DEF_STR( Unknown ) )
301    PORT_DIPSETTING(      0x40, DEF_STR( Off ) )
302    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
303    PORT_DIPNAME( 0x80,   0x80, DEF_STR( Unknown ) )
304    PORT_DIPSETTING(      0x80, DEF_STR( Off ) )
305    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
306
307   PORT_START("KEY0_PL1")
308   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
309   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("1P Start / Deal")
310   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
311    PORT_DIPNAME( 0x40,   0x40, "1P-Side Character Test Mode" ) //only combined with the service mode
312    PORT_DIPSETTING(      0x40, DEF_STR( Off ) )
313    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
314    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
315
316   PORT_START("KEY1_PL1")
317   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
318   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_NAME("1P Bet") PORT_CODE(KEYCODE_S)
319   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("1P Hold 5") PORT_CODE(KEYCODE_B)
320   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("1P Hold 3") PORT_CODE(KEYCODE_C)
321    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1P Hold 1") PORT_CODE(KEYCODE_Z)
322   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
323
324   PORT_START("KEY2_PL1")
325   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
326   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("1P Change Dealer") PORT_CODE(KEYCODE_A)
327   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
328
329   PORT_START("KEY3_PL1")
330   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
331   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("1P Hold 4") PORT_CODE(KEYCODE_V)
332   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1P Hold 2") PORT_CODE(KEYCODE_X)
333   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
334
335   PORT_START("KEY4_PL1")
336   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_NAME("1P Small")
337   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_NAME("1P Big")
338   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("1P Flip Flop")
339   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_NAME("1P Double Up")
340   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_NAME("1P Take Score")
341   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
342
343   PORT_START("KEY0_PL2")
344   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
345   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("2P Start / Deal")
346   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
347    PORT_DIPNAME( 0x40,   0x40, "2P-Side Character Test Mode" ) //only combined with the service mode
348    PORT_DIPSETTING(      0x40, DEF_STR( Off ) )
349    PORT_DIPSETTING(      0x00, DEF_STR( On ) )
350    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
351
352   PORT_START("KEY1_PL2")
353   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
354   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_NAME("2P Bet") PORT_PLAYER(2)
355   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("2P Hold 5") PORT_PLAYER(2)
356   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("2P Hold 3") PORT_PLAYER(2)
357    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("2P Hold 1") PORT_PLAYER(2)
358   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
359
360   PORT_START("KEY2_PL2")
361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
362   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("2P Change Dealer") PORT_PLAYER(2)
363   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
364
365   PORT_START("KEY3_PL2")
366   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
367   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("2P Hold 4") PORT_PLAYER(2)
368   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("2P Hold 2") PORT_PLAYER(2)
369   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
370
371   PORT_START("KEY4_PL2")
372   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_NAME("2P Small") PORT_PLAYER(2)
373   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_NAME("2P Big") PORT_PLAYER(2)
374   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_NAME("2P Flip Flop") PORT_PLAYER(2)
375   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_NAME("2P Double Up") PORT_PLAYER(2)
376   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_NAME("2P Take Score") PORT_PLAYER(2)
377   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
378
379   PORT_START("SYSTEM")
380   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(nb1413m3_hackbusyflag_r, NULL)   // DRAW BUSY
381   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )         //
382   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE3 )      // MEMORY RESET
383   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )      // ANALYZER
384   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )               // TEST
385   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )         // COIN1
386   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE4 )      // CREDIT CLEAR
387   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )      // SERVICE
388INPUT_PORTS_END
389
390
177391static const ay8910_interface ay8910_config =
178392{
179393   AY8910_LEGACY_OUTPUT,
r3957r3958
189403
190404   /* basic machine hardware */
191405   MDRV_CPU_ADD("main", Z80, 19968000/8)   /* 2.496 MHz ? */
192   MDRV_CPU_PROGRAM_MAP(readmem_pastelg, writemem_pastelg)
406   MDRV_CPU_PROGRAM_MAP(pastelg_map,0)
193407   MDRV_CPU_IO_MAP(pastelg_io_map,0)
194408//  MDRV_CPU_VBLANK_INT_HACK(nb1413m3_interrupt,96)  // nmiclock not written, chip is 1411M1 instead of 1413M3
195409   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
r3957r3958
222436   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
223437MACHINE_DRIVER_END
224438
439/*
225440
441Produttore  Nichibutsu
442N.revisione TD-1412a
443CPU
4441x custom Nichibutsu PG14111 (DIL40)(main?)
4451x custom Nichibutsu PG14112 (DIL40)(sound?)
4461x custom Nichibutsu PG14113 (DIL20)(PAL)
4471x custom Nichibutsu PG14114 (DIL20)(PAL)
4481x custom Nichibutsu PG1411M1XBA (DIL28)(maybe it's ram)
4491x oscillator 19.968MHz
450ROMs
4517x MBM27256
4523x MBM27128
4532x PROM MB7112E
454Note
4551x 18x2 edge connector
4561x 10x2 edge connector
4572x trimmer (MAIN, SUB)
4582x 8 switches dip
459
460*/
461
462static MACHINE_DRIVER_START( threeds )
463
464   /* basic machine hardware */
465   MDRV_CPU_ADD("main", Z80, 19968000/8)   /* 2.496 MHz ? */
466   MDRV_CPU_PROGRAM_MAP(pastelg_map,0)
467   MDRV_CPU_IO_MAP(threeds_io_map,0)
468   MDRV_CPU_VBLANK_INT("main", nb1413m3_interrupt)
469
470   MDRV_MACHINE_RESET(nb1413m3)
471   MDRV_NVRAM_HANDLER(nb1413m3)
472
473   /* video hardware */
474   MDRV_SCREEN_ADD("main", RASTER)
475   MDRV_SCREEN_REFRESH_RATE(60)
476   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
477   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
478   MDRV_SCREEN_SIZE(256, 256)
479   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1)
480
481   MDRV_PALETTE_LENGTH(32)
482
483   MDRV_PALETTE_INIT(pastelg)
484   MDRV_VIDEO_START(pastelg)
485   MDRV_VIDEO_UPDATE(pastelg)
486
487   /* sound hardware */
488   MDRV_SPEAKER_STANDARD_MONO("mono")
489
490   MDRV_SOUND_ADD("ay", AY8910, 1250000)
491   MDRV_SOUND_CONFIG(ay8910_config)
492   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
493
494   MDRV_SOUND_ADD("dac", DAC, 0)
495   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
496MACHINE_DRIVER_END
497
498
226499ROM_START( pastelg )
227500   ROM_REGION( 0x10000, "main", 0 ) /* program */
228501   ROM_LOAD( "pgal_09.bin",  0x00000, 0x04000, CRC(1e494af3) SHA1(1597a7da22ecfbb1df83cf9d0acc7a8be461bc2c) )
r3957r3958
246519   ROM_LOAD( "pgal_bp2.bin", 0x0020, 0x0020, CRC(4433021e) SHA1(e0d6619a193d26ad24788d4af5ef01ee89cffacd) )
247520ROM_END
248521
522ROM_START( 3ds )
523   ROM_REGION( 0x10000, "main", 0 ) /* program */
524   ROM_LOAD( "up9.9a",    0x00000, 0x04000, CRC(bc0e7cfd) SHA1(4e84f573fb2c1228757d34b8bc69649b145d9707) )
525   ROM_LOAD( "up10.10a",  0x04000, 0x04000, CRC(e185d9f5) SHA1(98d4a824ed6a89e42543fb87daed33ef606bcced) )
526   ROM_LOAD( "up11.11a",  0x08000, 0x04000, CRC(d1fb728b) SHA1(46e8e6ccdc1b78da29c969cd9290158c96bac4c4) )
249527
528   ROM_REGION( 0x08000, "voice", ROMREGION_ERASE00 ) /* voice */
529
530   ROM_REGION( 0x38000, "gfx1", 0 ) /* gfx */
531   ROM_LOAD( "1.1a",  0x00000, 0x08000, CRC(5734ca7d) SHA1(d22b9e604cc4e2c0bb4eb32ded06bb5fa519965f) )
532   ROM_LOAD( "2.2a",  0x08000, 0x08000, CRC(c7f21718) SHA1(4b2956d499e4db63e7f2329420e3d0313e6360ed) )
533   ROM_LOAD( "3.3a",  0x10000, 0x08000, CRC(87bd0a9e) SHA1(a0443017ef4c19f0135c4f764a96457f02cda743) )
534   ROM_LOAD( "4.4a",  0x18000, 0x08000, CRC(b75ecf2b) SHA1(50b8f27988dd24ff475a500d361db3c7a7051f40) )
535   ROM_LOAD( "5.5a",  0x20000, 0x08000, CRC(22ee5cf6) SHA1(09725a73f5f107e6fcb1994d94a50748726318b0) )
536   ROM_LOAD( "6.6a",  0x28000, 0x08000, CRC(d86ebe8d) SHA1(2ede43899501ae27db26b48f53f010a4f0df0307) )
537   ROM_LOAD( "7.7a",  0x30000, 0x08000, CRC(6704950a) SHA1(fd60ff2351deb87f19e517cfaedc7ac3dd4aac8d) )
538
539   ROM_REGION( 0x0040, "proms", 0 ) /* color */
540   ROM_LOAD( "mb7112e.7h", 0x0000, 0x0020, CRC(2c4f7343) SHA1(7b069c4a4d68ef308d1c1f773ece4b124428da3f) )
541   ROM_LOAD( "mb7112e.7j", 0x0020, 0x0020, CRC(181f2a88) SHA1(a75ea981127fc667bb6b9f2ae2766aa2147ff04a) )
542ROM_END
543
544
250545GAME( 1985, pastelg, 0, pastelg, pastelg, pastelg, ROT0, "Nichibutsu", "Pastel Gal (Japan 851224)", 0 )
546GAME( 1985, 3ds, 0, threeds, threeds, pastelg, ROT0, "Nihon Bussan", "Three Ds - Three Dealers Casino House", GAME_IMPERFECT_GRAPHICS )
251547
src/mame/drivers/seattle.c
r3957r3958
511511   galileo.timer[3].timer = timer_alloc(machine, galileo_timer_callback, NULL);
512512
513513   /* set the fastest DRC options, but strict verification */
514   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
514   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
515515
516516   /* configure fast RAM regions for DRC */
517   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
518   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
519   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x007fffff);
520   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
521   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
517   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
518   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
519   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x007fffff);
520   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rambase);
521   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
522522
523   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
524   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
525   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
526   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
527   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
523   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
524   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
525   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
526   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
527   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
528528
529529   /* register for save states */
530530   state_save_register_global_array(machine, galileo.reg);
r3957r3958
28132813
28142814static void add_speedup(running_machine *machine, offs_t pc, UINT32 op)
28152815{
2816   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_SELECT, speedup_index++);
2817   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_PC, pc);
2818   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_OPCODE, op);
2819   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_CYCLES, 250);
2816   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_SELECT, speedup_index++);
2817   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_PC, pc);
2818   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_OPCODE, op);
2819   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_HOTSPOT_CYCLES, 250);
28202820}
28212821
28222822
src/mame/drivers/portrait.c
r3957r3958
8484**************************************************************************/
8585
8686#include "driver.h"
87#include "cpu/z80/z80.h"
8788#include "cpu/mcs48/mcs48.h"
8889#include "sound/5220intf.h"
8990
src/mame/drivers/funkybee.c
r3957r3958
7272***************************************************************************/
7373
7474#include "driver.h"
75#include "cpu/z80/z80.h"
7576#include "sound/ay8910.h"
7677
7778
src/mame/drivers/btoads.c
r3957r3958
77**************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "cpu/tms34010/tms34010.h"
1112#include "video/tlc34076.h"
1213#include "btoads.h"
src/mame/drivers/tetrisp2.c
r3957r3958
3434***************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/m68000/m68000.h"
3738#include "sound/okim6295.h"
3839#include "sound/ymz280b.h"
3940#include "rocknms.lh"
src/mame/drivers/lastduel.c
r3957r3958
1717**************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
21#include "cpu/m68000/m68000.h"
2022#include "deprecat.h"
2123#include "sound/2203intf.h"
2224#include "sound/okim6295.h"
src/mame/drivers/alpha68k.c
r3957r3958
183183***************************************************************************/
184184
185185#include "driver.h"
186#include "cpu/m68000/m68000.h"
186187#include "deprecat.h"
187188#include "cpu/z80/z80.h"
188189#include "sound/ay8910.h"
src/mame/drivers/drgnmst.c
r3957r3958
3535*/
3636
3737#include "driver.h"
38#include "cpu/m68000/m68000.h"
3839#include "cpu/pic16c5x/pic16c5x.h"
3940#include "sound/okim6295.h"
4041#include "includes/drgnmst.h"
src/mame/drivers/boxer.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/m6502/m6502.h"
1213
1314#define MASTER_CLOCK XTAL_12_096MHz
1415
src/mame/drivers/starfire.c
r3957r3958
4545***************************************************************************/
4646
4747#include "driver.h"
48#include "cpu/z80/z80.h"
4849#include "includes/starfire.h"
4950
5051
src/mame/drivers/tmaster.c
r3957r3958
9999***************************************************************************/
100100
101101#include "driver.h"
102#include "cpu/m68000/m68000.h"
102103#include "deprecat.h"
103104#include "sound/okim6295.h"
104105#include "machine/eeprom.h"
r3957r3958
157158   }
158159};
159160
160static void microtouch_tx(UINT8 data)
161static void microtouch_tx(running_machine *machine, UINT8 data)
161162{
162163   duart68681_rx_data(tmaster_devices.duart68681, 0, data);
163164}
r3957r3958
764765
765766static const duart68681_config tmaster_duart68681_config =
766767{
767   XTAL_8_664MHz / 2, //??
768
768769   duart_irq_handler,
769770   duart_tx,
770771   NULL,
r3957r3958
779780   MDRV_MACHINE_START(tmaster)
780781   MDRV_MACHINE_RESET(tmaster)
781782
782   MDRV_DEVICE_ADD( "duart68681", DUART68681 )
783   MDRV_DEVICE_CONFIG( tmaster_duart68681_config )
783   MDRV_DUART68681_ADD( "duart68681", XTAL_8_664MHz / 2 /*??*/, tmaster_duart68681_config )
784784
785785   MDRV_NVRAM_HANDLER(generic_0fill)
786786
r3957r3958
832832   memory_set_bank(machine, 2, 0);   // ram
833833   memory_set_bank(machine, 4, 0);   // ram
834834
835   cpu_reset(machine->cpu[0]);
835   device_reset(machine->cpu[0]);
836836}
837837
838838static MACHINE_DRIVER_START( galgames )
src/mame/drivers/tcl.c
r3957r3958
3434          VSync: 60Hz
3535          HSync: 15.15kHz
3636
37 This appears to be based off a Blue
38 Dyna Cherry Master board -- emualted goldstar.c
39 but with extra protection (the sub-board with CPU)
40
3741*/
3842
3943#include "driver.h"
44#include "cpu/z80/z80.h"
4045#include "machine/8255ppi.h"
4146#include "sound/ay8910.h"
4247
src/mame/drivers/freekick.c
r3957r3958
2626*/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
2930#include "machine/8255ppi.h"
3031#include "machine/mc8123.h"
3132#include "sound/sn76496.h"
r3957r3958
6566{
6667   /* flip Y/X could be the other way round... */
6768   if (offset)
68      flip_screen_y_set(~data & 1);
69      flip_screen_y_set(space->machine, ~data & 1);
6970   else
70      flip_screen_x_set(~data & 1);
71      flip_screen_x_set(space->machine, ~data & 1);
7172}
7273
7374static WRITE8_HANDLER( coin_w )
src/mame/drivers/cischeat.c
r3957r3958
168168***************************************************************************/
169169
170170#include "driver.h"
171#include "cpu/m68000/m68000.h"
171172#include "deprecat.h"
172173#include "megasys1.h"
173174#include "sound/2151intf.h"
r3957r3958
17771778   MDRV_CPU_PROGRAM_MAP(bigrun_sound_readmem,bigrun_sound_writemem)
17781779   MDRV_CPU_VBLANK_INT_HACK(irq4_line_hold,CISCHEAT_SOUND_INTERRUPT_NUM)
17791780
1780   MDRV_INTERLEAVE(20)
1781   MDRV_QUANTUM_TIME(HZ(1200))
17811782
17821783   /* video hardware */
17831784   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK | VIDEO_HAS_SHADOWS)
src/mame/drivers/namcos22.c
r3957r3958
11091109 */
11101110
11111111#include "driver.h"
1112#include "cpu/m68000/m68000.h"
11121113#include "deprecat.h"
11131114#include "namcos22.h"
11141115#include "cpu/tms32025/tms32025.h"
r3957r3958
27902791   MDRV_CPU_IO_MAP( mcu_io, 0 )
27912792   MDRV_CPU_VBLANK_INT_HACK(mcu_interrupt, 3)
27922793
2793   MDRV_INTERLEAVE(100)
2794   MDRV_QUANTUM_TIME(HZ(6000))
27942795
27952796   MDRV_NVRAM_HANDLER(namcos22)
27962797   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/flyball.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89
910#define MASTER_CLOCK ( XTAL_12_096MHz )
1011
r3957r3958
7273
7374   for (i = 0; i < 0x1000; i++)
7475      rombase[i] = ROM[i ^ 0x1ff];
75   cpu_reset(machine->cpu[0]);
76   device_reset(machine->cpu[0]);
7677
7778   timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, flyball_quarter_callback);
7879}
src/mame/drivers/redclash.c
r3957r3958
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425
2526
2627extern WRITE8_HANDLER( redclash_videoram_w );
src/mame/drivers/vicdual.c
r3957r3958
5252****************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/z80/z80.h"
56#include "cpu/i8085/i8085.h"
5557#include "vicdual.h"
5658
5759
src/mame/drivers/xybots.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "xybots.h"
r3957r3958
383384static DRIVER_INIT( xybots )
384385{
385386   atarigen_eeprom_default = NULL;
386   atarigen_slapstic_init(machine, 0, 0x008000, 0, 107);
387   atarigen_slapstic_init(machine->cpu[0], 0x008000, 0, 107);
387388   atarijsa_init(machine, "FFE200", 0x0100);
388389}
389390
src/mame/drivers/speglsht.c
r3957r3958
331331   MDRV_CPU_PROGRAM_MAP(speglsht_mem,0)
332332   MDRV_CPU_VBLANK_INT("main", irq4_gen)
333333
334   MDRV_INTERLEAVE(100)
334   MDRV_QUANTUM_TIME(HZ(6000))
335335   MDRV_MACHINE_RESET(speglsht)
336336
337337   /* video hardware */
src/mame/drivers/rockola.c
r3957r3958
823823   MDRV_VIDEO_START(satansat)
824824   MDRV_VIDEO_UPDATE(rockola)
825825
826   MDRV_DEVICE_ADD("crtc", MC6845)
826   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
827827
828828   // sound hardware
829829   MDRV_SPEAKER_STANDARD_MONO("mono")
r3957r3958
898898   MDRV_VIDEO_START(rockola)
899899   MDRV_VIDEO_UPDATE(rockola)
900900
901   MDRV_DEVICE_ADD("crtc", MC6845)
901   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
902902
903903   // sound hardware
904904   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/magicfly.c
r3957r3958
396396#define MASTER_CLOCK   XTAL_10MHz
397397
398398#include "driver.h"
399#include "cpu/m6502/m6502.h"
399400#include "video/mc6845.h"
400401#include "sound/dac.h"
401402
r3957r3958
757758   MDRV_VIDEO_START(magicfly)
758759   MDRV_VIDEO_UPDATE(magicfly)
759760
760   MDRV_DEVICE_ADD("crtc", MC6845)
761   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
761762
762763   /* sound hardware */
763764   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/centiped.c
r3957r3958
417417***************************************************************************/
418418
419419#include "driver.h"
420#include "cpu/m6502/m6502.h"
420421#include "cpu/s2650/s2650.h"
421422#include "machine/atari_vg.h"
422423#include "centiped.h"
src/mame/drivers/atarisy1.c
r3957r3958
117117
118118
119119#include "driver.h"
120#include "cpu/m68000/m68000.h"
121#include "cpu/m6502/m6502.h"
120122#include "machine/atarigen.h"
121123#include "machine/6522via.h"
122124#include "atarisy1.h"
r3957r3958
21462148static DRIVER_INIT( marble )
21472149{
21482150   atarigen_eeprom_default = NULL;
2149   atarigen_slapstic_init(machine, 0, 0x080000, 0, 103);
2151   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 103);
21502152
21512153   joystick_type = 0;   /* none */
21522154   trackball_type = 1;   /* rotated */
r3957r3958
21562158static DRIVER_INIT( peterpak )
21572159{
21582160   atarigen_eeprom_default = NULL;
2159   atarigen_slapstic_init(machine, 0, 0x080000, 0, 107);
2161   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 107);
21602162
21612163   joystick_type = 1;   /* digital */
21622164   trackball_type = 0;   /* none */
r3957r3958
21662168static DRIVER_INIT( indytemp )
21672169{
21682170   atarigen_eeprom_default = NULL;
2169   atarigen_slapstic_init(machine, 0, 0x080000, 0, 105);
2171   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 105);
21702172
21712173   joystick_type = 1;   /* digital */
21722174   trackball_type = 0;   /* none */
r3957r3958
21762178static DRIVER_INIT( roadrunn )
21772179{
21782180   atarigen_eeprom_default = NULL;
2179   atarigen_slapstic_init(machine, 0, 0x080000, 0, 108);
2181   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 108);
21802182
21812183   joystick_type = 2;   /* analog */
21822184   trackball_type = 0;   /* none */
r3957r3958
21862188static DRIVER_INIT( roadb109 )
21872189{
21882190   atarigen_eeprom_default = NULL;
2189   atarigen_slapstic_init(machine, 0, 0x080000, 0, 109);
2191   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 109);
21902192
21912193   joystick_type = 3;   /* pedal */
21922194   trackball_type = 2;   /* steering wheel */
r3957r3958
21962198static DRIVER_INIT( roadb110 )
21972199{
21982200   atarigen_eeprom_default = NULL;
2199   atarigen_slapstic_init(machine, 0, 0x080000, 0, 110);
2201   atarigen_slapstic_init(machine->cpu[0], 0x080000, 0, 110);
22002202
22012203   joystick_type = 3;   /* pedal */
22022204   trackball_type = 2;   /* steering wheel */
src/mame/drivers/wgp.c
r3957r3958
394394***************************************************************************/
395395
396396#include "driver.h"
397#include "cpu/z80/z80.h"
397398#include "taitoipt.h"
398399#include "cpu/m68000/m68000.h"
399400#include "video/taitoic.h"
r3957r3958
969970   MDRV_MACHINE_START(wgp)
970971   MDRV_MACHINE_RESET(wgp)
971972
972   MDRV_INTERLEAVE(500)
973   MDRV_QUANTUM_TIME(HZ(30000))
973974
974975   /* video hardware */
975976   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
10001001static MACHINE_DRIVER_START( wgp2 )
10011002   MDRV_IMPORT_FROM(wgp)
10021003
1003   MDRV_INTERLEAVE(200)
1004   MDRV_QUANTUM_TIME(HZ(12000))
10041005   /* video hardware */
10051006   MDRV_VIDEO_START(wgp2)
10061007MACHINE_DRIVER_END
src/mame/drivers/turbosub.c
r3957r3958
350350
351351   MDRV_PALETTE_LENGTH(512)
352352   MDRV_MACHINE_RESET( turbosub )
353   MDRV_INTERLEAVE(100)
353   MDRV_QUANTUM_TIME(HZ(6000))
354354
355355   MDRV_VIDEO_START(turbosub)
356356   MDRV_VIDEO_UPDATE(turbosub)
src/mame/drivers/welltris.c
r3957r3958
313313#define WELLTRIS_4P_HACK 0
314314
315315#include "driver.h"
316#include "cpu/z80/z80.h"
317#include "cpu/m68000/m68000.h"
316318#include "sound/2610intf.h"
317319
318320UINT16 *welltris_spriteram;
src/mame/drivers/sprint8.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89#include "includes/sprint8.h"
910
1011static int steer_dir[8];
src/mame/drivers/pturn.c
r3957r3958
7575
7676*/
7777#include "driver.h"
78#include "cpu/z80/z80.h"
7879#include "deprecat.h"
7980#include "sound/ay8910.h"
8081
r3957r3958
143144      flipy=spriteram[offs+1]&0x80;
144145
145146
146      if (flip_screen_x_get())
147      if (flip_screen_x_get(screen->machine))
147148      {
148149         sx = 224 - sx;
149150         flipx ^= 0x40;
150151      }
151152
152      if (flip_screen_y_get())
153      if (flip_screen_y_get(screen->machine))
153154      {
154155         flipy ^= 0x80;
155156         sy = 224 - sy;
r3957r3958
242243
243244static WRITE8_HANDLER(flip_w)
244245{
245   flip_screen_set(data);
246   flip_screen_set(space->machine, data);
246247}
247248
248249
src/mame/drivers/gumbo.c
r3957r3958
4242*/
4343
4444#include "driver.h"
45#include "cpu/m68000/m68000.h"
4546#include "sound/okim6295.h"
4647
4748UINT16 *gumbo_bg_videoram;
src/mame/drivers/getrivia.c
r3957r3958
7979*/
8080
8181#include "driver.h"
82#include "cpu/z80/z80.h"
8283#include "machine/8255ppi.h"
8384#include "machine/ticket.h"
8485#include "sound/dac.h"
src/mame/drivers/scregg.c
r3957r3958
5050***************************************************************************/
5151
5252#include "driver.h"
53#include "cpu/m6502/m6502.h"
5354#include "deprecat.h"
5455#include "sound/ay8910.h"
5556#include "includes/btime.h"
src/mame/drivers/dec0.c
r3957r3958
4343***************************************************************************/
4444
4545#include "driver.h"
46#include "cpu/m68000/m68000.h"
4647#include "cpu/m6502/m6502.h"
4748#include "cpu/h6280/h6280.h"
4849#include "dec0.h"
r3957r3958
983984   MDRV_CPU_ADD("sub", H6280,21477200/16) /* 21.4772MHz clock */
984985   MDRV_CPU_PROGRAM_MAP(robocop_sub_readmem,robocop_sub_writemem)
985986
986   MDRV_INTERLEAVE(50)   /* Interleave between HuC6280 & 68000 */
987   MDRV_QUANTUM_TIME(HZ(3000))   /* Interleave between HuC6280 & 68000 */
987988
988989   /* video hardware */
989990   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
10721073   MDRV_CPU_ADD("sub", H6280,21477200/16) /* 21.4772MHz clock */
10731074   MDRV_CPU_PROGRAM_MAP(hippodrm_sub_readmem,hippodrm_sub_writemem)
10741075
1075   MDRV_INTERLEAVE(5)   /* Interleave between H6280 & 68000 */
1076   MDRV_QUANTUM_TIME(HZ(300))   /* Interleave between H6280 & 68000 */
10761077
10771078   /* video hardware */
10781079   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/ssv.c
r3957r3958
180180***************************************************************************/
181181
182182#include "driver.h"
183#include "cpu/v810/v810.h"
184#include "cpu/v60/v60.h"
183185#include "deprecat.h"
184186#include "machine/eeprom.h"
185187#include "sound/es5506.h"
src/mame/drivers/janshi.c
r0r3958
1/* Janshi */
2
3/*
4
5Janshi
6(c)1992 Eagle
7
8CPU: 68000? -- no, it isn't, might be Z180 internal rom?
9Sound: AY-3-8910, M6295
10Others: Battery
11
12ROMs:
131.1A         [92b140a5]
142.1B         [6de7e086]
153.1D         [4e94d8f2]
164.1F         [a5f6e3ef]
175.1H         [ff2cc769]
186.1K         [8197034d]
1911.1L        [a7692ddf]
20
21
22
23--- Team Japump!!! ---
24Dumped by Chackn
2504/May/2007
26
27*/
28
29#include "driver.h"
30#include "news.h"
31#include "cpu/z80/z80.h"
32#include "sound/okim6295.h"
33
34
35static ADDRESS_MAP_START( mainmap, ADDRESS_SPACE_PROGRAM, 8 )
36   AM_RANGE(0x0000, 0x3fff) AM_ROM
37ADDRESS_MAP_END
38
39VIDEO_START(janshi)
40{
41
42}
43
44VIDEO_UPDATE(janshi)
45{
46   return 0;
47}
48
49
50static INPUT_PORTS_START( janshi )
51INPUT_PORTS_END
52
53
54static const gfx_layout tiles8x8_layout =
55{
56   8,8,
57   RGN_FRAC(1,5),
58   5,
59   { RGN_FRAC(0,5),RGN_FRAC(1,5),RGN_FRAC(2,5),RGN_FRAC(3,5),RGN_FRAC(4,5) },
60   { 0, 1,2,3,4,5,6,7 },
61   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
62   8*8
63};
64
65static GFXDECODE_START( janshi )
66   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 )
67GFXDECODE_END
68
69
70
71static MACHINE_DRIVER_START( janshi )
72   /* basic machine hardware */
73   MDRV_CPU_ADD("main", Z80,8000000)/*Z80? Z180?*/       /* ? MHz */
74   MDRV_CPU_PROGRAM_MAP(0,mainmap)
75//  MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
76
77   /* video hardware */
78   MDRV_SCREEN_ADD("main", RASTER)
79   MDRV_SCREEN_REFRESH_RATE(60)
80   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
81   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
82   MDRV_SCREEN_SIZE(256, 256)
83   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
84
85   MDRV_GFXDECODE(janshi)
86   MDRV_PALETTE_LENGTH(0x100)
87
88   MDRV_VIDEO_START(janshi)
89   MDRV_VIDEO_UPDATE(janshi)
90
91   /* sound hardware */
92   MDRV_SPEAKER_STANDARD_MONO("mono")
93
94   MDRV_SOUND_ADD("oki", OKIM6295, 1056000)
95   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) // clock frequency & pin 7 not verified
96   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
97MACHINE_DRIVER_END
98
99
100
101ROM_START( janshi )
102   ROM_REGION( 0x20000, "user1", 0 )
103   ROM_LOAD( "11.1l", 0x00000, 0x20000, CRC(a7692ddf) SHA1(5e7f43d8337583977baf22a28bbcd9b2182c0cde) )
104
105   ROM_REGION( 0x10000, "main", 0 )
106   ROM_COPY( "user1", 0x10000, 0x00000, 0x4000 )// no.. is there any valid startup code, or should there be internal rom?
107
108   ROM_REGION( 0x140000, "gfx1", 0 )
109   ROM_LOAD( "1.1a", 0x000000, 0x40000, CRC(92b140a5) SHA1(f3b38563f74650604ed0faaf84460e0b04b386b7) )
110   ROM_LOAD( "2.1b", 0x040000, 0x40000, CRC(6de7e086) SHA1(e87426264f0181c17383ffe0f7ec7ff5fce3d809) )
111   ROM_LOAD( "3.1d", 0x080000, 0x40000, CRC(4e94d8f2) SHA1(a25f542943d74915fc82910baafb9ff9db1ffd70) )
112   ROM_LOAD( "4.1f", 0x0c0000, 0x40000, CRC(a5f6e3ef) SHA1(f1f3d28b27eea682aa71855a311fb3abdf9af2cd) )
113   ROM_LOAD( "5.1h", 0x100000, 0x40000, CRC(ff2cc769) SHA1(ba4cf2923cf3d4d815a9327595f8e1801c3c8a2b) )
114
115   ROM_REGION( 0x40000, "oki", 0 )
116   ROM_LOAD( "6.1k", 0x00000, 0x40000, CRC(8197034d) SHA1(b501dc7a27b1faad1361c309afd726da14b8b5f5) )
117ROM_END
118
119GAME( 1992, janshi,  0,    janshi, janshi,  0, ROT0, "Eagle", "Janshi", GAME_NOT_WORKING )
src/mame/drivers/taitoair.c
r3957r3958
216216****************************************************************************/
217217
218218#include "driver.h"
219#include "cpu/z80/z80.h"
220#include "cpu/m68000/m68000.h"
219221#include "taitoipt.h"
220222#include "audio/taitosnd.h"
221223#include "video/taitoic.h"
r3957r3958
611613   MDRV_CPU_DATA_MAP(DSP_map_data, 0)
612614   MDRV_CPU_IO_MAP(DSP_map_io, 0)
613615
614   MDRV_INTERLEAVE(10)
616   MDRV_QUANTUM_TIME(HZ(600))
615617
616618   MDRV_MACHINE_START(taitoair)
617619
src/mame/drivers/atarig42.c
r3957r3958
1919
2020
2121#include "driver.h"
22#include "cpu/m68000/m68000.h"
2223#include "machine/atarigen.h"
2324#include "machine/asic65.h"
2425#include "audio/atarijsa.h"
src/mame/drivers/tceptor.c
r3957r3958
400400   MDRV_CPU_IO_MAP(mcu_io_map,0)
401401   MDRV_CPU_VBLANK_INT("2d", mcu_vb_interrupt)
402402
403   MDRV_INTERLEAVE(100)
403   MDRV_QUANTUM_TIME(HZ(6000))
404404
405405   MDRV_NVRAM_HANDLER(generic_1fill)
406406
src/mame/drivers/cop01.c
r3957r3958
5050
5151***************************************************************************/
5252#include "driver.h"
53#include "cpu/z80/z80.h"
5354#include "sound/ay8910.h"
5455#include "sound/3812intf.h"
5556
src/mame/drivers/vindictr.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "vindictr.h"
src/mame/drivers/hanaawas.c
r3957r3958
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
2930#include "sound/ay8910.h"
3031
3132
src/mame/drivers/mpu4drvr.c
r3957r3958
16191619static const mc6845_interface hd6845_intf =
16201620{
16211621   "main",                  /* screen we are acting on */
1622   MPU4_MASTER_CLOCK / 4 / 8,   /* the clock (pin 21) of the chip (educated guess)*/
16231622   8,                     /* number of pixels per video memory address */
16241623   NULL,                  /* before pixel update callback */
16251624   NULL,                  /* row update callback */
r3957r3958
16701669   MDRV_CPU_PROGRAM_MAP(mpu4_68k_map,0)
16711670   MDRV_CPU_VBLANK_INT("main", mpu4_vid_irq)
16721671
1673   MDRV_INTERLEAVE(16)
1672   MDRV_QUANTUM_TIME(HZ(960))
16741673
16751674   MDRV_MACHINE_START(mpu4_vid)
16761675   MDRV_MACHINE_RESET(mpu4_vid)
r3957r3958
16901689   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 1.00)
16911690
16921691   /* ACIAs */
1693   MDRV_DEVICE_ADD("acia6850_0", ACIA6850)
1694   MDRV_DEVICE_CONFIG(m6809_acia_if)
1695   MDRV_DEVICE_ADD("acia6850_1", ACIA6850)
1696   MDRV_DEVICE_CONFIG(m68k_acia_if)
1692   MDRV_ACIA6850_ADD("acia6850_0", m6809_acia_if)
1693   MDRV_ACIA6850_ADD("acia6850_1", m68k_acia_if)
16971694MACHINE_DRIVER_END
16981695
16991696static MACHINE_DRIVER_START( vgpoker )
r3957r3958
17321729   MDRV_PALETTE_LENGTH(32)
17331730   MDRV_PALETTE_INIT(dealem)
17341731
1735   MDRV_DEVICE_ADD("crtc", HD6845)                     /* HD68B45 */
1736   MDRV_DEVICE_CONFIG(hd6845_intf)
1732   MDRV_MC6845_ADD("crtc", HD6845, MPU4_MASTER_CLOCK / 4 / 8, hd6845_intf)   /* HD68B45 */
17371733MACHINE_DRIVER_END
17381734
17391735
src/mame/drivers/aquarium.c
r3957r3958
5050
5151
5252#include "driver.h"
53#include "cpu/z80/z80.h"
54#include "cpu/m68000/m68000.h"
5355#include "sound/2151intf.h"
5456#include "sound/okim6295.h"
5557#include "includes/aquarium.h"
src/mame/drivers/metro.c
r3957r3958
8282
8383#include "driver.h"
8484#include "deprecat.h"
85#include "cpu/z80/z80.h"
86#include "cpu/m68000/m68000.h"
8587#include "cpu/h83002/h8.h"
8688#include "cpu/upd7810/upd7810.h"
8789#include "machine/eeprom.h"
r3957r3958
333335static UINT16 metro_soundstatus;
334336static int porta, portb, busy_sndcpu;
335337
336static int metro_io_callback(int ioline, int state)
338static int metro_io_callback(const device_config *device, int ioline, int state)
337339{
338   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
340   const address_space *space = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
339341
340342   UINT8 data = 0;
341343
342    switch ( ioline )
344   switch ( ioline )
343345   {
344346      case UPD7810_RXD:   /* read the RxD line */
345347         data = soundlatch_r(space,0);
r3957r3958
348350         break;
349351      default:
350352         logerror("upd7810 ioline %d not handled\n", ioline);
351    }
353   }
352354
353355   return state;
354356}
src/mame/drivers/gal3.c
r3957r3958
6868*/
6969
7070#include "driver.h"
71#include "cpu/m68000/m68000.h"
7172
7273VIDEO_START(gal3)
7374{
src/mame/drivers/angelkds.c
r3957r3958
608608   MDRV_CPU_PROGRAM_MAP(sub_map,0)
609609   MDRV_CPU_IO_MAP(sub_portmap,0)
610610
611   MDRV_INTERLEAVE(100)
611   MDRV_QUANTUM_TIME(HZ(6000))
612612
613613   /* video hardware */
614614   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/jrpacman.c
r3957r3958
9999***************************************************************************/
100100
101101#include "driver.h"
102#include "cpu/z80/z80.h"
102103#include "pacman.h"
103104#include "sound/namco.h"
104105
src/mame/drivers/hshavoc.c
r3957r3958
3535
3636
3737#include "driver.h"
38#include "cpu/z80/z80.h"
39#include "cpu/m68000/m68000.h"
3840#include "genesis.h"
3941
4042#define MASTER_CLOCK      53693100
r3957r3958
139141   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
140142   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
141143
142   MDRV_INTERLEAVE(100)
144   MDRV_QUANTUM_TIME(HZ(6000))
143145
144146   MDRV_MACHINE_START(genesis)
145147   MDRV_MACHINE_RESET(genesis)
src/mame/drivers/circusc.c
r3957r3958
4848***************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "machine/konami1.h"
5253#include "cpu/m6809/m6809.h"
5354#include "sound/dac.h"
src/mame/drivers/laserbas.c
r3957r3958
1717********************************************/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "deprecat.h"
2122
2223static UINT8 *vram1,*vram2;
src/mame/drivers/mikie.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "cpu/m6809/m6809.h"
2122#include "sound/sn76496.h"
2223
src/mame/drivers/kingpin.c
r3957r3958
2020*/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
2324#include "video/tms9928a.h"
2425#include "sound/ay8910.h"
2526
src/mame/drivers/midvunit.c
r3957r3958
7474   dcs_reset_w(0);
7575
7676   memcpy(ram_base, memory_region(machine, "user1"), 0x20000*4);
77   cpu_reset(machine->cpu[0]);
77   device_reset(machine->cpu[0]);
7878
7979   timer[0] = timer_alloc(machine, NULL, NULL);
8080   timer[1] = timer_alloc(machine, NULL, NULL);
r3957r3958
8787   dcs_reset_w(0);
8888
8989   memcpy(ram_base, memory_region(machine, "user1"), 0x20000*4);
90   cpu_reset(machine->cpu[0]);
90   device_reset(machine->cpu[0]);
9191
9292   timer[0] = timer_alloc(machine, NULL, NULL);
9393   timer[1] = timer_alloc(machine, NULL, NULL);
r3957r3958
375375
376376static READ32_HANDLER( offroadc_serial_status_r )
377377{
378   int status = midway_serial_pic2_status_r();
378   int status = midway_serial_pic2_status_r(space);
379379   return (input_port_read(space->machine, "991030")  & 0x7fff7fff) | (status << 31) | (status << 15);
380380}
381381
382382
383383static READ32_HANDLER( offroadc_serial_data_r )
384384{
385   return midway_serial_pic2_r() << 16;
385   return midway_serial_pic2_r(space) << 16;
386386}
387387
388388
389389static WRITE32_HANDLER( offroadc_serial_data_w )
390390{
391   midway_serial_pic2_w(space->machine, data >> 16);
391   midway_serial_pic2_w(space, data >> 16);
392392}
393393
394394
src/mame/drivers/namcond1.c
r3957r3958
6666 *************************************************************/
6767
6868#include "driver.h"
69#include "cpu/m68000/m68000.h"
6970#include "video/ygv608.h"
7071#include "cpu/h83002/h8.h"
7172#include "namcond1.h"
r3957r3958
293294   MDRV_CPU_IO_MAP( nd1h8iomap, 0 )
294295   MDRV_CPU_VBLANK_INT("main", mcu_interrupt)
295296
296   MDRV_INTERLEAVE(100)
297   MDRV_QUANTUM_TIME(HZ(6000))
297298
298299   MDRV_MACHINE_START(namcond1)
299300   MDRV_MACHINE_RESET(namcond1)
r3957r3958
321322   MDRV_SOUND_ROUTE(2, "right", 1.00)
322323   MDRV_SOUND_ROUTE(3, "left", 1.00)
323324
324   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
325   MDRV_AT28C16_ADD( "at28c16", NULL )
325326MACHINE_DRIVER_END
326327
327328ROM_START( ncv1 )
src/mame/drivers/usgames.c
r3957r3958
2424*/
2525
2626#include "driver.h"
27#include "cpu/m6809/m6809.h"
2728#include "deprecat.h"
2829#include "video/mc6845.h"
2930#include "sound/ay8910.h"
r3957r3958
249250   MDRV_VIDEO_START(usgames)
250251   MDRV_VIDEO_UPDATE(usgames)
251252
252   MDRV_DEVICE_ADD("crtc", MC6845)
253   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
253254
254255   /* sound hardware */
255256   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/opwolf.c
r3957r3958
107107#define SOUND_CPU_CLOCK      (XTAL_8MHz / 2)      /* clock for Z80 sound CPU */
108108
109109#include "driver.h"
110#include "cpu/z80/z80.h"
111#include "cpu/m68000/m68000.h"
110112#include "taitoipt.h"
111113#include "video/taitoic.h"
112114#include "audio/taitosnd.h"
r3957r3958
584586   MDRV_CPU_ADD("audio", Z80, SOUND_CPU_CLOCK )   /* 4 MHz */
585587   MDRV_CPU_PROGRAM_MAP(z80_readmem,z80_writemem)
586588
587   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
589   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
588590
589591   MDRV_MACHINE_START(opwolf)
590592   MDRV_MACHINE_RESET(opwolf)
r3957r3958
637639   MDRV_CPU_PROGRAM_MAP(sub_z80_readmem,sub_z80_writemem)
638640   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
639641
640   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
642   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
641643
642644   MDRV_MACHINE_START(opwolf)
643645
src/mame/drivers/pangofun.c
r3957r3958
9090*/
9191
9292#include "driver.h"
93#include "cpu/i386/i386.h"
9394
9495static VIDEO_START(pangofun)
9596{
src/mame/drivers/suna16.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/z80/z80.h"
26#include "cpu/m68000/m68000.h"
2527#include "deprecat.h"
2628#include "sound/dac.h"
2729#include "sound/2151intf.h"
r3957r3958
853855   MDRV_CPU_PROGRAM_MAP(bssoccer_pcm_2_readmem,bssoccer_pcm_2_writemem)
854856   MDRV_CPU_IO_MAP(bssoccer_pcm_2_io_map,0)
855857
856   MDRV_INTERLEAVE(100)
858   MDRV_QUANTUM_TIME(HZ(6000))
857859
858860   /* video hardware */
859861   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
911913
912914   /* 2nd PCM Z80 missing */
913915
914   MDRV_INTERLEAVE(100)
916   MDRV_QUANTUM_TIME(HZ(6000))
915917
916918   MDRV_MACHINE_RESET(uballoon)
917919
r3957r3958
962964
963965   /* 2nd PCM Z80 missing */
964966
965   MDRV_INTERLEAVE(100)
967   MDRV_QUANTUM_TIME(HZ(6000))
966968
967969   /* video hardware */
968970   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
10341036
10351037   /* 2nd PCM Z80 missing */
10361038
1037   MDRV_INTERLEAVE(100)
1039   MDRV_QUANTUM_TIME(HZ(6000))
10381040
10391041   /* video hardware */
10401042   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/zaccaria.c
r3957r3958
3434***************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/z80/z80.h"
38#include "cpu/m6800/m6800.h"
3739#include "machine/6821pia.h"
3840#include "machine/8255ppi.h"
3941#include "sound/ay8910.h"
src/mame/drivers/shadfrce.c
r3957r3958
7878*/
7979
8080#include "driver.h"
81#include "deprecat.h"
81#include "cpu/z80/z80.h"
82#include "cpu/m68000/m68000.h"
8283#include "sound/2151intf.h"
8384#include "sound/okim6295.h"
8485
86#define MASTER_CLOCK      XTAL_28MHz
87#define CPU_CLOCK         MASTER_CLOCK / 2
88#define PIXEL_CLOCK      MASTER_CLOCK / 4
89
8590UINT16 *shadfrce_fgvideoram, *shadfrce_bg0videoram,  *shadfrce_bg1videoram,   *shadfrce_spvideoram;
8691
8792/* in video */
r3957r3958
98103
99104int shadfrce_video_enable = 0;
100105static int shadfrce_irqs_enable = 0;
101static int shadfrce_scanline = 0;
102static emu_timer *raster_irq_timer;
106static int raster_scanline = 0;
107static int raster_irq_enable = 0;
103108static int vblank = 0;
104109
105110
106111static WRITE16_HANDLER( shadfrce_flip_screen )
107112{
108   flip_screen_set(data & 0x01);
113   flip_screen_set(space->machine, data & 0x01);
109114}
110115
111116
r3957r3958
229234   }
230235}
231236
232static TIMER_CALLBACK( raster_interrupt )
233{
234   // force a screen partial update on the previous scanline
235   if (shadfrce_scanline != 0)
236       video_screen_update_partial(machine->primary_screen, shadfrce_scanline - 1);
237
238   shadfrce_scanline = (shadfrce_scanline + 1) % 256;
239
240   // fire another raster irq for the next scanline
241   cpu_set_input_line(machine->cpu[0], 1, ASSERT_LINE);
242   timer_adjust_oneshot(raster_irq_timer, video_screen_get_time_until_pos(machine->primary_screen, shadfrce_scanline, 0), 0);
243}
244
245237static WRITE16_HANDLER( shadfrce_irq_ack_w )
246238{
247239   cpu_set_input_line(space->machine->cpu[0], offset ^ 3, CLEAR_LINE);
r3957r3958
251243{
252244   static int prev_value = 0;
253245
254   shadfrce_irqs_enable = data & 1; // maybe, it's set/unset inside every trap instruction which is executed
255   shadfrce_video_enable = data & 8; // probably
246   shadfrce_irqs_enable = data & 1;   /* maybe, it's set/unset inside every trap instruction which is executed */
247   shadfrce_video_enable = data & 8;   /* probably */
256248
257   // check if there's a high transition to enable the raster timer
249   /* check if there's a high transition to enable the raster IRQ */
258250   if((~prev_value & 4) && (data & 4))
259251   {
260      if( !timer_enabled(raster_irq_timer) )
261      {
262         timer_enable(raster_irq_timer, 1);
263         timer_adjust_oneshot(raster_irq_timer, video_screen_get_time_until_pos(space->machine->primary_screen, shadfrce_scanline, 0), 0);
264      }
252      raster_irq_enable = 1;
265253   }
266254
267   // check if there's a low transition to disable the raster timer
255   /* check if there's a low transition to disable the raster IRQ */
268256   if((prev_value & 4) && (~data & 4))
269257   {
270      if( timer_enabled(raster_irq_timer) )
271      {
272         timer_enable(raster_irq_timer, 0);
273      }
258      raster_irq_enable = 0;
274259   }
275260
276261   prev_value = data;
r3957r3958
278263
279264static WRITE16_HANDLER( shadfrce_scanline_w )
280265{
281   shadfrce_scanline = data; // guess, 0 is always written
266   raster_scanline = data;    /* guess, 0 is always written */
282267}
283268
269static TIMER_DEVICE_CALLBACK( shadfrce_scanline )
270{
271   int scanline = param;
284272
273   /* Vblank is lowered on scanline 0 */
274   if (scanline == 0)
275   {
276      vblank = 0;
277   }
278   /* Hack */
279   else if (scanline == (248-1))      /* -1 is an hack needed to avoid deadlocks */
280   {
281      vblank = 4;
282   }
285283
284   /* Raster interrupt - Perform raster effect on given scanline */
285   if (raster_irq_enable)
286   {
287      if (scanline == raster_scanline)
288      {
289         raster_scanline = (raster_scanline + 1) % 240;
290         video_screen_update_partial(timer->machine->primary_screen, raster_scanline - 1);
291         cpu_set_input_line(timer->machine->cpu[0], 1, ASSERT_LINE);
292      }
293   }
294
295   /* An interrupt is generated every 16 scanlines */
296   if (shadfrce_irqs_enable)
297   {
298      if (scanline % 16 == 0)
299      {
300         video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
301         cpu_set_input_line(timer->machine->cpu[0], 2, ASSERT_LINE);
302      }
303   }
304
305   /* Vblank is raised on scanline 248 */
306   if (shadfrce_irqs_enable)
307   {
308      if (scanline == 248)
309      {
310         video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
311         cpu_set_input_line(timer->machine->cpu[0], 3, ASSERT_LINE);
312      }
313   }
314
315   /* Adjust for next scanline */
316   if (++scanline >= video_screen_get_height(timer->machine->primary_screen))
317   {
318      scanline = 0;
319   }
320}
321
322
323
286324/* Memory Maps */
287325
288326static ADDRESS_MAP_START( shadfrce_map, ADDRESS_SPACE_PROGRAM, 16 )
r3957r3958
347385
348386
349387static INPUT_PORTS_START( shadfrce )
350   PORT_START("P1")   /* Fake IN0 (player 1 inputs) */
388   PORT_START("P1")      /* Fake IN0 (player 1 inputs) */
351389   SHADFRCE_PLAYER_INPUT( 1, IPT_START1 )
352390
353   PORT_START("P2")   /* Fake IN1 (player 2 inputs) */
391   PORT_START("P2")      /* Fake IN1 (player 2 inputs) */
354392   SHADFRCE_PLAYER_INPUT( 2, IPT_START2 )
355393
356394   PORT_START("EXTRA")   /* Fake IN2 (players 1 & 2 extra inputs */
r3957r3958
368406
369407   PORT_START("SYSTEM")   /* Fake IN4 (system inputs) */
370408   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
371   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )                   /* only in "test mode" ? */
372   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )                /* only in "test mode" ? */
409   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )         /* only in "test mode" ? */
410   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )         /* only in "test mode" ? */
373411   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
374412
375413   PORT_START("MISC")   /* Fake IN5 (misc) */
376   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )             /* guess */
377   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                 /* must be ACTIVE_LOW or 'shadfrcj' jumps to the end (code at 0x04902e) */
414   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )         /* guess */
415   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )         /* must be ACTIVE_LOW or 'shadfrcj' jumps to the end (code at 0x04902e) */
378416   PORT_BIT( 0xeb, IP_ACTIVE_LOW, IPT_UNUSED )
379417
380418   PORT_START("DSW1")   /* Fake IN6 (DIP1) */
r3957r3958
478516   irq_handler
479517};
480518
481/*
482    Interrupts generation is guessed, but it requires the same hack as in wwfsstar.c
483*/
484static INTERRUPT_GEN( shadfrce_interrupt )
485{
486   int scanline = 255 - cpu_getiloops(device);
487
488   /* Vblank is lowered on scanline 0 (8) */
489   if (scanline == 0)
490   {
491      vblank = 0;
492   }
493   /* Hack */
494   else if (scanline==(248-1))
495   {
496      vblank = 4;
497   }
498   /* Vblank is raised on scanline 248 (256) */
499   else if (scanline==248)
500   {
501      if(shadfrce_irqs_enable)
502         cpu_set_input_line(device, 3, ASSERT_LINE);
503   }
504
505   /* An interrupt is generated every 16 scanlines */
506   if (scanline%16 == 0)
507   {
508      if(shadfrce_irqs_enable)
509         cpu_set_input_line(device, 2, ASSERT_LINE);
510   }
511}
512
513static MACHINE_RESET( shadfrce )
514{
515   raster_irq_timer = timer_alloc(machine, raster_interrupt, NULL);
516   timer_enable(raster_irq_timer, 0);
517   shadfrce_scanline = 0;
518}
519
520519static MACHINE_DRIVER_START( shadfrce )
521   MDRV_CPU_ADD("main", M68000, XTAL_28MHz/2) /* verified on pcb */
520   MDRV_CPU_ADD("main", M68000, CPU_CLOCK)          /* verified on pcb */
522521   MDRV_CPU_PROGRAM_MAP(shadfrce_map,0)
523   MDRV_CPU_VBLANK_INT_HACK(shadfrce_interrupt,256)
522   MDRV_TIMER_ADD_SCANLINE("scantimer", shadfrce_scanline, "main", 0, 1)
524523
525   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz) /* verified on pcb */
524   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz)       /* verified on pcb */
526525   MDRV_CPU_PROGRAM_MAP(shadfrce_sound_map,0)
527526
528   MDRV_MACHINE_RESET(shadfrce)
529
530527   MDRV_SCREEN_ADD("main", RASTER)
531   MDRV_SCREEN_REFRESH_RATE(60)
532   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
533528   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
534   MDRV_SCREEN_SIZE(64*8, 32*8)
535   MDRV_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
529   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 432, 0, 320, 272, 8, 248)   /* HTOTAL and VTOTAL are guessed */
536530
537531   MDRV_GFXDECODE(shadfrce)
538532   MDRV_PALETTE_LENGTH(0x4000)
r3957r3958
544538   /* sound hardware */
545539   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
546540
547   MDRV_SOUND_ADD("ym", YM2151, XTAL_3_579545MHz) /* verified on pcb */
541   MDRV_SOUND_ADD("ym", YM2151, XTAL_3_579545MHz)       /* verified on pcb */
548542   MDRV_SOUND_CONFIG(ym2151_config)
549543   MDRV_SOUND_ROUTE(0, "left", 0.50)
550544   MDRV_SOUND_ROUTE(1, "right", 0.50)
551545
552   MDRV_SOUND_ADD("oki", OKIM6295, XTAL_13_4952MHz/8) /* verified on pcb */
553   MDRV_SOUND_CONFIG(okim6295_interface_pin7high) /* verified on pcb, pin7 is at 2.4v */
546   MDRV_SOUND_ADD("oki", OKIM6295, XTAL_13_4952MHz/8)    /* verified on pcb */
547   MDRV_SOUND_CONFIG(okim6295_interface_pin7high)       /* verified on pcb, pin7 is at 2.4v */
554548   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.50)
555549   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.50)
556550MACHINE_DRIVER_END
src/mame/drivers/speedbal.c
r3957r3958
5151***************************************************************************/
5252
5353#include "driver.h"
54#include "cpu/z80/z80.h"
5455#include "deprecat.h"
5556#include "sound/3812intf.h"
5657
r3957r3958
6768{
6869   coin_counter_w(0, data & 0x80);
6970   coin_counter_w(1, data & 0x40);
70   flip_screen_set(data & 8); // also changes data & 0x10 at the same time too (flipx and flipy?)
71   flip_screen_set(space->machine, data & 8); // also changes data & 0x10 at the same time too (flipx and flipy?)
7172   /* unknown: (data & 0x10) and (data & 4) */
7273}
7374
src/mame/drivers/yumefuda.c
r3957r3958
5252*******************************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/z80/z80.h"
5556#include "machine/eeprom.h"
5657#include "sound/ay8910.h"
5758
r3957r3958
202203   {
203204      switch(address)
204205      {
205         case 0x0d: flip_screen_set(data & 0x80); break;
206         case 0x0d: flip_screen_set(space->machine, data & 0x80); break;
206207         default:
207208            logerror("Video Register %02x called with %02x data\n",address,data);
208209      }
src/mame/drivers/jongkyo.c
r3957r3958
11/* Jongkyo */
22#include "driver.h"
3#include "cpu/z80/z80.h"
34#include "sound/ay8910.h"
45#include "machine/segacrpt.h"
56
src/mame/drivers/attckufo.c
r3957r3958
4343****************************************/
4444
4545#include "driver.h"
46#include "cpu/m6502/m6502.h"
4647#include "includes/attckufo.h"
4748
4849
src/mame/drivers/littlerb.c
r3957r3958
5959*/
6060
6161#include "driver.h"
62#include "cpu/m68000/m68000.h"
6263
6364static UINT16 littlerb_vdp_address_low;
6465static UINT16 littlerb_vdp_address_high;
src/mame/drivers/firebeat.c
r3957r3958
109109*/
110110
111111#include "driver.h"
112#include "deprecat.h"
112#include "cpu/m68000/m68000.h"
113113#include "cpu/powerpc/ppc.h"
114114#include "machine/intelfsh.h"
115115#include "machine/scsicd.h"
r3957r3958
884884   atapi_cdata_wait = 0;
885885
886886   // allocate two SCSI CD-ROM devices
887   SCSIAllocInstance( SCSI_DEVICE_CDROM, &atapi_device_data[0], "scsi0" );
887   SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &atapi_device_data[0], "scsi0" );
888888   // TODO: the slave drive can be either CD-ROM, DVD-ROM or HDD
889   SCSIAllocInstance( SCSI_DEVICE_CDROM, &atapi_device_data[1], "scsi1" );
889   SCSIAllocInstance( machine, SCSI_DEVICE_CDROM, &atapi_device_data[1], "scsi1" );
890890   add_exit_callback(machine, atapi_exit);
891891}
892892
r3957r3958
17641764static MACHINE_START( firebeat )
17651765{
17661766   /* set conservative DRC options */
1767   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
1767   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
17681768
17691769   /* configure fast RAM regions for DRC */
1770   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
1771   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
1772   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x01ffffff);
1773   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
1774   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
1770   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
1771   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
1772   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x01ffffff);
1773   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
1774   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
17751775}
17761776
17771777static ADDRESS_MAP_START( firebeat_map, ADDRESS_SPACE_PROGRAM, 32 )
r3957r3958
22522252   return r;
22532253}
22542254
2255static void security_w(UINT8 data)
2255static void security_w(const device_config *device, UINT8 data)
22562256{
22572257   int r = ibutton_w(data);
22582258   if (r >= 0)
2259      ppc4xx_spu_receive_byte(Machine->cpu[0], r);
2259      ppc4xx_spu_receive_byte(device->machine->cpu[0], r);
22602260}
22612261
22622262/*****************************************************************************/
src/mame/drivers/clayshoo.c
r3957r3958
1313****************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
1617#include "machine/8255ppi.h"
1718
1819
src/mame/drivers/eolith.c
r3957r3958
5252 *********************************************************************/
5353
5454#include "driver.h"
55#include "cpu/e132xs/e132xs.h"
5556#include "deprecat.h"
5657#include "machine/eeprom.h"
5758
src/mame/drivers/bigevglf.c
r3957r3958
5656***************************************************************************/
5757
5858#include "driver.h"
59#include "cpu/z80/z80.h"
5960#include "deprecat.h"
6061#include "sound/ay8910.h"
6162#include "sound/msm5232.h"
r3957r3958
445446   MDRV_CPU_ADD("mcu", M68705,2000000)   /* ??? */
446447   MDRV_CPU_PROGRAM_MAP(m68705_map,0)
447448
448   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - interleaving is forced on the fly */
449   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - interleaving is forced on the fly */
449450
450451   MDRV_MACHINE_RESET(bigevglf)
451452   /* video hardware */
src/mame/drivers/bagman.c
r3957r3958
6161***************************************************************************/
6262
6363#include "driver.h"
64#include "deprecat.h"
64#include "cpu/z80/z80.h"
6565#include "sound/ay8910.h"
6666#include "sound/5110intf.h"
6767#include "sound/tms5110.h"
r3957r3958
105105}
106106
107107
108static int bagman_speech_rom_read_bit(void)
108static int bagman_speech_rom_read_bit(const device_config *device)
109109{
110   UINT8 *ROM = memory_region(Machine, "speech");
110   UINT8 *ROM = memory_region(device->machine, "speech");
111111   int bit_no = (ls259_buf[0]<<2) | (ls259_buf[1]<<1) | (ls259_buf[2]<<0);
112112   int byte = 0;
113113
src/mame/drivers/namcos23.c
r3957r3958
13011301   MDRV_CPU_IO_MAP( s23h8iomap, 0 )
13021302   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
13031303
1304   MDRV_INTERLEAVE(1000)
1304   MDRV_QUANTUM_TIME(HZ(60000))
13051305
13061306   MDRV_SCREEN_ADD("main", RASTER)
13071307   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
13451345   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
13461346
13471347
1348   MDRV_INTERLEAVE(1000)
1348   MDRV_QUANTUM_TIME(HZ(60000))
13491349
13501350   MDRV_SCREEN_ADD("main", RASTER)
13511351   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
13841384   MDRV_CPU_IO_MAP( s23h8iomap, 0 )
13851385   MDRV_CPU_VBLANK_INT("main", irq1_line_pulse)
13861386
1387   MDRV_INTERLEAVE(1000)
1387   MDRV_QUANTUM_TIME(HZ(60000))
13881388
13891389   MDRV_SCREEN_ADD("main", RASTER)
13901390   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/tattack.c
r3957r3958
1919****************************************************************************/
2020
2121#include "driver.h"
22#include "cpu/z80/z80.h"
2223
2324
2425static tilemap *tmap;
src/mame/drivers/commando.c
r3957r3958
4343***************************************************************************/
4444
4545#include "driver.h"
46#include "cpu/z80/z80.h"
4647#include "deprecat.h"
4748#include "sound/2203intf.h"
4849
src/mame/drivers/atarisy2.c
r3957r3958
124124
125125
126126#include "driver.h"
127#include "cpu/m6502/m6502.h"
127128#include "cpu/t11/t11.h"
128129#include "machine/atarigen.h"
129130#include "slapstic.h"
src/mame/drivers/mjsister.c
r3957r3958
77*****************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "deprecat.h"
1112#include "sound/dac.h"
1213#include "sound/ay8910.h"
src/mame/drivers/ninjakd2.c
r3957r3958
121121******************************************************************************/
122122
123123#include "driver.h"
124#include "cpu/z80/z80.h"
124125#include "sound/2203intf.h"
125126#include "sound/samples.h"
126127#include "machine/mc8123.h"
r3957r3958
193194   cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_RESET, (data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
194195
195196   // bit 7 flips screen
196   flip_screen_set(data & 0x80);
197   flip_screen_set(space->machine, data & 0x80);
197198
198199   // other bits unused
199200}
src/mame/drivers/skydiver.c
r3957r3958
8787***************************************************************************/
8888
8989#include "driver.h"
90#include "cpu/m6800/m6800.h"
9091#include "deprecat.h"
9192#include "skydiver.h"
9293#include "sound/discrete.h"
src/mame/drivers/spacefb.c
r3957r3958
105105****************************************************************************/
106106
107107#include "driver.h"
108#include "cpu/z80/z80.h"
108109#include "spacefb.h"
109110#include "cpu/mcs48/mcs48.h"
110111#include "sound/dac.h"
r3957r3958
338339   MDRV_CPU_PROGRAM_MAP(spacefb_audio_map,0)
339340   MDRV_CPU_IO_MAP(spacefb_audio_io_map,0)
340341
341   MDRV_INTERLEAVE(3)
342   MDRV_QUANTUM_TIME(HZ(180))
342343
343344   MDRV_MACHINE_START(spacefb)
344345   MDRV_MACHINE_RESET(spacefb)
src/mame/drivers/warpwarp.c
r3957r3958
127127***************************************************************************/
128128
129129#include "driver.h"
130#include "cpu/i8085/i8085.h"
130131#include "sound/custom.h"
131132#include "warpwarp.h"
132133#include "geebee.lh"
133134#include "sos.lh"
134135
136#define MASTER_CLOCK      XTAL_18_432MHz
135137
138
136139/*******************************************************
137140 *
138141 * Gee Bee overlay
r3957r3958
150153   res = input_port_read_safe(space->machine, portnames[offset], 0);
151154   if (offset == 3)
152155   {
153      res = input_port_read(space->machine, (flip_screen_get() & 1) ? "IN2" : "IN1");   // read player 2 input in cocktail mode
156      res = input_port_read(space->machine, (flip_screen_get(space->machine) & 1) ? "IN2" : "IN1");   // read player 2 input in cocktail mode
154157      if (handle_joystick)
155158      {
156159         /* map digital two-way joystick to two fixed VOLIN values */
r3957r3958
210213         warpwarp_ball_on = data & 1;
211214         break;
212215      case 7:
213         flip_screen_set(data & 1);
216         flip_screen_set(space->machine, data & 1);
214217         break;
215218   }
216219}
r3957r3958
233236{
234237   int res;
235238
236   res = input_port_read(space->machine, (flip_screen_get() & 1) ? "VOLIN2" : "VOLIN1");
239   res = input_port_read(space->machine, (flip_screen_get(space->machine) & 1) ? "VOLIN2" : "VOLIN1");
237240   if (handle_joystick)
238241   {
239242      if (res & 1) return 0x0f;
r3957r3958
288291         break;
289292      case 6:
290293         warpwarp_ball_on = data & 1;
291         cpu_interrupt_enable(0,data & 1);
294         cpu_interrupt_enable(space->machine->cpu[0],data & 1);
292295         if (~data & 1)
293296            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
294297         break;
295298      case 7:
296         flip_screen_set(data & 1);
299         flip_screen_set(space->machine, data & 1);
297300         break;
298301   }
299302}
r3957r3958
733736static MACHINE_DRIVER_START( geebee )
734737
735738   /* basic machine hardware */
736   MDRV_CPU_ADD("main", 8080,XTAL_18_432MHz/9) /* verified on pcb */
739   MDRV_CPU_ADD("main", 8080, MASTER_CLOCK/9) /* verified on pcb */
737740   MDRV_CPU_PROGRAM_MAP(geebee_map,0)
738741   MDRV_CPU_IO_MAP(geebee_port_map,0)
739   MDRV_CPU_VBLANK_INT("main", irq0_line_pulse)
742   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
740743
741744   /* video hardware */
742745   MDRV_SCREEN_ADD("main", RASTER)
743   MDRV_SCREEN_REFRESH_RATE(60)
744   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
745746   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
746   MDRV_SCREEN_SIZE(34*8, 28*8)
747   MDRV_SCREEN_VISIBLE_AREA(0*8, 34*8-1, 0*8, 28*8-1)
747   MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224)
748748
749749   MDRV_GFXDECODE(1k)
750750   MDRV_PALETTE_LENGTH(4*2)
r3957r3958
777777static MACHINE_DRIVER_START( bombbee )
778778
779779   /* basic machine hardware */
780   MDRV_CPU_ADD("main", 8080,18432000/9)       /* 18.432 MHz / 9 */
780   MDRV_CPU_ADD("main", 8080, MASTER_CLOCK/9)       /* 18.432 MHz / 9 */
781781   MDRV_CPU_PROGRAM_MAP(bombbee_map,0)
782782   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
783783
784784   /* video hardware */
785785   MDRV_SCREEN_ADD("main", RASTER)
786   MDRV_SCREEN_REFRESH_RATE(60)
787   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)   /* frames per second, vblank duration */)
788786   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
789   MDRV_SCREEN_SIZE(34*8, 28*8)
790   MDRV_SCREEN_VISIBLE_AREA(0*8, 34*8-1, 0*8, 28*8-1)
787   MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224)
791788
792789   MDRV_GFXDECODE(color)
793790   MDRV_PALETTE_LENGTH(2*256+1)
src/mame/drivers/cubocd32.c
r3957r3958
4545*/
4646
4747#include "driver.h"
48#include "cpu/m68000/m68000.h"
4849#include "sound/custom.h"
4950#include "includes/amiga.h"
5051#include "includes/cubocd32.h"
r3957r3958
223224static const cia6526_interface cia_0_intf =
224225{
225226   amiga_cia_0_irq,                           /* irq_func */
226   AMIGA_68EC020_PAL_CLOCK / 10,                  /* clock */
227227   0,                                       /* tod_clock */
228228   {
229229      { cd32_cia_0_porta_r, cd32_cia_0_porta_w },      /* port A */
r3957r3958
234234static const cia6526_interface cia_1_intf =
235235{
236236   amiga_cia_1_irq,                           /* irq_func */
237   AMIGA_68EC020_PAL_CLOCK / 10,                  /* clock */
238237   0,                                       /* tod_clock */
239238   {
240239      { NULL, NULL },                           /* port A */
r3957r3958
282281   MDRV_SOUND_ROUTE( 1, "right", 0.50 )
283282
284283   /* cia */
285   MDRV_DEVICE_ADD("cia_0", CIA8520)
286   MDRV_DEVICE_CONFIG(cia_0_intf)
287   MDRV_DEVICE_ADD("cia_1", CIA8520)
288   MDRV_DEVICE_CONFIG(cia_1_intf)
284   MDRV_CIA8520_ADD("cia_0", AMIGA_68EC020_PAL_CLOCK / 10, cia_0_intf)
285   MDRV_CIA8520_ADD("cia_1", AMIGA_68EC020_PAL_CLOCK / 10, cia_1_intf)
289286MACHINE_DRIVER_END
290287
291288
src/mame/drivers/wheelfir.c
r3957r3958
4949
5050
5151#include "driver.h"
52#include "cpu/m68000/m68000.h"
5253#include "deprecat.h"
5354
5455static int toggle_bit;
src/mame/drivers/steaser.c
r3957r3958
3939
4040
4141#include "driver.h"
42#include "cpu/m68000/m68000.h"
4243#include "deprecat.h"
4344
4445
src/mame/drivers/cbuster.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/m68000/m68000.h"
2021#include "cpu/h6280/h6280.h"
2122#include "sound/2203intf.h"
2223#include "sound/2151intf.h"
src/mame/drivers/ghosteo.c
r3957r3958
5252*/
5353
5454#include "driver.h"
55#include "cpu/arm7/arm7.h"
5556#include "cpu/arm7/arm7core.h"
5657
5758static UINT32 *system_memory;
src/mame/drivers/dunhuang.c
r3957r3958
5050*********************************************************************************************************************/
5151
5252#include "driver.h"
53#include "cpu/z80/z80.h"
5354#include "sound/ay8910.h"
5455#include "sound/okim6295.h"
5556#include "sound/2413intf.h"
r3957r3958
679680   MDRV_CPU_IO_MAP(dunhuang_io_map,0)
680681   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
681682
682   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(5))
683   MDRV_WATCHDOG_TIME_INIT(SEC(5))
683684
684685   /* video hardware */
685686   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gng.c
r3957r3958
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
2425#include "deprecat.h"
2526#include "cpu/m6809/m6809.h"
2627#include "sound/2203intf.h"
src/mame/drivers/onetwo.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "sound/okim6295.h"
4445#include "sound/3812intf.h"
4546
src/mame/drivers/n8080.c
r3957r3958
9393   }
9494}
9595
96static MACHINE_START( spacefev )
96static const i8085_config n8080_cpu_config =
9797{
98   const device_config *cpu = cputag_get_cpu(machine, "main");
98   n8080_inte_callback,   /* INTE changed callback */
99   n8080_status_callback,   /* STATUS changed callback */
100   NULL,               /* SOD changed callback (8085A only) */
101   NULL,               /* SID changed callback (8085A only) */
102};
99103
100   i8085_set_status_callback(cpu, n8080_status_callback);
101   i8085_set_inte_callback(cpu, n8080_inte_callback);
102}
103
104104static MACHINE_DRIVER_START( spacefev )
105105
106106   /* basic machine hardware */
107107   MDRV_CPU_ADD("main", 8080, 20160000 / 10)
108   MDRV_CPU_CONFIG(n8080_cpu_config)
108109   MDRV_CPU_PROGRAM_MAP(main_cpu_map, 0)
109110   MDRV_CPU_IO_MAP(main_io_map, 0)
110111
111   MDRV_MACHINE_START(spacefev)
112
113112   /* video hardware */
114113   MDRV_SCREEN_ADD("main", RASTER)
115114   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
134133
135134   /* basic machine hardware */
136135   MDRV_CPU_ADD("main", 8080, 20160000 / 10)
136   MDRV_CPU_CONFIG(n8080_cpu_config)
137137   MDRV_CPU_PROGRAM_MAP(main_cpu_map, 0)
138138   MDRV_CPU_IO_MAP(main_io_map, 0)
139139
140   MDRV_MACHINE_START(spacefev)
141
142140   /* video hardware */
143141   MDRV_SCREEN_ADD("main", RASTER)
144142   MDRV_SCREEN_REFRESH_RATE(60)
r3957r3958
163161
164162   /* basic machine hardware */
165163   MDRV_CPU_ADD("main", 8080, 20160000 / 10)
164   MDRV_CPU_CONFIG(n8080_cpu_config)
166165   MDRV_CPU_PROGRAM_MAP(helifire_main_cpu_map, 0)
167166   MDRV_CPU_IO_MAP(main_io_map, 0)
168167
169   MDRV_MACHINE_START(spacefev)
170
171168   /* video hardware */
172169   MDRV_SCREEN_ADD("main", RASTER)
173170   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/nbmj8891.c
r3957r3958
4444******************************************************************************/
4545
4646#include "driver.h"
47#include "cpu/z80/z80.h"
4748#include "nb1413m3.h"
4849#include "sound/dac.h"
4950#include "sound/ay8910.h"
src/mame/drivers/kncljoe.c
r3957r3958
2626***************************************************************************/
2727
2828#include "driver.h"
29#include "cpu/z80/z80.h"
2930#include "cpu/m6800/m6800.h"
3031#include "sound/ay8910.h"
3132#include "sound/sn76496.h"
src/mame/drivers/holeland.c
r3957r3958
1212***************************************************************************/
1313
1414#include "driver.h"
15#include "cpu/z80/z80.h"
1516#include "sound/ay8910.h"
1617
1718VIDEO_START( holeland );
src/mame/drivers/liberate.c
r3957r3958
525525   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
526526   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
527527
528   MDRV_INTERLEAVE(200)
528   MDRV_QUANTUM_TIME(HZ(12000))
529529
530530   /* video hardware */
531531   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
553553MACHINE_DRIVER_END
554554
555555static MACHINE_DRIVER_START( liberatb )
556   MDRV_IMPORT_FROM(liberate)
556557
557558   /* basic machine hardware */
558   MDRV_CPU_ADD("main", M6502, 2000000)
559   MDRV_CPU_MODIFY("main")
560   MDRV_CPU_TYPE(M6502)
559561   MDRV_CPU_PROGRAM_MAP(liberatb_readmem,liberatb_writemem)
560562   MDRV_CPU_VBLANK_INT("main", deco16_interrupt)
561563
562   MDRV_IMPORT_FROM(liberate)
563564   MDRV_CPU_REMOVE("main")
564565MACHINE_DRIVER_END
565566
r3957r3958
572573
573574static MACHINE_DRIVER_START( prosoccr )
574575
576   MDRV_IMPORT_FROM(liberate)
577
575578   /* basic machine hardware */
576   MDRV_CPU_ADD("main", DECO16, 3000000)
579   MDRV_CPU_MODIFY("main")
580   MDRV_CPU_CLOCK(3000000)
577581   MDRV_CPU_PROGRAM_MAP(liberate_readmem,liberate_writemem)
578582   MDRV_CPU_IO_MAP(deco16_io_map,0)
579583
580   MDRV_IMPORT_FROM(liberate)
581   MDRV_CPU_REMOVE("main")
582
583584   MDRV_VIDEO_START(prosoccr)
584585   MDRV_VIDEO_UPDATE(prosoccr)
585586MACHINE_DRIVER_END
r3957r3958
595596   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
596597   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,16)
597598
598   MDRV_INTERLEAVE(200)
599   MDRV_QUANTUM_TIME(HZ(12000))
599600
600601   /* video hardware */
601602   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/spdodgeb.c
r3957r3958
2222***************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/m6502/m6502.h"
2526#include "deprecat.h"
2627#include "cpu/m6809/m6809.h"
2728#include "sound/3812intf.h"
src/mame/drivers/gunsmoke.c
r3957r3958
6767***************************************************************************/
6868
6969#include "driver.h"
70#include "cpu/z80/z80.h"
7071#include "deprecat.h"
7172#include "sound/2203intf.h"
7273
src/mame/drivers/cvs.c
r3957r3958
8383***************************************************************************/
8484
8585#include "driver.h"
86#include "deprecat.h"
8786#include "cpu/s2650/s2650.h"
8887#include "sound/dac.h"
8988#include "sound/5110intf.h"
r3957r3958
252251}
253252
254253
255static void cvs_dac_cpu_interrupt(void)
254static void cvs_dac_cpu_interrupt(running_machine *machine)
256255{
257   cpu_set_input_line_vector(Machine->cpu[CVS_DAC_CPU_INDEX], 0, 0x03);
258   cpu_set_input_line(Machine->cpu[CVS_DAC_CPU_INDEX], 0, HOLD_LINE);
256   cpu_set_input_line_vector(machine->cpu[CVS_DAC_CPU_INDEX], 0, 0x03);
257   cpu_set_input_line(machine->cpu[CVS_DAC_CPU_INDEX], 0, HOLD_LINE);
259258}
260259
261260
r3957r3958
432431}
433432
434433
435static int speech_rom_read_bit(void)
434static int speech_rom_read_bit(const device_config *device)
436435{
437   UINT8 *ROM = memory_region(Machine, "speechdata");
438    int bit;
436   running_machine *machine = device->machine;
437   UINT8 *ROM = memory_region(machine, "speechdata");
438   int bit;
439439
440440   /* before reading the bit, clamp the address to the region length */
441   speech_rom_bit_address = speech_rom_bit_address & ((memory_region_length(Machine, "speechdata") * 8) - 1);
441   speech_rom_bit_address = speech_rom_bit_address & ((memory_region_length(machine, "speechdata") * 8) - 1);
442442   bit = (ROM[speech_rom_bit_address >> 3] >> (speech_rom_bit_address & 0x07)) & 0x01;
443443
444444   /* prepare for next bit */
r3957r3958
468468   if (data & 0x80)
469469   {
470470         soundlatch_w(space, 0, data);
471      cvs_dac_cpu_interrupt();
471      cvs_dac_cpu_interrupt(space->machine);
472472
473473      LOG(("%04x : CVS: Audio command = %02x\n", cpu_get_pc(space->cpu), data));
474474   }
src/mame/drivers/turbo.c
r3957r3958
145145**************************************************************************/
146146
147147#include "driver.h"
148#include "cpu/z80/z80.h"
148149#include "machine/8255ppi.h"
149150#include "turbo.h"
150151#include "machine/segacrpt.h"
r3957r3958
11441145   MDRV_CPU_PROGRAM_MAP(buckrog_cpu2_map,0)
11451146   MDRV_CPU_IO_MAP(buckrog_cpu2_portmap,0)
11461147
1147   MDRV_INTERLEAVE(10)
1148   MDRV_QUANTUM_TIME(HZ(600))
11481149   MDRV_MACHINE_RESET(buckrog)
11491150
11501151   MDRV_PPI8255_ADD( "ppi8255_0", buckrog_8255_intf[0] )
src/mame/drivers/seta.c
r3957r3958
12881288***************************************************************************/
12891289
12901290#include "driver.h"
1291#include "cpu/z80/z80.h"
1292#include "cpu/m68000/m68000.h"
1293#include "cpu/m6502/m6502.h"
12911294#include "deprecat.h"
12921295#include "seta.h"
12931296#include "machine/6821pia.h"
r3957r3958
82288231   MDRV_SOUND_ROUTE(1, "right", 1.0)
82298232
82308233   /* devices */
8231   MDRV_DEVICE_ADD("rtc", MSM6242)
8234   MDRV_MSM6242_ADD("rtc")
82328235MACHINE_DRIVER_END
82338236
82348237
src/mame/drivers/laserbat.c
r3957r3958
1717*/
1818
1919#include "driver.h"
20#include "cpu/m6800/m6800.h"
2021#include "cpu/s2650/s2650.h"
2122#include "machine/6821pia.h"
2223#include "video/s2636.h"
r3957r3958
7980{
8081   laserbat_input_mux = (data & 0x30) >> 4;
8182
82   flip_screen_set_no_update(data & 0x08);
83   flip_screen_set_no_update(space->machine, data & 0x08);
8384
8485   coin_counter_w(0,data & 1);
8586
src/mame/drivers/trvquest.c
r3957r3958
3535*/
3636
3737#include "driver.h"
38#include "cpu/m6809/m6809.h"
3839#include "machine/6522via.h"
3940#include "sound/ay8910.h"
4041#include "gameplan.h"
src/mame/drivers/tnzs.c
r3957r3958
620620
621621
622622#include "driver.h"
623#include "cpu/z80/z80.h"
623624#include "taitoipt.h"
624625#include "cpu/i8x41/i8x41.h"
625626#include "sound/2203intf.h"
r3957r3958
16481649   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
16491650   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16501651
1651   MDRV_INTERLEAVE(10000)
1652   MDRV_QUANTUM_PERFECT_CPU("main")//TIME(HZ(600000))
16521653
16531654   MDRV_MACHINE_RESET(tnzs)
16541655
r3957r3958
16871688   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
16881689   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16891690
1690   MDRV_INTERLEAVE(10000)
1691   MDRV_QUANTUM_TIME(HZ(600000))
16911692
16921693   MDRV_MACHINE_RESET(tnzs)
16931694
r3957r3958
17291730   MDRV_CPU_ADD("mcu", I8742 ,12000000/2)   /* 400KHz ??? - Main board Crystal is 12MHz */
17301731   MDRV_CPU_IO_MAP(i8742_io_map,0)
17311732
1732   MDRV_INTERLEAVE(10000)
1733   MDRV_QUANTUM_TIME(HZ(600000))
17331734
17341735   MDRV_MACHINE_RESET(tnzs)
17351736
r3957r3958
17671768   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
17681769   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17691770
1770   MDRV_INTERLEAVE(10000)
1771   MDRV_QUANTUM_TIME(HZ(600000))
17711772
17721773   MDRV_MACHINE_RESET(tnzs)
17731774
r3957r3958
18051806   MDRV_CPU_PROGRAM_MAP(kageki_sub_readmem,kageki_sub_writemem)
18061807   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18071808
1808   MDRV_INTERLEAVE(10000)
1809   MDRV_QUANTUM_TIME(HZ(600000))
18091810
18101811   MDRV_MACHINE_RESET(tnzs)
18111812
r3957r3958
18541855   MDRV_CPU_PROGRAM_MAP(tnzsb_cpu2_map,0)
18551856   MDRV_CPU_IO_MAP(tnzsb_io_map,0)
18561857
1857   MDRV_INTERLEAVE(10000)
1858   MDRV_QUANTUM_TIME(HZ(600000))
18581859
18591860   MDRV_MACHINE_RESET(tnzs)
18601861
r3957r3958
19181919   MDRV_CPU_PROGRAM_MAP(jpopnics_sub_map,0)
19191920   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
19201921
1921   MDRV_INTERLEAVE(10000)
1922   MDRV_QUANTUM_TIME(HZ(600000))
19221923
19231924   /* video hardware */
19241925   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/tp84.c
r3957r3958
6565***************************************************************************/
6666
6767#include "driver.h"
68#include "cpu/z80/z80.h"
69#include "cpu/m6809/m6809.h"
6870#include "sound/sn76496.h"
6971#include "sound/flt_rc.h"
7072
r3957r3958
429431   MDRV_CPU_ADD("audio", Z80,XTAL_14_31818MHz/4) /* verified on pcb */
430432   MDRV_CPU_PROGRAM_MAP(audio_map,0)
431433
432   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
434   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
433435                     /* synchronization of the CPUs */
434436   /* video hardware */
435437   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/rohga.c
r3957r3958
108108***************************************************************************/
109109
110110#include "driver.h"
111#include "cpu/m68000/m68000.h"
111112#include "cpu/h6280/h6280.h"
112113#include "decocrpt.h"
113114#include "decoprot.h"
src/mame/drivers/vball.c
r3957r3958
137137*/
138138static WRITE8_HANDLER( vb_scrollx_hi_w )
139139{
140   flip_screen_set(~data&1);
140   flip_screen_set(space->machine, ~data&1);
141141   vb_scrollx_hi = (data & 0x02) << 7;
142142   vb_bgprombank_w(space->machine, (data >> 2)&0x07);
143143   vb_spprombank_w(space->machine, (data >> 5)&0x07);
src/mame/drivers/higemaru.c
r3957r3958
1111****************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "deprecat.h"
1516#include "sound/ay8910.h"
1617
src/mame/drivers/plygonet.c
r3957r3958
105105static const UINT16 dsp56k_shared_ram_16_size = 0x2000;   static UINT16* dsp56k_shared_ram_16;
106106static const UINT16 dsp56k_bank04_size = 0x1fc0;      static UINT16* dsp56k_bank04_ram;
107107
108static direct_update_func dsp56k_update_handler = NULL;
109
108110static const eeprom_interface eeprom_intf =
109111{
110112   7,            /* address bits */
r3957r3958
187189/* irq 3 is network.  don't generate if you don't emulate the network h/w! */
188190/* irq 5 is vblank */
189191/* irq 7 does nothing (it jsrs to a rts and then rte) */
190
191192static INTERRUPT_GEN(polygonet_interrupt)
192193{
193194   cpu_set_input_line(device, M68K_IRQ_5, HOLD_LINE);
194195}
195196
196197/* sound CPU communications */
197
198198static READ32_HANDLER( sound_r )
199199{
200200   int latch = soundlatch3_r(space, 0);
r3957r3958
230230   if (mem_mask == 0x0000ff00)   { hi_addr++; }   /* Low byte */
231231   if (mem_mask == 0xff000000) {}            /* High byte */
232232
233   value = dsp56k_host_interface_read((device_config*)space->cpu, hi_addr);
233   value = dsp56k_host_interface_read((device_config*)cputag_get_cpu(space->machine, "dsp"), hi_addr);
234234
235235   if (mem_mask == 0x0000ff00)   { value <<= 8;  }
236236   if (mem_mask == 0xff000000) { value <<= 24; }
r3957r3958
284284      cputag_set_input_line(space->machine, "dsp", DSP56K_IRQ_MODB, CLEAR_LINE);
285285   }
286286
287   /* 0x04000000 is the ??? line */
288
287   /* 0x04000000 is the COMBNK line - it switches who has access to the shared RAM - the dsp or the 68020 */
289288}
290289
291290static WRITE32_HANDLER( dsp_host_interface_w )
r3957r3958
300299   if (mem_mask == 0xff000000) { hi_data = (data & 0xff000000) >> 24; }
301300
302301   logerror("write (host-side) %08x %08x %08x (HI %04x)\n", offset, mem_mask, data, hi_addr);
303   dsp56k_host_interface_write((device_config*)space->cpu, hi_addr, hi_data);
302   dsp56k_host_interface_write((device_config*)cputag_get_cpu(space->machine, "dsp"), hi_addr, hi_data);
304303}
305304
306305
r3957r3958
309308   return 0x08000000;
310309}
311310
311
312WRITE32_HANDLER( plygonet_palette_w )
313{
314   int r,g,b;
315
316   COMBINE_DATA(&paletteram32[offset]);
317
318    r = (paletteram32[offset] >>16) & 0xff;
319   g = (paletteram32[offset] >> 8) & 0xff;
320   b = (paletteram32[offset] >> 0) & 0xff;
321
322   palette_set_color(space->machine,offset,MAKE_RGB(r,g,b));
323}
324
325
312326/**********************************************************************************/
313327/*******                            DSP56k maps                             *******/
314328/**********************************************************************************/
r3957r3958
321335
322336static DIRECT_UPDATE_HANDLER( plygonet_dsp56k_direct_handler )
323337{
324   if (address >= 0x7000 && address <= 0x7fff)
338   /* Call the dsp's update handler first */
339   if (dsp56k_update_handler != NULL)
325340   {
326      direct->raw = direct->decrypted = (void*)(dsp56k_p_mirror - 0x7000);
341      if ((*dsp56k_update_handler)(space, address, direct) == ~0)
342         return ~0;
343   }
344
345   /* If the requested region wasn't in there, see if it needs to be caught driver-side */
346   if (address >= (0x7000<<1) && address <= (0x7fff<<1))
347   {
348      direct->raw = direct->decrypted = (UINT8*)(dsp56k_p_mirror) - (0x7000<<1);
327349      return ~0;
328350   }
329   else if (address >= 0x8000 && address <= 0x87ff)
351   else if (address >= (0x8000<<1) && address <= (0x87ff<<1))
330352   {
331      direct->raw = direct->decrypted = (void*)(dsp56k_p_8000 - 0x8000);
353      direct->raw = direct->decrypted = (UINT8*)(dsp56k_p_8000) - (0x8000<<1);
332354      return ~0;
333355   }
334356
r3957r3958
496518}
497519
498520
499WRITE32_HANDLER( plygonet_palette_w )
500{
501   int r,g,b;
502
503   COMBINE_DATA(&paletteram32[offset]);
504
505    r = (paletteram32[offset] >>16) & 0xff;
506   g = (paletteram32[offset] >> 8) & 0xff;
507   b = (paletteram32[offset] >> 0) & 0xff;
508
509   palette_set_color(space->machine,offset,MAKE_RGB(r,g,b));
510}
511
512
513521/**********************************************************************************/
514522
515523static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 )
r3957r3958
643651   MDRV_NVRAM_HANDLER(polygonet)
644652
645653   /* TODO: TEMPORARY!  UNTIL A MORE LOCALIZED SYNC CAN BE MADE */
646   MDRV_INTERLEAVE(20000)
654   MDRV_QUANTUM_TIME(HZ(1200000))
647655
648656   /* video hardware */
649657   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
715723   memset(dsp56k_bank04_ram,    0, 2 * 8 * dsp56k_bank04_size        * sizeof(UINT16));
716724
717725   /* The dsp56k occasionally executes out of mapped memory */
718   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
726   dsp56k_update_handler = memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1], ADDRESS_SPACE_PROGRAM), plygonet_dsp56k_direct_handler);
719727}
720728
721729ROM_START( plygonet )
src/mame/drivers/batman.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "batman.h"
src/mame/drivers/naomi.c
r3957r3958
653653*/
654654
655655#include "driver.h"
656#include "cpu/arm7/arm7.h"
656657#include "video/generic.h"
657658#include "machine/eeprom.h"
658659#include "naomibd.h"
src/mame/drivers/nemesis.c
r3957r3958
3737***************************************************************************/
3838
3939#include "driver.h"
40#include "cpu/m68000/m68000.h"
4041#include "deprecat.h"
4142#include "cpu/z80/z80.h"
4243#include "sound/ay8910.h"
src/mame/drivers/cheekyms.c
r3957r3958
77**************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "sound/dac.h"
1112
1213
src/mame/drivers/magmax.c
r3957r3958
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/z80/z80.h"
2728#include "cpu/m68000/m68000.h"
2829#include "sound/ay8910.h"
2930
r3957r3958
377378   MDRV_CPU_PROGRAM_MAP(magmax_soundreadmem,magmax_soundwritemem)
378379   MDRV_CPU_IO_MAP(magmax_sound_io_map,0)
379380
380   MDRV_INTERLEAVE(10)
381   MDRV_QUANTUM_TIME(HZ(600))
381382
382383   MDRV_MACHINE_START(magmax)
383384   MDRV_MACHINE_RESET(magmax)
src/mame/drivers/asteroid.c
r3957r3958
166166***************************************************************************/
167167
168168#include "driver.h"
169#include "cpu/m6502/m6502.h"
169170#include "rendlay.h"
170171#include "video/vector.h"
171172#include "video/avgdvg.h"
src/mame/drivers/powerbal.c
r3957r3958
1414*/
1515
1616#include "driver.h"
17#include "cpu/m68000/m68000.h"
1718#include "machine/eeprom.h"
1819#include "sound/okim6295.h"
1920
src/mame/drivers/stv.c
r3957r3958
154154*/
155155
156156#include "driver.h"
157#include "cpu/m68000/m68000.h"
157158#include "machine/eeprom.h"
158159#include "cpu/sh2/sh2.h"
159160#include "machine/stvcd.h"
r3957r3958
19711972   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
19721973   cpuexec_boost_interleave(space->machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
19731974   cpuexec_trigger(space->machine, 1000);
1974   cpu_set_info_int(space->machine->cpu[1], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
1975   device_set_info_int(space->machine->cpu[1], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
19751976}
19761977
19771978static WRITE32_HANDLER( sinit_w )
19781979{
19791980   logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
19801981   cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost));
1981   cpu_set_info_int(space->machine->cpu[0], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
1982   device_set_info_int(space->machine->cpu[0], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
19821983}
19831984
19841985
r3957r3958
23292330   // do strict overwrite verification - maruchan and rsgun crash after coinup without this.
23302331   // cottonbm needs strict PCREL
23312332   // todo: test what games need this and don't turn it on for them...
2332   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2333   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2333   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2334   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
23342335
23352336   /* debug .. watch the command buffer rsgun, cottonbm etc. appear to use to communicate between cpus */
23362337   memory_install_write32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
src/mame/drivers/megatech.c
r3957r3958
7878
7979*/
8080#include "driver.h"
81#include "cpu/z80/z80.h"
8182#include "genesis.h"
8283#include "rendlay.h"
8384#include "megadriv.h"
r3957r3958
542543
543544static READ8_HANDLER (megatech_bios_joypad_r)
544545{
545   return megatech_bios_port_cc_dc_r(offset,bios_port_ctrl);
546   return megatech_bios_port_cc_dc_r(space->machine,offset,bios_port_ctrl);
546547}
547548
548549
src/mame/drivers/queen.c
r3957r3958
1717*/
1818
1919#include "driver.h"
20#include "cpu/i386/i386.h"
2021
2122VIDEO_START(queen)
2223{
src/mame/drivers/timelimt.c
r3957r3958
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "sound/ay8910.h"
1516
1617/* from video */
r3957r3958
270271   MDRV_CPU_IO_MAP(sound_io_map,0)
271272   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* ? */
272273
273   MDRV_INTERLEAVE(50)
274   MDRV_QUANTUM_TIME(HZ(3000))
274275
275276   MDRV_MACHINE_START(timelimt)
276277   MDRV_MACHINE_RESET(timelimt)
src/mame/drivers/warriorb.c
r3957r3958
144144***************************************************************************/
145145
146146#include "driver.h"
147#include "cpu/z80/z80.h"
147148#include "taitoipt.h"
148149#include "rendlay.h"
149150#include "cpu/m68000/m68000.h"
src/mame/drivers/igs_blit.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/m68000/m68000.h"
4445#include "deprecat.h"
4546#include "sound/okim6295.h"
4647#include "sound/2413intf.h"
src/mame/drivers/goal92.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/z80/z80.h"
12#include "cpu/m68000/m68000.h"
1113#include "sound/2203intf.h"
1214#include "sound/okim6295.h"
1315#include "sound/msm5205.h"
src/mame/drivers/champbwl.c
r3957r3958
151151*/
152152
153153#include "driver.h"
154#include "cpu/z80/z80.h"
154155#include "sound/x1_010.h"
155156#include "includes/tnzs.h"
156157
src/mame/drivers/vamphalf.c
r3957r3958
2828*********************************************************************/
2929
3030#include "driver.h"
31#include "cpu/mcs51/mcs51.h"
32#include "cpu/e132xs/e132xs.h"
3133#include "machine/eeprom.h"
3234#include "sound/2151intf.h"
3335#include "sound/okim6295.h"
src/mame/drivers/1942.c
r3957r3958
7777#define AUDIO_CLOCK      (XTAL_12MHz/8) /* 12MHz is the only OSC on the PCB */
7878
7979#include "driver.h"
80#include "cpu/z80/z80.h"
8081#include "deprecat.h"
8182#include "sound/ay8910.h"
8283
src/mame/drivers/mayumi.c
r3957r3958
77*****************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "sound/2203intf.h"
1112
1213#define MCLK 10000000
r3957r3958
3637
3738   int_enable = data & 1;
3839
39   flip_screen_set(data & 2);
40   flip_screen_set(space->machine, data & 2);
4041}
4142
4243static MACHINE_RESET( mayumi )
src/mame/drivers/poolshrk.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89#include "poolshrk.h"
910#include "sound/discrete.h"
1011
src/mame/drivers/bloodbro.c
r3957r3958
108108**************************************************************************/
109109
110110#include "driver.h"
111#include "cpu/m68000/m68000.h"
111112#include "audio/seibu.h"
112113#include "cpu/z80/z80.h"
113114#include "sound/3812intf.h"
src/mame/drivers/raiden.c
r3957r3958
3636***************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/nec/nec.h"
3940#include "cpu/z80/z80.h"
4041#include "audio/seibu.h"
4142#include "sound/3812intf.h"
r3957r3958
244245
245246   SEIBU_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */
246247
247   MDRV_INTERLEAVE(200)
248   MDRV_QUANTUM_TIME(HZ(12000))
248249
249250   MDRV_MACHINE_RESET(seibu_sound)
250251
r3957r3958
283284
284285   SEIBU_SOUND_SYSTEM_CPU(XTAL_14_31818MHz/4) /* verified on pcb */
285286
286   MDRV_INTERLEAVE(120)
287   MDRV_QUANTUM_TIME(HZ(7200))
287288
288289   MDRV_MACHINE_RESET(seibu_sound)
289290
src/mame/drivers/alg.c
r3957r3958
2121**************************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/m68000/m68000.h"
2425#include "render.h"
2526#include "includes/amiga.h"
2627#include "machine/laserdsc.h"
r3957r3958
113114      UINT8 data = laserdisc_data_r(laserdisc);
114115      if (data != 0x0a)
115116         mame_printf_debug("Sending serial data = %02X\n", data);
116      amiga_serial_in_w(data);
117      amiga_serial_in_w(machine, data);
117118   }
118119
119120   /* if there's more to come, set another timer */
120121   if (laserdisc_line_r(laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
121      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(), 0);
122      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(machine), 0);
122123   else
123124      serial_timer_active = FALSE;
124125}
125126
126127
127static void vsync_callback(void)
128static void vsync_callback(running_machine *machine)
128129{
129130   /* if we have data available, set a timer to read it */
130131   if (!serial_timer_active && laserdisc_line_r(laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
131132   {
132      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(), 0);
133      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(machine), 0);
133134      serial_timer_active = TRUE;
134135   }
135136}
136137
137138
138static void serial_w(UINT16 data)
139static void serial_w(running_machine *machine, UINT16 data)
139140{
140141   /* write to the laserdisc player */
141142   laserdisc_data_w(laserdisc, data & 0xff);
r3957r3958
143144   /* if we have data available, set a timer to read it */
144145   if (!serial_timer_active && laserdisc_line_r(laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
145146   {
146      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(), 0);
147      timer_adjust_oneshot(serial_timer, amiga_get_serial_char_period(machine), 0);
147148      serial_timer_active = TRUE;
148149   }
149150}
r3957r3958
156157 *
157158 *************************************/
158159
159static void alg_potgo_w(UINT16 data)
160static void alg_potgo_w(running_machine *machine, UINT16 data)
160161{
161162   /* bit 15 controls whether pin 9 is input/output */
162163   /* bit 14 controls the value, which selects which player's controls to read */
r3957r3958
390391static const cia6526_interface cia_0_intf =
391392{
392393   amiga_cia_0_irq,                        /* irq_func */
393   AMIGA_68000_NTSC_CLOCK / 10,               /* clock */
394394   0,                                    /* tod_clock */
395395   {
396396      { alg_cia_0_porta_r, alg_cia_0_porta_w },   /* port A */
r3957r3958
401401static const cia6526_interface cia_1_intf =
402402{
403403   amiga_cia_1_irq,                        /* irq_func */
404   AMIGA_68000_NTSC_CLOCK / 10,               /* clock */
405404   0,                                    /* tod_clock */
406405   {
407406      { alg_cia_1_porta_r, alg_cia_1_porta_w, },   /* port A */
r3957r3958
450449   MDRV_SOUND_ROUTE(1, "right", 1.0)
451450
452451   /* cia */
453   MDRV_DEVICE_ADD("cia_0", CIA8520)
454   MDRV_DEVICE_CONFIG(cia_0_intf)
455   MDRV_DEVICE_ADD("cia_1", CIA8520)
456   MDRV_DEVICE_CONFIG(cia_1_intf)
452   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_intf)
453   MDRV_CIA8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK / 10, cia_1_intf)
457454MACHINE_DRIVER_END
458455
459456
src/mame/drivers/vegaeo.c
r3957r3958
1313 *********************************************************************/
1414
1515#include "driver.h"
16#include "cpu/e132xs/e132xs.h"
1617#include "deprecat.h"
1718#include "machine/at28c16.h"
1819#include "eolithsp.h"
r3957r3958
182183   MDRV_VIDEO_UPDATE(vega)
183184
184185   /* sound hardware */
185   MDRV_DEVICE_ADD( "at28c16", AT28C16 )
186   MDRV_AT28C16_ADD( "at28c16", NULL )
186187MACHINE_DRIVER_END
187188
188189/*
src/mame/drivers/bombjack.c
r3957r3958
9696***************************************************************************/
9797
9898#include "driver.h"
99#include "cpu/z80/z80.h"
99100#include "sound/ay8910.h"
100101
101102
src/mame/drivers/rallyx.c
r3957r3958
189189***************************************************************************/
190190
191191#include "driver.h"
192#include "cpu/z80/z80.h"
192193#include "audio/timeplt.h"
193194#include "sound/namco.h"
194195#include "sound/samples.h"
r3957r3958
240241         break;
241242
242243      case 0x01:   /* INT ON */
243         cpu_interrupt_enable(0,bit);
244         cpu_interrupt_enable(space->machine->cpu[0],bit);
244245         if (!bit)
245246            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
246247         break;
r3957r3958
251252         break;
252253
253254      case 0x03:   /* FLIP */
254         flip_screen_set(bit);
255         flip_screen_set(space->machine, bit);
255256         break;
256257
257258      case 0x04:
r3957r3958
284285         break;
285286
286287      case 0x01:   /* INTST */
287         cpu_interrupt_enable(0,bit);
288         cpu_interrupt_enable(space->machine->cpu[0],bit);
288289         break;
289290
290291      case 0x02:   /* MUT */
r3957r3958
292293         break;
293294
294295      case 0x03:   /* FLIP */
295         flip_screen_set(bit);
296         flip_screen_set(space->machine, bit);
296297         break;
297298
298299      case 0x04:   /* OUT1 */
src/mame/drivers/trucocl.c
r3957r3958
3333***************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
3637#include "sound/dac.h"
3738
3839/* from video */
src/mame/drivers/igs_m68.c
r3957r3958
1414*/
1515
1616#include "driver.h"
17#include "cpu/m68000/m68000.h"
1718#include "sound/okim6295.h"
1819
1920static VIDEO_START(igs_m68)
src/mame/drivers/bnstars.c
r3957r3958
8787*/
8888
8989#include "driver.h"
90#include "cpu/z80/z80.h"
91#include "cpu/v60/v60.h"
9092#include "deprecat.h"
9193#include "sound/ymf271.h"
9294#include "rendlay.h"
r3957r3958
13351337//  MDRV_CPU_ADD("audio", Z80, 4000000)
13361338//  MDRV_CPU_PROGRAM_MAP(bnstars_z80_map, 0)
13371339
1338   MDRV_INTERLEAVE(1000)
1340   MDRV_QUANTUM_TIME(HZ(60000))
13391341
13401342   MDRV_MACHINE_RESET(ms32)
13411343
src/mame/drivers/unico.c
r3957r3958
2323***************************************************************************/
2424
2525#include "driver.h"
26#include "cpu/m68000/m68000.h"
2627#include "machine/eeprom.h"
2728#include "unico.h"
2829#include "sound/2151intf.h"
src/mame/drivers/blockhl.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
2324#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
2425#include "video/konamiic.h"
2526#include "sound/2151intf.h"
src/mame/drivers/blackt96.c
r3957r3958
4545*/
4646
4747#include "driver.h"
48#include "cpu/pic16c5x/pic16c5x.h"
49#include "cpu/m68000/m68000.h"
4850#include "sound/okim6295.h"
4951
5052static VIDEO_START( blackt96 )
src/mame/drivers/realbrk.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/m68000/m68000.h"
4445#include "deprecat.h"
4546#include "machine/tmp68301.h"
4647#include "realbrk.h"
src/mame/drivers/diverboy.c
r3957r3958
4747*/
4848
4949#include "driver.h"
50#include "cpu/z80/z80.h"
51#include "cpu/m68000/m68000.h"
5052#include "sound/okim6295.h"
5153
5254extern UINT16 *diverboy_spriteram;
src/mame/drivers/arcadia.c
r3957r3958
4848***************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/m68000/m68000.h"
5152#include "sound/custom.h"
5253#include "includes/amiga.h"
5354#include "machine/6526cia.h"
r3957r3958
174175}
175176
176177
177static void arcadia_reset_coins(void)
178static void arcadia_reset_coins(running_machine *machine)
178179{
179180   /* reset coin counters */
180181   coin_counter[0] = coin_counter[1] = 0;
r3957r3958
283284static const cia6526_interface cia_0_intf =
284285{
285286   amiga_cia_0_irq,                              /* irq_func */
286   AMIGA_68000_NTSC_CLOCK / 10,                     /* clock */
287287   0,                                          /* tod_clock */
288288   {
289289      { arcadia_cia_0_porta_r, arcadia_cia_0_porta_w },   /* port A */
r3957r3958
294294static const cia6526_interface cia_1_intf =
295295{
296296   amiga_cia_1_irq,                              /* irq_func */
297   AMIGA_68000_NTSC_CLOCK / 10,                     /* clock */
298297   0,                                          /* tod_clock */
299298   {
300299      { NULL, NULL },                              /* port A */
r3957r3958
337336   MDRV_SOUND_ROUTE(3, "left", 0.50)
338337
339338   /* cia */
340   MDRV_DEVICE_ADD("cia_0", CIA8520)
341   MDRV_DEVICE_CONFIG(cia_0_intf)
342   MDRV_DEVICE_ADD("cia_1", CIA8520)
343   MDRV_DEVICE_CONFIG(cia_1_intf)
339   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_intf)
340   MDRV_CIA8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK / 10, cia_1_intf)
344341MACHINE_DRIVER_END
345342
346343
src/mame/drivers/segag80v.c
r3957r3958
133133***************************************************************************/
134134
135135#include "driver.h"
136#include "cpu/z80/z80.h"
136137#include "sound/ay8910.h"
137138#include "sound/samples.h"
138139#include "audio/segasnd.h"
r3957r3958
201202{
202203   /* if we have a Universal Sound Board, reset it here */
203204   if (has_usb)
204      sega_usb_reset(0x10);
205      sega_usb_reset(machine, 0x10);
205206}
206207
207208
src/mame/drivers/carjmbre.c
r3957r3958
4141*/
4242
4343#include "driver.h"
44#include "cpu/z80/z80.h"
4445#include "sound/ay8910.h"
4546
4647WRITE8_HANDLER( carjmbre_flipscreen_w );
src/mame/drivers/ace.c
r3957r3958
3838****************************************************************************/
3939
4040#include "driver.h"
41#include "cpu/i8085/i8085.h"
4142
4243#define MASTER_CLOCK XTAL_18MHz
4344
src/mame/drivers/vmetal.c
r3957r3958
7676*/
7777
7878#include "driver.h"
79#include "cpu/m68000/m68000.h"
7980#include "sound/okim6295.h"
8081#include "sound/es8712.h"
8182
src/mame/drivers/gatron.c
r3957r3958
227227#define MASTER_CLOCK   XTAL_16MHz
228228
229229#include "driver.h"
230#include "cpu/z80/z80.h"
230231#include "sound/sn76496.h"
231232#include "machine/8255ppi.h"
232233
src/mame/drivers/superchs.c
r3957r3958
422422   MDRV_CPU_PROGRAM_MAP(superchs_cpub_readmem,superchs_cpub_writemem)
423423   MDRV_CPU_VBLANK_INT("main", irq4_line_hold)/* VBL */
424424
425   MDRV_INTERLEAVE(8)   /* CPU slices - Need to interleave Cpu's 1 & 3 */
425   MDRV_QUANTUM_TIME(HZ(480))   /* CPU slices - Need to interleave Cpu's 1 & 3 */
426426
427427   MDRV_MACHINE_RESET(superchs)
428428   MDRV_NVRAM_HANDLER(superchs)
src/mame/drivers/bottom9.c
r3957r3958
1313***************************************************************************/
1414
1515#include "driver.h"
16#include "cpu/z80/z80.h"
1617#include "deprecat.h"
1718#include "cpu/m6809/m6809.h"
1819#include "video/konamiic.h"
src/mame/drivers/flower.c
r3957r3958
7070*/
7171
7272#include "driver.h"
73#include "cpu/z80/z80.h"
7374#include "deprecat.h"
7475#include "includes/flower.h"
7576
src/mame/drivers/dreamwld.c
r3957r3958
8282*/
8383
8484#include "driver.h"
85#include "cpu/m68000/m68000.h"
8586#include "sound/okim6295.h"
8687
8788#define MASTER_CLOCK 32000000
src/mame/drivers/xain.c
r3957r3958
475475
476476   MDRV_MACHINE_START(xsleena)
477477
478   MDRV_INTERLEAVE(100)
478   MDRV_QUANTUM_TIME(HZ(6000))
479479
480480   /* video hardware */
481481   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gundealr.c
r3957r3958
4747***************************************************************************/
4848
4949#include "driver.h"
50#include "cpu/z80/z80.h"
5051#include "deprecat.h"
5152#include "sound/2203intf.h"
5253
src/mame/drivers/namcos1.c
r3957r3958
990990   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
991991
992992   // heavy sync required to prevent CPUs from fighting for video RAM access and going into deadlocks
993   MDRV_INTERLEAVE(640)
993   MDRV_QUANTUM_TIME(HZ(38400))
994994
995995   MDRV_MACHINE_RESET(namcos1)
996996   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/firefox.c
r3957r3958
658658   MDRV_CPU_ADD("audio", M6502, MASTER_XTAL/8)
659659   MDRV_CPU_PROGRAM_MAP(audio_map, 0)
660660
661   MDRV_INTERLEAVE(1000)
661   MDRV_QUANTUM_TIME(HZ(60000))
662662
663663   MDRV_MACHINE_START(firefox)
664   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ((double)MASTER_XTAL/8/16/16/16/16))
664   MDRV_WATCHDOG_TIME_INIT(HZ((double)MASTER_XTAL/8/16/16/16/16))
665665
666666   /* video hardware */
667667   MDRV_LASERDISC_SCREEN_ADD_NTSC("main", BITMAP_FORMAT_RGB32)
r3957r3958
675675   MDRV_LASERDISC_OVERLAY(firefox, 64*8, 525, BITMAP_FORMAT_RGB32)
676676   MDRV_LASERDISC_OVERLAY_CLIP(7*8, 53*8-1, 44, 480+44)
677677
678   MDRV_DEVICE_ADD("nvram_1c",X2212)
679   MDRV_DEVICE_ADD("nvram_1d",X2212)
678   MDRV_X2212_ADD("nvram_1c")
679   MDRV_X2212_ADD("nvram_1d")
680680   MDRV_RIOT6532_ADD("riot", MASTER_XTAL/8, riot_intf)
681681
682682   /* sound hardware */
src/mame/drivers/mainevt.c
r3957r3958
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/z80/z80.h"
25#include "cpu/hd6309/hd6309.h"
2426#include "deprecat.h"
2527#include "video/konamiic.h"
2628#include "cpu/m6809/m6809.h"
src/mame/drivers/m62.c
r3957r3958
6868**************************************************************************/
6969
7070#include "driver.h"
71#include "cpu/z80/z80.h"
7172#include "m62.h"
7273#include "iremipt.h"
7374#include "audio/irem.h"
src/mame/drivers/astrocde.c
r3957r3958
110110****************************************************************************/
111111
112112#include "driver.h"
113#include "cpu/z80/z80.h"
113114#include "cpu/z80/z80daisy.h"
114115#include "includes/astrocde.h"
115116#include "machine/z80ctc.h"
r3957r3958
503504
504505static z80ctc_interface ctc_intf =
505506{
506   "sub",            /* clock comes from sub CPU */
507   0,                 /* clock (filled in from the CPU 0 clock) */
508507   0,                 /* timer disables */
509508   ctc_interrupt,     /* interrupt handler */
510509   0,               /* ZC/TO0 callback */
r3957r3958
14671466   MDRV_CPU_PROGRAM_MAP(tenpin_sub_map,0)
14681467   MDRV_CPU_IO_MAP(tenpin_sub_io_map,0)
14691468
1470   MDRV_Z80CTC_ADD("ctc", ctc_intf)
1469   MDRV_Z80CTC_ADD("ctc", ASTROCADE_CLOCK/4 /* same as "sub" */, ctc_intf)
14711470
14721471   /* sound hardware */
14731472   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/megazone.c
r3957r3958
320320   MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem)
321321   MDRV_CPU_IO_MAP(i8039_io_map,0)
322322
323   MDRV_INTERLEAVE(15)
323   MDRV_QUANTUM_TIME(HZ(900))
324324
325325   /* video hardware */
326326   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/deco156.c
r3957r3958
6161{
6262   int offs;
6363
64   flip_screen_set_no_update(1);
64   flip_screen_set_no_update(machine, 1);
6565
6666   for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
6767   {
r3957r3958
107107         inc = 1;
108108      }
109109
110      if (flip_screen_x_get())
110      if (flip_screen_x_get(machine))
111111      {
112112         y=240-y;
113113         x=304-x;
src/mame/drivers/pass.c
r3957r3958
100100 */
101101
102102#include "driver.h"
103#include "cpu/z80/z80.h"
104#include "cpu/m68000/m68000.h"
103105#include "sound/2203intf.h"
104106#include "sound/okim6295.h"
105107
src/mame/drivers/toki.c
r3957r3958
3535***************************************************************************/
3636
3737#include "driver.h"
38#include "cpu/m68000/m68000.h"
3839#include "cpu/z80/z80.h"
3940#include "audio/seibu.h"
4041#include "sound/3812intf.h"
src/mame/drivers/dwarfd.c
r3957r3958
539539   crt_access=nSO;
540540}
541541
542
543static const i8085_config dwarfd_i8085_config =
544{
545   NULL,               /* INTE changed callback */
546   NULL,               /* STATUS changed callback */
547   dwarfd_sod_callback,   /* SOD changed callback (8085A only) */
548   NULL               /* SID changed callback (8085A only) */
549};
550
551
542552#define NUM_LINES 25
543553static INTERRUPT_GEN( dwarfd_interrupt )
544554{
545555   if(cpu_getiloops(device) < NUM_LINES)
546556   {
547      i8085_set_sod_callback(device, dwarfd_sod_callback);
548557      cpu_set_input_line(device,I8085_RST65_LINE,HOLD_LINE); // 34 - every 8th line
549558      line=cpu_getiloops(device);
550559      idx=0;
r3957r3958
689698   /* basic machine hardware */
690699   /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */
691700   MDRV_CPU_ADD("main", 8085A, 10595000/3*2)        /* ? MHz */
692
701   MDRV_CPU_CONFIG(dwarfd_i8085_config)
693702   MDRV_CPU_PROGRAM_MAP(mem_map, 0)
694703   MDRV_CPU_IO_MAP(io_map, 0)
695704
r3957r3958
776785   //      src[i] = src[i]&0xe0;
777786   }
778787
779   i8085_set_sod_callback(machine->cpu[0], dwarfd_sod_callback);
780
781788   videobuf=auto_malloc(0x8000);
782789   dwarfd_ram=auto_malloc(0x1000);
783790   memset(videobuf,0,0x8000);
src/mame/drivers/40love.c
r3957r3958
10341034   MDRV_CPU_ADD("mcu",M68705,18432000/6) /* OK */
10351035   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
10361036
1037   MDRV_INTERLEAVE(100)   /* high interleave to ensure proper synchronization of CPUs */
1037   MDRV_QUANTUM_TIME(HZ(6000))   /* high interleave to ensure proper synchronization of CPUs */
10381038   MDRV_MACHINE_RESET(ta7630)   /* init machine */
10391039
10401040   /* video hardware */
src/mame/drivers/renegade.c
r3957r3958
138138   UINT8 *base;
139139} renegade_adpcm;
140140
141static void renegade_adpcm_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
141static STREAM_UPDATE( renegade_adpcm_callback )
142142{
143143   struct renegade_adpcm_state *state = param;
144144   stream_sample_t *dest = outputs[0];
src/mame/drivers/sg1000a.c
r3957r3958
112112******************************************************/
113113
114114#include "driver.h"
115#include "cpu/z80/z80.h"
115116#include "sound/sn76496.h"
116117#include "video/tms9928a.h"
117118#include "machine/8255ppi.h"
src/mame/drivers/galaga.c
r3957r3958
695695***************************************************************************/
696696
697697#include "driver.h"
698#include "cpu/z80/z80.h"
699#include "cpu/mb88xx/mb88xx.h"
698700#include "machine/atari_vg.h"
699701#include "machine/namcoio.h"
700702#include "machine/namco50.h"
r3957r3958
725727
726728static WRITE8_HANDLER( galaga_flip_screen_w )
727729{
728   flip_screen_set(data & 1);
730   flip_screen_set(space->machine, data & 1);
729731}
730732
731733static WRITE8_HANDLER( bosco_flip_screen_w )
732734{
733   flip_screen_set(~data & 1);
735   flip_screen_set(space->machine, ~data & 1);
734736}
735737
736738
r3957r3958
741743   switch (offset)
742744   {
743745      case 0x00:   /* IRQ1 */
744         cpu_interrupt_enable(0,bit);
746         cpu_interrupt_enable(space->machine->cpu[0],bit);
745747         if (!bit)
746748            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
747749         break;
748750
749751      case 0x01:   /* IRQ2 */
750         cpu_interrupt_enable(1,bit);
752         cpu_interrupt_enable(space->machine->cpu[1],bit);
751753         if (!bit)
752754            cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
753755         break;
754756
755757      case 0x02:   /* NMION */
756         cpu_interrupt_enable(2,!bit);
758         cpu_interrupt_enable(space->machine->cpu[2],!bit);
757759         break;
758760
759761      case 0x03:   /* RESET */
r3957r3958
16471649   MDRV_CPU_IO_MAP(namco_54xx_map_io,0)
16481650
16491651   MDRV_WATCHDOG_VBLANK_INIT(8)
1650   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
1652   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
16511653                     /* synchronization of the CPUs */
16521654   MDRV_MACHINE_START(galaga)
16531655   MDRV_MACHINE_RESET(bosco)
r3957r3958
17061708   MDRV_CPU_IO_MAP(namco_54xx_map_io,0)
17071709
17081710   MDRV_WATCHDOG_VBLANK_INIT(8)
1709   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
1711   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
17101712                     /* synchronization of the CPUs */
17111713   MDRV_MACHINE_START(galaga)
17121714   MDRV_MACHINE_RESET(galaga)
r3957r3958
17801782   MDRV_CPU_IO_MAP(namco_54xx_map_io,0)
17811783
17821784   MDRV_WATCHDOG_VBLANK_INIT(8)
1783   MDRV_INTERLEAVE(1000)   /* 1000 CPU slices per frame - an high value to ensure proper */
1785   MDRV_QUANTUM_TIME(HZ(60000))   /* 1000 CPU slices per frame - an high value to ensure proper */
17841786                     /* synchronization of the CPUs */
17851787   MDRV_MACHINE_START(galaga)
17861788   MDRV_MACHINE_RESET(xevious)
r3957r3958
18531855   MDRV_CPU_ADD("sub2", Z80, MASTER_CLOCK/6)   /* 3.072 MHz */
18541856   MDRV_CPU_PROGRAM_MAP(digdug_map,0)
18551857
1856   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - an high value to ensure proper */
1858   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - an high value to ensure proper */
18571859                     /* synchronization of the CPUs */
18581860   MDRV_MACHINE_START(galaga)
18591861   MDRV_MACHINE_RESET(digdug)
src/mame/drivers/panicr.c
r3957r3958
6060*/
6161
6262#include "driver.h"
63#include "cpu/z80/z80.h"
64#include "cpu/nec/nec.h"
6365#include "deprecat.h"
6466#include "audio/t5182.h"
6567
src/mame/drivers/istellar.c
r3957r3958
2020*/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
2324#include "render.h"
2425#include "machine/laserdsc.h"
2526
src/mame/drivers/lasso.c
r3957r3958
2828***************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/m6502/m6502.h"
3132#include "cpu/z80/z80.h"
3233#include "lasso.h"
3334#include "sound/dac.h"
r3957r3958
472473   MDRV_CPU_ADD("audio", M6502, 600000)
473474   MDRV_CPU_PROGRAM_MAP(lasso_audio_map, 0)
474475
475   MDRV_INTERLEAVE(100)
476   MDRV_QUANTUM_TIME(HZ(6000))
476477
477478   /* video hardware */
478479   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/caswin.c
r0r3958
1/*******************************************************************************************
2
3Casino Winner (c) 1985 Aristocrat
4
5driver by Chris Hardy & Angelo Salese
6
7TODO:
8-missing prom;
9-NVRAM emulation? Likely to be just backup ram
10-Cherry-type subgames appears to have wrong graphics alignment,maybe it's some fancy window
11 effect?
12
13*******************************************************************************************/
14
15#include "driver.h"
16#include "cpu/z80/z80.h"
17#include "sound/ay8910.h"
18
19static UINT8 *sc0_vram,*sc0_attr;
20static tilemap *sc0_tilemap;
21
22static TILE_GET_INFO( get_sc0_tile_info )
23{
24   int tile = (sc0_vram[tile_index] | ((sc0_attr[tile_index] & 0x70)<<4)) & 0x7ff;
25   int colour = sc0_attr[tile_index] & 0xf;
26
27   SET_TILE_INFO(
28         0,
29         tile,
30         colour,
31         0);
32}
33
34VIDEO_START(vvillage)
35{
36   sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,32,32);
37}
38
39VIDEO_UPDATE(vvillage)
40{
41   tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0);
42   return 0;
43}
44
45static WRITE8_HANDLER( sc0_vram_w )
46{
47   sc0_vram[offset] = data;
48   tilemap_mark_tile_dirty(sc0_tilemap,offset);
49}
50
51static WRITE8_HANDLER( sc0_attr_w )
52{
53   sc0_attr[offset] = data;
54   tilemap_mark_tile_dirty(sc0_tilemap,offset);
55}
56
57/*These two are tested during the two cherry sub-games.I really don't know what is supposed to do...*/
58static WRITE8_HANDLER( scroll_w )
59{
60}
61
62/*---- --x- enable some weird effect*/
63static WRITE8_HANDLER( vregs_w )
64{
65}
66
67/**********************
68*
69* End of Video Hardware
70*
71**********************/
72
73static READ8_HANDLER( input_buttons_r )
74{
75   return input_port_read(space->machine,"DSW1");
76}
77
78static READ8_HANDLER( input_coins_r )
79{
80   return input_port_read(space->machine,"DSW2");
81}
82
83static READ8_HANDLER( vvillage_rng_r )
84{
85   return mame_rand(space->machine);
86}
87
88static WRITE8_HANDLER( output_w )
89{
90   coin_counter_w(0,data & 1);
91   coin_counter_w(1,data & 1);
92   coin_lockout_w(0,data & 0x20);
93   coin_lockout_w(1,data & 0x20);
94}
95
96static WRITE8_HANDLER( lamps_w )
97{
98   /*
99    ---x ---- lamp button 5
100    ---- x--- lamp button 4
101    ---- -x-- lamp button 3
102    ---- --x- lamp button 2
103    ---- ---x lamp button 1
104    */
105}
106
107static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
108   AM_RANGE(0x0000, 0x7fff) AM_ROM
109   AM_RANGE(0xa000, 0xa000) AM_READ(vvillage_rng_r)
110   AM_RANGE(0xe000, 0xefff) AM_RAM
111   AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(&sc0_vram)
112   AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(sc0_attr_w) AM_BASE(&sc0_attr)
113ADDRESS_MAP_END
114
115static ADDRESS_MAP_START( portmap, ADDRESS_SPACE_IO, 8 )
116   ADDRESS_MAP_GLOBAL_MASK(0xff)
117   AM_RANGE(0x01,0x01) AM_READ(ay8910_read_port_0_r)
118   AM_RANGE(0x02,0x02) AM_WRITE(ay8910_write_port_0_w)
119   AM_RANGE(0x03,0x03) AM_WRITE(ay8910_control_port_0_w)
120   AM_RANGE(0x10,0x10) AM_READ_PORT("IN0")
121   AM_RANGE(0x11,0x11) AM_READ_PORT("IN1")
122   AM_RANGE(0x10,0x10) AM_WRITE(scroll_w)
123   AM_RANGE(0x11,0x11) AM_WRITE(vregs_w)
124   AM_RANGE(0x12,0x12) AM_WRITE(lamps_w)
125   AM_RANGE(0x13,0x13) AM_WRITE(output_w)
126ADDRESS_MAP_END
127
128
129static INPUT_PORTS_START( vvillage )
130   PORT_START("IN0")
131   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
132   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
133   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
134   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
135   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
136   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
137
138   PORT_START("IN1")
139   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
140   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
141   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Payout") PORT_CODE(KEYCODE_7)
142   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
143
144   PORT_START("DSW1")
145   PORT_DIPNAME( 0x01, 0x00, "Poker" )
146   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
147   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
148   PORT_DIPNAME( 0x02, 0x00, "Black Jack" )
149   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
150   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
151   PORT_DIPNAME( 0x04, 0x00, "Hi & Low" )
152   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
153   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
154   PORT_DIPNAME( 0x08, 0x00, "Five Line" )
155   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
156   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
157   PORT_DIPNAME( 0x10, 0x00, "Super Conti" )
158   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
159   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
160   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
161   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
162   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
163   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
164   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
165   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
166   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
167   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
168   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
169   PORT_START("DSW2")
170   PORT_DIPNAME( 0x01, 0x00, "Auto Hopper" )
171   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
172   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
173   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
174   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
175   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
176   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
177   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
178   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
179   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
180   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
181   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
182   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
183   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
184   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
185   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
186   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
187   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
188   PORT_DIPNAME( 0x40, 0x40, "Show Dip-Switches Status" )
189   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
190   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
191   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Service_Mode ) ) //analyzer
192   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
193   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194INPUT_PORTS_END
195
196
197static const gfx_layout tiles8x8_layout =
198{
199   8,8,
200   RGN_FRAC(1,2),
201   2,
202   { 0,RGN_FRAC(1,2) },
203   { 7, 6, 5, 4, 3, 2, 1, 0 },
204   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
205   8*8
206};
207
208static GFXDECODE_START( vvillage )
209   GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 )
210GFXDECODE_END
211
212static const ay8910_interface ay8910_config =
213{
214   AY8910_LEGACY_OUTPUT,
215   AY8910_DEFAULT_LOADS,
216   input_buttons_r,
217   input_coins_r,
218   NULL,
219   NULL
220};
221
222static MACHINE_DRIVER_START( vvillage )
223   /* basic machine hardware */
224   MDRV_CPU_ADD("main", Z80,4000000)       /* ? MHz */
225   MDRV_CPU_PROGRAM_MAP(readmem,0)
226   MDRV_CPU_IO_MAP(portmap,0)
227   MDRV_CPU_VBLANK_INT("main", irq0_line_hold )
228
229   /* video hardware */
230   MDRV_SCREEN_ADD("main", RASTER)
231   MDRV_SCREEN_REFRESH_RATE(60)
232   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
233   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
234   MDRV_SCREEN_SIZE(256, 256)
235   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
236
237   MDRV_GFXDECODE(vvillage)
238   MDRV_PALETTE_LENGTH(0x100)
239
240   MDRV_VIDEO_START(vvillage)
241   MDRV_VIDEO_UPDATE(vvillage)
242
243   MDRV_SPEAKER_STANDARD_MONO("mono")
244
245   MDRV_SOUND_ADD("ay", AY8910, 4000000 / 4)
246   MDRV_SOUND_CONFIG(ay8910_config)
247   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
248MACHINE_DRIVER_END
249
250ROM_START( caswin )
251   ROM_REGION( 0x8000, "main", 0 )
252   ROM_LOAD( "cw_v5_0_1.26", 0x0000, 0x4000, CRC(ae3d2cf0) SHA1(268572730389f12cf962782008690305fad1ac1b) )
253   ROM_LOAD( "cw_v5_0_2.24", 0x4000, 0x4000, CRC(2855b3b8) SHA1(f5cc0bbeee6c1fb0dc6aebc2e3af09dccdb248ad) )
254
255   ROM_REGION( 0x8000, "gfx1", 0 )
256   ROM_LOAD( "cw_4.19", 0x00000, 0x4000, CRC(d2deab75) SHA1(12cf3fd02dbad9a40cfa6cece0cb66ce2c4dc315) )
257   ROM_LOAD( "cw_3.22", 0x04000, 0x4000, CRC(7e79966c) SHA1(39190ee8cd7f3b8f895b32327f3a5555a0713315) )
258
259   ROM_REGION( 0x20, "proms", 0 )
260   ROM_LOAD( "prom.x", 0x00, 0x20, NO_DUMP )
261ROM_END
262
263
264GAME( 1985, caswin, 0, vvillage, vvillage, 0, ROT270, "Aristocrat",  "Casino Winner", GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/nbmj8688.c
r3957r3958
2828******************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/z80/z80.h"
3132#include "nb1413m3.h"
3233#include "sound/dac.h"
3334#include "sound/ay8910.h"
src/mame/drivers/sbowling.c
r3957r3958
3838***********************************************************/
3939
4040#include "driver.h"
41#include "cpu/i8085/i8085.h"
4142#include "deprecat.h"
4243#include "cpu/mcs48/mcs48.h"
4344#include "video/resnet.h"
r3957r3958
6061   SET_TILE_INFO(0, tileno, 0, 0);
6162}
6263
63static void plot_pixel_sbw(int x, int y, int col)
64static void plot_pixel_sbw(int x, int y, int col, int flip)
6465{
65   if (flip_screen_get())
66   if (flip)
6667   {
6768      y = 255-y;
6869      x = 247-x;
r3957r3958
7273
7374static WRITE8_HANDLER( sbw_videoram_w )
7475{
76   int flip = flip_screen_get(space->machine);
7577   int x,y,i,v1,v2;
7678
7779   videoram[offset] = data;
r3957r3958
8688
8789   for(i = 0; i < 8; i++)
8890   {
89      plot_pixel_sbw(x++, y, color_prom_address | ( ((v1&1)*0x20) | ((v2&1)*0x40) ) );
91      plot_pixel_sbw(x++, y, color_prom_address | ( ((v1&1)*0x20) | ((v2&1)*0x40) ), flip);
9092      v1 >>= 1;
9193      v2 >>= 1;
9294   }
r3957r3958
147149        -----x-- 1 ?
148150        ----x--- flip screen/controls
149151    */
150   flip_screen_set(data&1);
152   flip_screen_set(space->machine, data&1);
151153
152154   if((sbw_system^data)&1)
153155   {
src/mame/drivers/psychic5.c
r3957r3958
310310*/
311311
312312#include "driver.h"
313#include "cpu/z80/z80.h"
313314#include "deprecat.h"
314315#include "sound/2203intf.h"
315316
r3957r3958
340341static MACHINE_RESET( psychic5 )
341342{
342343   psychic5_bank_latch = 0xff;
343   flip_screen_set(0);
344   flip_screen_set(machine, 0);
344345}
345346
346347/***************************************************************************
r3957r3958
403404   // bit 7 toggles flip screen
404405   if (data & 0x80)
405406   {
406      flip_screen_set(!flip_screen_get());
407      flip_screen_set(space->machine, !flip_screen_get(space->machine));
407408   }
408409}
409410
r3957r3958
412413   // bit 7 toggles flip screen
413414   if (data & 0x80)
414415   {
415      flip_screen_set(!flip_screen_get());
416      flip_screen_set(space->machine, !flip_screen_get(space->machine));
416417   }
417418}
418419
r3957r3958
691692   MDRV_CPU_PROGRAM_MAP(psychic5_sound_map,0)
692693   MDRV_CPU_IO_MAP(psychic5_soundport_map,0)
693694
694   MDRV_INTERLEAVE(10)      /* Allow time for 2nd cpu to interleave */
695   MDRV_QUANTUM_TIME(HZ(600))      /* Allow time for 2nd cpu to interleave */
695696   MDRV_MACHINE_RESET(psychic5)
696697
697698   /* video hardware */
r3957r3958
738739   MDRV_CPU_PROGRAM_MAP(bombsa_sound_map,0)
739740   MDRV_CPU_IO_MAP(bombsa_soundport_map,0)
740741
741   MDRV_INTERLEAVE(10)
742   MDRV_QUANTUM_TIME(HZ(600))
742743   MDRV_MACHINE_RESET(psychic5)
743744
744745   /* video hardware */
src/mame/drivers/taito_h.c
r3957r3958
128128
129129
130130#include "driver.h"
131#include "cpu/z80/z80.h"
132#include "cpu/m68000/m68000.h"
131133#include "taitoipt.h"
132134#include "audio/taitosnd.h"
133135#include "video/taitoic.h"
r3957r3958
589591   MDRV_MACHINE_START(taitoh)
590592   MDRV_MACHINE_RESET(taitoh)
591593
592   MDRV_INTERLEAVE(10)
594   MDRV_QUANTUM_TIME(HZ(600))
593595
594596   /* video hardware */
595597   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
629631   MDRV_MACHINE_START(taitoh)
630632   MDRV_MACHINE_RESET(taitoh)
631633
632   MDRV_INTERLEAVE(10)
634   MDRV_QUANTUM_TIME(HZ(600))
633635
634636   /* video hardware */
635637   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
669671   MDRV_MACHINE_START(taitoh)
670672   MDRV_MACHINE_RESET(taitoh)
671673
672   MDRV_INTERLEAVE(10)
674   MDRV_QUANTUM_TIME(HZ(600))
673675
674676   /* video hardware */
675677   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/good.c
r3957r3958
3131*/
3232
3333#include "driver.h"
34#include "cpu/m68000/m68000.h"
3435#include "sound/okim6295.h"
3536
3637static tilemap *bg_tilemap;
src/mame/drivers/8080bw.c
r3957r3958
8787/****************************************************************************/
8888
8989#include "driver.h"
90#include "cpu/m6800/m6800.h"
91#include "cpu/i8085/i8085.h"
9092#include "deprecat.h"
9193#include "8080bw.h"
9294#include "mw8080bw.h"
src/mame/drivers/othunder.c
r3957r3958
231231***************************************************************************/
232232
233233#include "driver.h"
234#include "cpu/z80/z80.h"
234235#include "taitoipt.h"
235236#include "cpu/m68000/m68000.h"
236237#include "machine/eeprom.h"
src/mame/drivers/ginganin.c
r3957r3958
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "cpu/m6809/m6809.h"
53#include "cpu/m68000/m68000.h"
5254#include "deprecat.h"
5355#include "sound/ay8910.h"
5456#include "sound/3812intf.h"
src/mame/drivers/tail2nos.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/m68000/m68000.h"
1314#include "video/konamiic.h"
1415#include "cpu/z80/z80.h"
1516#include "sound/2608intf.h"
src/mame/drivers/m79amb.c
r3957r3958
5151*/
5252
5353#include "driver.h"
54#include "cpu/i8085/i8085.h"
5455
5556static UINT8 *ramtek_videoram;
5657static UINT8 *mask;
src/mame/drivers/mrjong.c
r3957r3958
4343***************************************************************************/
4444
4545#include "driver.h"
46#include "cpu/z80/z80.h"
4647#include "sound/sn76496.h"
4748
4849
src/mame/drivers/quasar.c
r3957r3958
335335
336336   MDRV_MACHINE_START( cvs )
337337
338   MDRV_INTERLEAVE(100)
338   MDRV_QUANTUM_TIME(HZ(6000))
339339
340340   /* video hardware */
341341   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/meritm.c
r3957r3958
231231   microtouch_rx(count, data);
232232};
233233
234static void meritm_microtouch_tx_callback(UINT8 data)
234static void meritm_microtouch_tx_callback(running_machine *machine, UINT8 data)
235235{
236   pc16552d_rx_data(Machine, 0, 0, data);
236   pc16552d_rx_data(machine, 0, 0, data);
237237};
238238
239239/*************************************
r3957r3958
241241 *  Microtouch touch coordinate transformation
242242 *
243243 *************************************/
244static int meritm_touch_coord_transform(int *touch_x, int *touch_y)
244static int meritm_touch_coord_transform(running_machine *machine, int *touch_x, int *touch_y)
245245{
246246   int xscr = (int)((double)(*touch_x)/0x4000*544);
247247   int yscr = (int)((double)(*touch_y)/0x4000*480);
r3957r3958
281281{
282282   v9938_set_sprite_limit(0, 0);
283283   v9938_set_resolution(0, RENDER_HIGH);
284   v9938_interrupt(0);
284   v9938_interrupt(device->machine, 0);
285285
286286   v9938_set_sprite_limit(1, 0);
287287   v9938_set_resolution(1, RENDER_HIGH);
288   v9938_interrupt(1);
288   v9938_interrupt(device->machine, 1);
289289}
290290
291291static void meritm_vdp0_interrupt(running_machine *machine, int i)
r3957r3958
376376static int meritm_bank;
377377static int meritm_psd_a15;
378378
379static void meritm_crt250_switch_banks( void )
379static void meritm_crt250_switch_banks( running_machine *machine )
380380{
381381   int rombank = (meritm_bank & 0x07) ^ 0x07;
382382
383383   //logerror( "CRT250: Switching banks: rom = %0x (bank = %x)\n", rombank, meritm_bank );
384   memory_set_bank(Machine, 1, rombank );
384   memory_set_bank(machine, 1, rombank );
385385};
386386
387387static WRITE8_HANDLER(meritm_crt250_bank_w)
388388{
389   meritm_crt250_switch_banks();
389   meritm_crt250_switch_banks(space->machine);
390390};
391391
392static void meritm_switch_banks( void )
392static void meritm_switch_banks( running_machine *machine )
393393{
394394   int rambank = (meritm_psd_a15 >> 2) & 0x3;
395395   int rombank = (((meritm_bank >> 3) & 0x3) << 5) |
r3957r3958
398398           (meritm_psd_a15 & 0x1);
399399
400400   //logerror( "Switching banks: rom = %0x (bank = %x), ram = %0x\n", rombank, meritm_bank, rambank);
401   memory_set_bank(Machine, 1, rombank );
402   memory_set_bank(Machine, 2, rombank | 0x01);
403   memory_set_bank(Machine, 3, rambank);
401   memory_set_bank(machine, 1, rombank );
402   memory_set_bank(machine, 2, rombank | 0x01);
403   memory_set_bank(machine, 3, rambank);
404404};
405405
406406static WRITE8_HANDLER(meritm_psd_a15_w)
407407{
408408   meritm_psd_a15 = data;
409409   //logerror( "Writing PSD_A15 with %02x at PC=%04X\n", data, cpu_get_pc(space->cpu) );
410   meritm_switch_banks();
410   meritm_switch_banks(space->machine);
411411};
412412
413413static WRITE8_HANDLER(meritm_bank_w)
414414{
415   meritm_switch_banks();
415   meritm_switch_banks(space->machine);
416416};
417417
418418/*************************************
r3957r3958
823823   0
824824};
825825
826#ifdef UNUSED_FUNCTION
827static void meritm_pio1_portb_input_changed_callback(void *param, UINT32 oldval, UINT32 newval)
828{
829    z80pio_p_w(Machine, 1, 1, (UINT8)newval);
830}
831#endif
832
833826static const z80_daisy_chain meritm_daisy_chain[] =
834827{
835828   { Z80PIO, "z80pio_1" },
r3957r3958
841834{
842835   meritm_z80pio[0] = devtag_get_device( machine, Z80PIO, "z80pio_0" );
843836   meritm_z80pio[1] = devtag_get_device( machine, Z80PIO, "z80pio_1" );
844   //input_port_set_changed_callback(port_tag_to_index("PIO1_PORTB"), 0xff, meritm_pio1_portb_input_changed_callback, NULL);
845837
846838};
847839
r3957r3958
849841{
850842   memory_configure_bank(machine, 1, 0, 8, memory_region(machine, "main"), 0x10000);
851843   meritm_bank = 0xff;
852   meritm_crt250_switch_banks();
844   meritm_crt250_switch_banks(machine);
853845   MACHINE_START_CALL(merit_common);
854846   state_save_register_global(machine, meritm_bank);
855847
r3957r3958
870862   memory_configure_bank(machine, 3, 0, 4, meritm_ram, 0x2000);
871863   meritm_bank = 0xff;
872864   meritm_psd_a15 = 0;
873   meritm_switch_banks();
865   meritm_switch_banks(machine);
874866   MACHINE_START_CALL(merit_common);
875867   pc16552d_init(machine, 0, UART_CLK, NULL, pc16650d_tx_callback);
876868   microtouch_init(machine, meritm_microtouch_tx_callback, meritm_touch_coord_transform);
r3957r3958
953945
954946   MDRV_PPI8255_RECONFIG( "ppi8255", crt260_ppi8255_intf )
955947
956   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_MSEC(1200))   // DS1232, TD connected to VCC
948   MDRV_WATCHDOG_TIME_INIT(MSEC(1200))   // DS1232, TD connected to VCC
957949   MDRV_MACHINE_START(meritm_crt260)
958950
959951   MDRV_NVRAM_HANDLER(meritm_crt260)
src/mame/drivers/slapshot.c
r3957r3958
132132***************************************************************************/
133133
134134#include "driver.h"
135#include "cpu/z80/z80.h"
135136#include "cpu/m68000/m68000.h"
136137#include "video/taitoic.h"
137138#include "audio/taitosnd.h"
r3957r3958
535536   MDRV_CPU_ADD("audio", Z80,32000000/8)   /* 4 MHz */
536537   MDRV_CPU_PROGRAM_MAP(z80_sound_readmem,z80_sound_writemem)
537538
538   MDRV_INTERLEAVE(10)
539   MDRV_QUANTUM_TIME(HZ(600))
539540
540541   MDRV_MACHINE_START(slapshot)
541542
r3957r3958
564565   MDRV_SOUND_ROUTE(1, "left",  1.0)
565566   MDRV_SOUND_ROUTE(2, "right", 1.0)
566567
567   MDRV_DEVICE_ADD( "mk48t08", MK48T08 )
568   MDRV_MK48T08_ADD( "mk48t08" )
568569MACHINE_DRIVER_END
569570
570571static MACHINE_DRIVER_START( opwolf3 )
r3957r3958
577578   MDRV_CPU_ADD("audio", Z80,32000000/8)   /* 4 MHz */
578579   MDRV_CPU_PROGRAM_MAP(z80_sound_readmem,z80_sound_writemem)
579580
580   MDRV_INTERLEAVE(10)
581   MDRV_QUANTUM_TIME(HZ(600))
581582
582583   /* video hardware */
583584   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
604605   MDRV_SOUND_ROUTE(1, "left",  1.0)
605606   MDRV_SOUND_ROUTE(2, "right", 1.0)
606607
607   MDRV_DEVICE_ADD( "mk48t08", MK48T08 )
608   MDRV_MK48T08_ADD( "mk48t08" )
608609MACHINE_DRIVER_END
609610
610611/***************************************************************************
src/mame/drivers/vsnes.c
r3957r3958
130130***************************************************************************/
131131
132132#include "driver.h"
133#include "cpu/m6502/m6502.h"
133134#include "rendlay.h"
134135#include "video/ppu2c0x.h"
135136#include "machine/rp5h01.h"
r3957r3958
137138#include "sound/nes_apu.h"
138139#include "includes/vsnes.h"
139140
140/* clock frequency */
141#define N2A03_DEFAULTCLOCK ( 21477272.724 / 12 )
142
143141#define DUAL_RBI 1
144142
145143/******************************************************************************/
src/mame/drivers/victory.c
r3957r3958
9595***************************************************************************/
9696
9797#include "driver.h"
98#include "cpu/z80/z80.h"
9899#include "exidy.h"
99100#include "victory.h"
100101
src/mame/drivers/lucky74.c
r3957r3958
667667
668668
669669#include "driver.h"
670#include "cpu/z80/z80.h"
670671#include "sound/ay8910.h"
671672#include "sound/sn76496.h"
672673#include "sound/msm5205.h"
r3957r3958
724725    bit 0 contains the screen orientation.
725726*/
726727   ym2149_portb = data;
727   flip_screen_set(data & 0x01);
728   flip_screen_set(space->machine, data & 0x01);
728729}
729730
730731static READ8_HANDLER( usart_8251_r )
src/mame/drivers/cninja.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/z80/z80.h"
45#include "cpu/m68000/m68000.h"
4446#include "cninja.h"
4547#include "cpu/h6280/h6280.h"
4648#include "deco16ic.h"
src/mame/drivers/pacland.c
r3957r3958
173173***************************************************************************/
174174
175175#include "driver.h"
176#include "cpu/m6809/m6809.h"
176177#include "cpu/m6800/m6800.h"
177178#include "sound/namco.h"
178179
r3957r3958
199200static WRITE8_HANDLER( pacland_flipscreen_w )
200201{
201202   int bit = !BIT(offset,11);
202   /* can't use flip_screen_set() because the visible area is asymmetrical */
203   flip_screen_set_no_update(bit);
204   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get() ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
203   /* can't use flip_screen_set(space->machine, ) because the visible area is asymmetrical */
204   flip_screen_set_no_update(space->machine, bit);
205   tilemap_set_flip(ALL_TILEMAPS,flip_screen_get(space->machine) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
205206}
206207
207208
r3957r3958
232233static WRITE8_HANDLER( pacland_irq_1_ctrl_w )
233234{
234235   int bit = !BIT(offset,11);
235   cpu_interrupt_enable(0,bit);
236   cpu_interrupt_enable(space->machine->cpu[0],bit);
236237   if (!bit)
237238      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
238239}
r3957r3958
240241static WRITE8_HANDLER( pacland_irq_2_ctrl_w )
241242{
242243   int bit = !BIT(offset,13);
243   cpu_interrupt_enable(1,bit);
244   cpu_interrupt_enable(space->machine->cpu[1],bit);
244245   if (!bit)
245246      cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
246247}
r3957r3958
422423   MDRV_CPU_IO_MAP(mcu_port_map,0)
423424   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
424425
425   MDRV_INTERLEAVE(100)   /* we need heavy synching between the MCU and the CPU */
426   MDRV_QUANTUM_TIME(HZ(6000))   /* we need heavy synching between the MCU and the CPU */
426427
427428   /* video hardware */
428429   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/wardner.c
r3957r3958
124124
125125
126126#include "driver.h"
127#include "cpu/z80/z80.h"
127128#include "cpu/tms32010/tms32010.h"
128129#include "twincobr.h"
129130#include "sound/3812intf.h"
r3957r3958
451452   /* Data Map is internal to the CPU */
452453   MDRV_CPU_IO_MAP(DSP_io_map, 0)
453454
454   MDRV_INTERLEAVE(100)               /* 100 CPU slices per frame */
455   MDRV_QUANTUM_TIME(HZ(6000))               /* 100 CPU slices per frame */
455456
456457   MDRV_MACHINE_RESET(wardner)
457458
src/mame/drivers/nss.c
r3957r3958
293293
294294***************************************************************************/
295295#include "driver.h"
296#include "cpu/spc700/spc700.h"
297#include "cpu/g65816/g65816.h"
296298#include "includes/snes.h"
297299
298300static ADDRESS_MAP_START( snes_map, ADDRESS_SPACE_PROGRAM, 8)
r3957r3958
418420   MDRV_CPU_ADD("audio", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
419421   MDRV_CPU_PROGRAM_MAP(spc_mem, 0)
420422
421   MDRV_INTERLEAVE(400)
423   MDRV_QUANTUM_TIME(HZ(24000))
422424
423425   MDRV_MACHINE_START( snes )
424426   MDRV_MACHINE_RESET( snes )
src/mame/drivers/mirage.c
r3957r3958
3434*/
3535
3636#include "driver.h"
37#include "cpu/m68000/m68000.h"
3738#include "decocrpt.h"
3839#include "decoprot.h"
3940#include "deco16ic.h"
r3957r3958
8182         inc = 1;
8283      }
8384
84      if (flip_screen_get())
85      if (flip_screen_get(machine))
8586      {
8687         y=240-y;
8788         x=304-x;
r3957r3958
120121
121122static VIDEO_UPDATE(mirage)
122123{
123   flip_screen_set( deco16_pf12_control[0]&0x80 );
124   flip_screen_set(screen->machine, deco16_pf12_control[0]&0x80 );
124125   deco16_pf12_update(deco16_pf1_rowscroll,deco16_pf2_rowscroll);
125126
126127   bitmap_fill(bitmap,cliprect,256); /* not verified */
src/mame/drivers/ddrible.c
r3957r3958
350350   MDRV_CPU_ADD("cpu2", M6809,   XTAL_18_432MHz/12)   /* verified on pcb */
351351   MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
352352
353   MDRV_INTERLEAVE(100)   /* we need heavy synch */
353   MDRV_QUANTUM_TIME(HZ(6000))   /* we need heavy synch */
354354
355355   /* video hardware */
356356   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/missile.c
r3957r3958
328328*****************************************************************************************/
329329
330330#include "driver.h"
331#include "cpu/m6502/m6502.h"
331332#include "sound/pokey.h"
332333
333334
src/mame/drivers/popper.c
r3957r3958
7979*/
8080
8181#include "driver.h"
82#include "cpu/z80/z80.h"
8283#include "deprecat.h"
8384#include "sound/ay8910.h"
8485
r3957r3958
318319   MDRV_CPU_PROGRAM_MAP(popper_sound_readmem,popper_sound_writemem)
319320   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)      //NMIs caused by the main CPU
320321
321   MDRV_INTERLEAVE(30)
322   MDRV_QUANTUM_TIME(HZ(1800))
322323
323324   /* video hardware */
324325   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/ladyfrog.c
r3957r3958
4747#define ladyfrog_scr_size 0
4848
4949#include "driver.h"
50#include "cpu/z80/z80.h"
5051#include "deprecat.h"
5152#include "sound/ay8910.h"
5253#include "sound/msm5232.h"
r3957r3958
289290   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,2)
290291
291292   /* video hardware */
292   MDRV_INTERLEAVE(100)
293   MDRV_QUANTUM_TIME(HZ(6000))
293294
294295
295296   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/go2000.c
r3957r3958
2222*/
2323
2424#include "driver.h"
25#include "cpu/m68000/m68000.h"
2526
2627static UINT16* go2000_video;
2728static UINT16* go2000_video2;
src/mame/drivers/djboy.c
r3957r3958
841841   MDRV_CPU_IO_MAP(cpu2_port_am,0)
842842   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
843843
844   MDRV_INTERLEAVE(100)
844   MDRV_QUANTUM_TIME(HZ(6000))
845845
846846   MDRV_SCREEN_ADD("main", RASTER)
847847   MDRV_SCREEN_REFRESH_RATE(60)
src/mame/drivers/sidearms.c
r3957r3958
3636***************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/z80/z80.h"
3940#include "sound/2203intf.h"
4041#include "sound/2151intf.h"
4142
r3957r3958
812813   MDRV_CPU_IO_MAP(whizz_io_map,0)
813814   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
814815
815   MDRV_INTERLEAVE(1000)
816   MDRV_QUANTUM_TIME(HZ(60000))
816817
817818   /* video hardware */
818819   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/taito_x.c
r3957r3958
311311***************************************************************************/
312312
313313#include "driver.h"
314#include "cpu/z80/z80.h"
315#include "cpu/m68000/m68000.h"
314316#include "taitoipt.h"
315317#include "audio/taitosnd.h"
316318#include "seta.h"
r3957r3958
10031005   MDRV_CPU_ADD("audio", Z80, XTAL_16MHz/4)   /* verified on pcb */
10041006   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
10051007
1006   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1008   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
10071009
10081010   MDRV_MACHINE_START(taitox)
10091011   MDRV_MACHINE_RESET(cchip1)
r3957r3958
10431045   MDRV_CPU_ADD("audio", Z80, XTAL_16MHz/4)   /* verified on pcb */
10441046   MDRV_CPU_PROGRAM_MAP(daisenpu_sound_readmem,daisenpu_sound_writemem)
10451047
1046   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1048   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
10471049
10481050   MDRV_MACHINE_START(taitox)
10491051
r3957r3958
10801082   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz ??? */
10811083   MDRV_CPU_PROGRAM_MAP(ballbros_sound_readmem,ballbros_sound_writemem)
10821084
1083   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1085   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
10841086
10851087   MDRV_MACHINE_START(taitox)
10861088
r3957r3958
11191121   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz ??? */
11201122   MDRV_CPU_PROGRAM_MAP(ballbros_sound_readmem,ballbros_sound_writemem)
11211123
1122   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1124   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
11231125
11241126   MDRV_MACHINE_START(taitox)
11251127
src/mame/drivers/jack.c
r3957r3958
8383
8484static WRITE8_HANDLER( joinem_misc_w )
8585{
86   flip_screen_set(data & 0x80);
86   flip_screen_set(space->machine, data & 0x80);
8787   joinem_snd_bit = data & 1;
8888}
8989
src/mame/drivers/tumblep.c
r3957r3958
4040***************************************************************************/
4141
4242#include "driver.h"
43#include "cpu/m68000/m68000.h"
4344#include "cpu/h6280/h6280.h"
4445#include "decocrpt.h"
4546#include "sound/2151intf.h"
src/mame/drivers/dogfgt.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/m6502/m6502.h"
1112#include "deprecat.h"
1213#include "dogfgt.h"
1314#include "sound/ay8910.h"
r3957r3958
248249   MDRV_CPU_ADD("sub", M6502, 1500000)   /* 1.5 MHz ???? */
249250   MDRV_CPU_PROGRAM_MAP(sub_readmem,sub_writemem)
250251
251   MDRV_INTERLEAVE(100)
252   MDRV_QUANTUM_TIME(HZ(6000))
252253
253254   /* video hardware */
254255   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dietgo.c
r3957r3958
55*/
66
77#include "driver.h"
8#include "cpu/m68000/m68000.h"
89#include "cpu/h6280/h6280.h"
910#include "sound/2151intf.h"
1011#include "sound/okim6295.h"
src/mame/drivers/taitosj.c
r3957r3958
18841884   MDRV_CPU_ADD("mcu", M68705,3000000)      /* xtal is 3MHz, divided by 4 internally */
18851885   MDRV_CPU_PROGRAM_MAP(taitosj_mcu_map,0)
18861886
1887   MDRV_INTERLEAVE(100)
1887   MDRV_QUANTUM_TIME(HZ(6000))
18881888MACHINE_DRIVER_END
18891889
18901890
src/mame/drivers/vigilant.c
r3957r3958
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/z80/z80.h"
1819#include "deprecat.h"
1920#include "audio/m72.h"
2021#include "sound/dac.h"
src/mame/drivers/kingobox.c
r3957r3958
1616***************************************************************************/
1717
1818#include "driver.h"
19#include "cpu/z80/z80.h"
1920#include "sound/ay8910.h"
2021#include "sound/dac.h"
2122
r3957r3958
559560   MDRV_CPU_IO_MAP(sound_io_map,0)
560561   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 6000)   /* Hz */
561562
562   MDRV_INTERLEAVE(100) /* We really need heavy synching among the processors */
563   MDRV_QUANTUM_TIME(HZ(6000)) /* We really need heavy synching among the processors */
563564
564565   /* video hardware */
565566   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
609610   MDRV_CPU_IO_MAP(rk_sound_io_map,0)
610611   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 6000)   /* Hz */
611612
612   MDRV_INTERLEAVE(100) /* We really need heavy synching among the processors */
613   MDRV_QUANTUM_TIME(HZ(6000)) /* We really need heavy synching among the processors */
613614
614615   /* video hardware */
615616   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/galivan.c
r3957r3958
2828***************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/z80/z80.h"
3132#include "sound/dac.h"
3233#include "sound/3812intf.h"
3334
r3957r3958
5354   UINT8 *RAM = memory_region(machine, "main");
5455
5556   memory_set_bankptr(machine, 1,&RAM[0x10000]);
56   cpu_reset(machine->cpu[0]);
57   device_reset(machine->cpu[0]);
5758//  layers = 0x60;
5859}
5960
src/mame/drivers/nbmj8991.c
r3957r3958
2929******************************************************************************/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
3233#include "deprecat.h"
3334#include "nb1413m3.h"
3435#include "sound/ay8910.h"
r3957r3958
6869
6970static MACHINE_RESET( nbmj8991 )
7071{
71   if (machine->config->cpu[1].type == CPU_Z80)
72   if (cpu_get_type(machine->cpu[1]) == CPU_Z80)
7273   {
7374      memory_configure_bank(machine, 1, 0, 4, memory_region(machine, "audio") + 0x8000, 0x8000);
7475      memory_set_bank(machine, 1, 0);
src/mame/drivers/blockout.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/m68000/m68000.h"
1314#include "deprecat.h"
1415#include "cpu/z80/z80.h"
1516#include "sound/2151intf.h"
r3957r3958
360361GAME( 1989, blockout, 0,        blockout, blockout, 0, ROT0, "Technos + California Dreams", "Block Out (set 1)", 0 )
361362GAME( 1989, blckout2, blockout, blockout, blockout, 0, ROT0, "Technos + California Dreams", "Block Out (set 2)", 0 )
362363GAME( 1989, blckoutj, blockout, blockout, blckoutj, 0, ROT0, "Technos + California Dreams", "Block Out (Japan)", 0 )
363GAME( 1991, agress,   0,        blockout, agress,   0, ROT0, "Palco", "Agress", GAME_IMPERFECT_GRAPHICS )
364GAME( 2003, agressb,  agress,   blockout, agress,   0, ROT0, "Palco", "Agress (English bootleg)", GAME_IMPERFECT_GRAPHICS )
364GAME( 1991, agress,   0,        blockout, agress,   0, ROT0, "Palco", "Agress", 0 )
365GAME( 2003, agressb,  agress,   blockout, agress,   0, ROT0, "Palco", "Agress (English bootleg)", 0 )
src/mame/drivers/tsamurai.c
r3957r3958
121121
122122static WRITE8_HANDLER( flip_screen_w )
123123{
124   flip_screen_set(data);
124   flip_screen_set(space->machine, data);
125125}
126126
127127static WRITE8_HANDLER( tsamurai_coin_counter_w )
src/mame/drivers/igs_m027.c
r3957r3958
1515*/
1616
1717#include "driver.h"
18#include "cpu/arm7/arm7.h"
1819#include "cpu/arm7/arm7core.h"
1920
2021
src/mame/drivers/canyon.c
r3957r3958
3737***************************************************************************/
3838
3939#include "driver.h"
40#include "cpu/m6502/m6502.h"
4041#include "canyon.h"
4142#include "sound/discrete.h"
4243
src/mame/drivers/ettrivia.c
r3957r3958
2525*/
2626
2727#include "driver.h"
28#include "cpu/z80/z80.h"
2829#include "sound/ay8910.h"
2930
3031/* it uses the same palette layout as in naughtyb */
r3957r3958
6465
6566   coin_counter_w(0, data & 0x80);
6667
67   flip_screen_set(data & 1);
68   flip_screen_set(space->machine, data & 1);
6869}
6970
7071static READ8_HANDLER( ettrivia_question_r )
src/mame/drivers/jalmah.c
r3957r3958
101101*******************************************************************************************/
102102
103103#include "driver.h"
104#include "deprecat.h"
105104#include "cpu/m68000/m68000.h"
106105#include "sound/okim6295.h"
107106
r3957r3958
893892static WRITE16_HANDLER( jalmah_flip_screen_w )
894893{
895894   /*---- ----x flip screen*/
896   flip_screen_set(data & 1);
895   flip_screen_set(space->machine, data & 1);
897896
898897//  popmessage("%04x",data);
899898}
src/mame/drivers/f1gp.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/z80/z80.h"
24#include "cpu/m68000/m68000.h"
2325#include "video/konamiic.h"
2426#include "f1gp.h"
2527#include "sound/2610intf.h"
r3957r3958
483485   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
484486   MDRV_CPU_IO_MAP(sound_io_map,0)
485487
486   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
488   MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame */
487489
488490   /* video hardware */
489491   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
522524   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
523525
524526   /* NO sound CPU */
525   MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */
527   MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame */
526528
527529   /* video hardware */
528530   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/supdrapo.c
r3957r3958
2424*/
2525
2626#include "driver.h"
27#include "cpu/z80/z80.h"
2728#include "sound/ay8910.h"
2829
2930static tilemap *fg_tilemap;
src/mame/drivers/lvcards.c
r3957r3958
7474***************************************************************************/
7575
7676#include "driver.h"
77#include "cpu/z80/z80.h"
7778#include "sound/ay8910.h"
7879
7980extern WRITE8_HANDLER( lvcards_videoram_w );
src/mame/drivers/namcos2.c
r3957r3958
447447***************************************************************************/
448448
449449#include "driver.h"
450#include "cpu/m68000/m68000.h"
451#include "cpu/m6805/m6805.h"
450452#include "deprecat.h"
451453#include "namcos2.h"
452454#include "cpu/m6809/m6809.h"
r3957r3958
16021604   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
16031605   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16041606
1605   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1607   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
16061608
16071609   MDRV_MACHINE_START(namcos2)
16081610   MDRV_MACHINE_RESET(namcos2)
r3957r3958
16761678   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
16771679   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
16781680
1679   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1681   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
16801682
16811683   MDRV_MACHINE_START(namcos2)
16821684   MDRV_MACHINE_RESET(namcos2)
r3957r3958
17261728   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
17271729   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17281730
1729   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1731   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
17301732
17311733   MDRV_MACHINE_START(namcos2)
17321734   MDRV_MACHINE_RESET(namcos2)
r3957r3958
17761778   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
17771779   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
17781780
1779   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1781   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
17801782
17811783   MDRV_MACHINE_START(namcos2)
17821784   MDRV_MACHINE_RESET(namcos2)
r3957r3958
18261828   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
18271829   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18281830
1829   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1831   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
18301832
18311833   MDRV_MACHINE_START(namcos2)
18321834   MDRV_MACHINE_RESET(namcos2)
r3957r3958
18761878   MDRV_CPU_PROGRAM_MAP(readmem_mcu,writemem_mcu)
18771879   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
18781880
1879   MDRV_INTERLEAVE(100) /* CPU slices per frame */
1881   MDRV_QUANTUM_TIME(HZ(6000)) /* CPU slices per frame */
18801882
18811883   MDRV_MACHINE_START(namcos2)
18821884   MDRV_MACHINE_RESET(namcos2)
src/mame/drivers/m63.c
r3957r3958
116116***************************************************************************/
117117
118118#include "driver.h"
119#include "cpu/z80/z80.h"
119120#include "cpu/mcs48/mcs48.h"
120121#include "sound/ay8910.h"
121122#include "sound/samples.h"
r3957r3958
215216
216217static WRITE8_HANDLER( m63_flipscreen_w )
217218{
218   if (flip_screen_get() != (~data & 0x01))
219   if (flip_screen_get(space->machine) != (~data & 0x01))
219220   {
220      flip_screen_set(~data & 0x01);
221      flip_screen_set(space->machine, ~data & 0x01);
221222      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
222223   }
223224}
224225
225226static WRITE8_HANDLER( fghtbskt_flipscreen_w )
226227{
227   flip_screen_set(data);
228   fg_flag = flip_screen_get() ? TILE_FLIPX : 0;
228   flip_screen_set(space->machine, data);
229   fg_flag = flip_screen_get(space->machine) ? TILE_FLIPX : 0;
229230}
230231
231232
r3957r3958
272273      int sx = spriteram[offs + 3];
273274      int sy = sy_offset - spriteram[offs];
274275
275      if (flip_screen_get())
276      if (flip_screen_get(machine))
276277      {
277278         sx = 240 - sx;
278279         sy = sy_offset - sy;
src/mame/drivers/route16.c
r3957r3958
6868 ***************************************************************************/
6969
7070#include "driver.h"
71#include "cpu/z80/z80.h"
7172#include "deprecat.h"
7273#include "sound/dac.h"
7374#include "sound/sn76477.h"
src/mame/drivers/tecmosys.c
r3957r3958
182182*/
183183
184184#include "driver.h"
185#include "cpu/z80/z80.h"
185186#include "machine/eeprom.h"
186187#include "tecmosys.h"
187188#include "cpu/m68000/m68000.h"
src/mame/drivers/exzisus.c
r3957r3958
2828****************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/z80/z80.h"
3132#include "taitoipt.h"
3233#include "audio/taitosnd.h"
3334#include "sound/2151intf.h"
r3957r3958
8182      }
8283   }
8384
84   flip_screen_set(data & 0x40);
85   flip_screen_set(space->machine, data & 0x40);
8586}
8687
8788static WRITE8_HANDLER( exzisus_cpub_bankswitch_w )
r3957r3958
9899      }
99100   }
100101
101   flip_screen_set(data & 0x40);
102   flip_screen_set(space->machine, data & 0x40);
102103}
103104
104105static WRITE8_HANDLER( exzisus_coincounter_w )
r3957r3958
340341   MDRV_CPU_PROGRAM_MAP(cpuc_readmem,cpuc_writemem)
341342   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
342343
343   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
344   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
344345
345346   /* video hardware */
346347   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/exidy440.c
r3957r3958
215215***************************************************************************/
216216
217217#include "driver.h"
218#include "cpu/m6809/m6809.h"
218219#include "exidy440.h"
219220
220221
src/mame/drivers/tx1.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/z80/z80.h"
45#include "cpu/i86/i86.h"
4446#include "sound/ay8910.h"
4547#include "sound/custom.h"
46#include "cpu/i86/i86.h"
4748#include "rendlay.h"
4849#include "tx1.h"
4950
src/mame/drivers/thayers.c
r3957r3958
1111*/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "render.h"
1516#include "machine/laserdsc.h"
1617#include "cpu/cop400/cop400.h"
src/mame/drivers/topshoot.c
r3957r3958
134134*/
135135
136136#include "driver.h"
137#include "cpu/z80/z80.h"
138#include "cpu/m68000/m68000.h"
137139#include "genesis.h"
138140
139141
r3957r3958
244246   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
245247   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
246248
247   MDRV_INTERLEAVE(100)
249   MDRV_QUANTUM_TIME(HZ(6000))
248250
249251   MDRV_MACHINE_START(genesis)
250252   MDRV_MACHINE_RESET(genesis)
src/mame/drivers/merit.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "machine/8255ppi.h"
4445#include "sound/ay8910.h"
4546#include "video/mc6845.h"
r3957r3958
254255static const mc6845_interface mc6845_intf =
255256{
256257   "main",               /* screen we are acting on */
257   CRTC_CLOCK,          /* the clock (pin 21) of the chip */
258258   8,                  /* number of pixels per video memory address */
259259   begin_update,         /* before pixel update callback */
260260   update_row,            /* row update callback */
r3957r3958
289289
290290static WRITE8_DEVICE_HANDLER( misc_w )
291291{
292   flip_screen_set(~data & 0x10);
292   flip_screen_set(device->machine, ~data & 0x10);
293293   extra_video_bank_bit = (data & 2) << 8;
294294   lscnblk = (data >> 3) & 1;
295295
r3957r3958
298298
299299static WRITE8_DEVICE_HANDLER( misc_couple_w )
300300{
301   flip_screen_set(~data & 0x10);
301   flip_screen_set(device->machine, ~data & 0x10);
302302   extra_video_bank_bit = (data & 2) << 8;
303303   lscnblk = (data >> 3) & 1;
304304
r3957r3958
10491049   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
10501050   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 512, 0, 512, 256, 0, 256)   /* temporary, CRTC will configure screen */
10511051
1052   MDRV_DEVICE_ADD("crtc", MC6845)
1053   MDRV_DEVICE_CONFIG(mc6845_intf)
1052   MDRV_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf)
10541053
10551054   MDRV_VIDEO_UPDATE(merit)
10561055
src/mame/drivers/dassault.c
r3957r3958
122122***************************************************************************/
123123
124124#include "driver.h"
125#include "cpu/m68000/m68000.h"
125126#include "cpu/h6280/h6280.h"
126127#include "deco16ic.h"
127128#include "sound/2203intf.h"
r3957r3958
564565   MDRV_CPU_ADD("audio", H6280,32220000/8)   /* Accurate */
565566   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
566567
567   MDRV_INTERLEAVE(140) /* 140 CPU slices per frame */
568   MDRV_QUANTUM_TIME(HZ(8400)) /* 140 CPU slices per frame */
568569
569570   /* video hardware */
570571   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/pingpong.c
r3957r3958
11#include "driver.h"
2#include "cpu/z80/z80.h"
23#include "deprecat.h"
34#include "sound/sn76496.h"
45
src/mame/drivers/ssrj.c
r3957r3958
3030************************************/
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
3334#include "sound/ay8910.h"
3435
3536extern UINT8 *ssrj_vram1,*ssrj_vram2,*ssrj_vram3,*ssrj_vram4,*ssrj_scrollram;
src/mame/drivers/blstroid.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "blstroid.h"
src/mame/drivers/gotya.c
r3957r3958
3434****************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/z80/z80.h"
3738#include "sound/samples.h"
3839#include "includes/gotya.h"
3940
src/mame/drivers/gtipoker.c
r3957r3958
22/* Nothing else is known about this set / game */
33
44#include "driver.h"
5#include "cpu/z80/z80.h"
56
67static VIDEO_START(gtipoker)
78{
src/mame/drivers/aztarac.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
18#include "cpu/m68000/m68000.h"
1719#include "video/vector.h"
1820#include "aztarac.h"
1921#include "sound/ay8910.h"
src/mame/drivers/tatsumi.c
r3957r3958
138138***************************************************************************/
139139
140140#include "driver.h"
141#include "cpu/z80/z80.h"
142#include "cpu/nec/nec.h"
143#include "cpu/m68000/m68000.h"
141144#include "tatsumi.h"
142145#include "sound/2151intf.h"
143146#include "sound/okim6295.h"
r3957r3958
846849   MDRV_CPU_ADD("sub2", Z80, 8000000) //???
847850   MDRV_CPU_PROGRAM_MAP(apache3_z80_map,0)
848851
849   MDRV_INTERLEAVE(100)
852   MDRV_QUANTUM_TIME(HZ(6000))
850853
851854   /* video hardware */
852855   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
889892   MDRV_CPU_ADD("audio", Z80, 4000000) //???
890893   MDRV_CPU_PROGRAM_MAP(roundup5_z80_map,0)
891894
892   MDRV_INTERLEAVE(100)
895   MDRV_QUANTUM_TIME(HZ(6000))
893896
894897   /* video hardware */
895898   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
933936   MDRV_CPU_ADD("audio", Z80, 16000000 / 4) /* Confirmed */
934937   MDRV_CPU_PROGRAM_MAP(cyclwarr_z80_map,0)
935938
936   MDRV_INTERLEAVE(200)
939   MDRV_QUANTUM_TIME(HZ(12000))
937940
938941   /* video hardware */
939942   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
977980   MDRV_CPU_ADD("audio", Z80, 16000000 / 4) /* Confirmed */
978981   MDRV_CPU_PROGRAM_MAP(cyclwarr_z80_map,0)
979982
980   MDRV_INTERLEAVE(200)
983   MDRV_QUANTUM_TIME(HZ(12000))
981984
982985   /* video hardware */
983986   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/supbtime.c
r3957r3958
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "cpu/m68000/m68000.h"
2425#include "cpu/h6280/h6280.h"
2526#include "sound/2151intf.h"
2627#include "sound/okim6295.h"
src/mame/drivers/blmbycar.c
r3957r3958
2424***************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/m68000/m68000.h"
2728#include "sound/okim6295.h"
2829
2930/* Variables defined in video: */
src/mame/drivers/toratora.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/m6800/m6800.h"
2122#include "machine/6821pia.h"
2223#include "sound/sn76477.h"
2324
src/mame/drivers/retofinv.c
r3957r3958
2929***************************************************************************/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
3233#include "deprecat.h"
3334#include "cpu/m6805/m6805.h"
3435#include "sound/sn76496.h"
r3957r3958
7475{
7576   int bit = data & 1;
7677
77   cpu_interrupt_enable(0,bit);
78   cpu_interrupt_enable(space->machine->cpu[0],bit);
7879   if (!bit)
7980      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
8081}
r3957r3958
8384{
8485   int bit = data & 1;
8586
86   cpu_interrupt_enable(1,bit);
87   cpu_interrupt_enable(space->machine->cpu[1],bit);
8788   if (!bit)
8889      cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
8990}
r3957r3958
353354   MDRV_CPU_ADD("68705", M68705,18432000/6)   /* 3.072 MHz? */
354355   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
355356
356   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame - enough for the sound CPU to read all commands */
357   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slices per frame - enough for the sound CPU to read all commands */
357358
358359   /* video hardware */
359360   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gbusters.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/z80/z80.h"
1112#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1213#include "video/konamiic.h"
1314#include "sound/2151intf.h"
src/mame/drivers/megaplay.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "deprecat.h"
4445#include "genesis.h"
4546#include "megadriv.h"
r3957r3958
794795   MDRV_CPU_IO_MAP(megaplay_bios_io_map,0)
795796   MDRV_CPU_VBLANK_INT_HACK(megaplay_bios_irq, 262)
796797
797   MDRV_INTERLEAVE(100)
798   MDRV_QUANTUM_TIME(HZ(6000))
798799
799800   MDRV_SOUND_ADD("sn2", SN76496, MASTER_CLOCK/15)
800801   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.25) /* 3.58 MHz */
src/mame/drivers/meadows.c
r3957r3958
597597   MDRV_CPU_PROGRAM_MAP(audio_map,0)
598598   MDRV_CPU_PERIODIC_INT(audio_interrupt, (double)5000000/131072)
599599
600   MDRV_INTERLEAVE(10)
600   MDRV_QUANTUM_TIME(HZ(600))
601601
602602   /* video hardware */
603603   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/bogeyman.c
r3957r3958
4343   static int last;
4444
4545   // bit 0 is flipscreen
46   flip_screen_set(data & 0x01);
46   flip_screen_set(space->machine, data & 0x01);
4747
4848   // bit 5 goes to 8910 #0 BDIR pin
4949   if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
src/mame/drivers/harddriv.c
r3957r3958
204204
205205
206206#include "driver.h"
207#include "cpu/m68000/m68000.h"
207208#include "cpu/tms34010/tms34010.h"
208209#include "cpu/tms32010/tms32010.h"
209210#include "cpu/adsp2100/adsp2100.h"
r3957r3958
10141015   MDRV_CPU_PROGRAM_MAP(driver_gsp_map,0)
10151016   MDRV_CPU_CONFIG(gsp_config_driver)
10161017
1017   MDRV_INTERLEAVE(500)
1018   MDRV_QUANTUM_TIME(HZ(30000))
10181019
10191020   MDRV_MACHINE_START(harddriv)
10201021   MDRV_MACHINE_RESET(harddriv)
r3957r3958
11111112   MDRV_CPU_PROGRAM_MAP(ds3_program_map,0)
11121113   MDRV_CPU_DATA_MAP(ds3_data_map,0)
11131114
1114   MDRV_INTERLEAVE(1000)
1115   MDRV_QUANTUM_TIME(HZ(60000))
11151116MACHINE_DRIVER_END
11161117
11171118
r3957r3958
34613462   memory_install_write16_handler(cpu_get_address_space(hdcpu_main, ADDRESS_SPACE_PROGRAM), 0x823800, 0x823fff, 0, 0, hd68k_ds3_control_w);
34623463
34633464   /* if we have a sound DSP, boot it */
3464   if (hdcpu_sound != NULL && ((const cpu_class_header *)hdcpu_sound->classtoken)->cputype == CPU_ADSP2105)
3465   if (hdcpu_sound != NULL && cpu_get_type(hdcpu_sound) == CPU_ADSP2105)
34653466      adsp2105_load_boot_data((UINT8 *)(hdcpu_sound->region + 0x10000), (UINT32 *)hdcpu_sound->region);
34663467
3467   if (hdcpu_sounddsp != NULL && ((const cpu_class_header *)hdcpu_sounddsp->classtoken)->cputype == CPU_ADSP2105)
3468   if (hdcpu_sounddsp != NULL && cpu_get_type(hdcpu_sounddsp) == CPU_ADSP2105)
34683469      adsp2105_load_boot_data((UINT8 *)(hdcpu_sounddsp->region + 0x10000), (UINT32 *)hdcpu_sounddsp->region);
34693470
34703471/*
src/mame/drivers/srmp2.c
r3957r3958
5656
5757
5858#include "driver.h"
59#include "cpu/z80/z80.h"
60#include "cpu/m68000/m68000.h"
5961#include "deprecat.h"
6062#include "sound/ay8910.h"
6163#include "sound/msm5205.h"
src/mame/drivers/m72.c
r3957r3958
8181***************************************************************************/
8282
8383#include "driver.h"
84#include "cpu/z80/z80.h"
85#include "cpu/nec/nec.h"
8486#include "deprecat.h"
8587#include "machine/irem_cpu.h"
8688#include "audio/m72.h"
r3957r3958
8890#include "sound/2151intf.h"
8991#include "iremipt.h"
9092#include "m72.h"
91#include "cpu/nec/nec.h"
9293#include "cpu/mcs51/mcs51.h"
9394
9495#define MASTER_CLOCK      XTAL_32MHz
src/mame/drivers/r2dtank.c
r3957r3958
387387static const mc6845_interface mc6845_intf =
388388{
389389   "main",               /* screen we are acting on */
390   CRTC_CLOCK,          /* the clock (pin 21) of the chip */
391390   8,                  /* number of pixels per video memory address */
392391   begin_update,         /* before pixel update callback */
393392   update_row,            /* row update callback */
r3957r3958
550549   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
551550   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256)   /* temporary, CRTC will configure screen */
552551
553   MDRV_DEVICE_ADD("crtc", MC6845)
554   MDRV_DEVICE_CONFIG(mc6845_intf)
552   MDRV_MC6845_ADD("crtc", MC6845, CRTC_CLOCK, mc6845_intf)
555553
556554   /* 74LS123 */
557555
558   MDRV_DEVICE_ADD("74123", TTL74123)
559   MDRV_DEVICE_CONFIG(ttl74123_intf)
556   MDRV_TTL74123_ADD("74123", ttl74123_intf)
560557
561558   /* audio hardware */
562559   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/ohmygod.c
r3957r3958
1212***************************************************************************/
1313
1414#include "driver.h"
15#include "cpu/m68000/m68000.h"
1516#include "sound/okim6295.h"
1617
1718
r3957r3958
335336   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
336337
337338   MDRV_MACHINE_RESET(ohmygod)
338   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
339   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
339340
340341   /* video hardware */
341342   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/snk68.c
r3957r3958
4141***************************************************************************/
4242
4343#include "driver.h"
44#include "cpu/m68000/m68000.h"
4445#include "cpu/z80/z80.h"
4546#include "sound/3812intf.h"
4647#include "sound/upd7759.h"
src/mame/drivers/madalien.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/m6502/m6502.h"
1011#include "sound/ay8910.h"
1112#include "video/mc6845.h"
1213#include "madalien.h"
src/mame/drivers/igs_180.c
r3957r3958
128128
129129***************************************************************************/
130130
131static void draw_sprite(bitmap_t *bitmap,const rectangle *cliprect, int sx, int sy, int dimx, int dimy, int flipx, int flipy, int color, int addr)
131static void draw_sprite(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect, int sx, int sy, int dimx, int dimy, int flipx, int flipy, int color, int addr)
132132{
133133   // prepare GfxElement on the fly
134134   gfx_element gfx;
135135
136   gfx.machine = machine;
136137   gfx.width = dimx;
137138   gfx.height = dimy;
138139   gfx.total_elements = 1;
r3957r3958
183184
184185      color = (s[7] & 0xe0) >> 5;
185186
186      draw_sprite(bitmap, cliprect, sx, sy, dimx, dimy, flipx, flipy, color, addr);
187      draw_sprite(machine, bitmap, cliprect, sx, sy, dimx, dimy, flipx, flipy, color, addr);
187188   }
188189}
189190
190191// A simple gfx viewer (toggle with T)
191static int debug_viewer(bitmap_t *bitmap,const rectangle *cliprect)
192static int debug_viewer(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
192193{
193194#ifdef MAME_DEBUG
194195   static int toggle = 0;
r3957r3958
220221
221222      bitmap_fill(bitmap,cliprect,0);
222223
223      draw_sprite(bitmap, cliprect, 0,0, w,h, 0,0, 0, a);
224      draw_sprite(machine, bitmap, cliprect, 0,0, w,h, 0,0, 0, a);
224225
225226      popmessage("a: %08X w: %03X p: %02X-%02x-%02x",a,w,sprites_gfx[a/3*3+0],sprites_gfx[a/3*3+1],sprites_gfx[a/3*3+2]);
226227      osd_sleep(200000);
r3957r3958
245246   }
246247#endif
247248
248   if (debug_viewer(bitmap,cliprect))
249   if (debug_viewer(screen->machine, bitmap,cliprect))
249250      return 0;
250251
251252   if (layers_ctrl & 1)   tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_OPAQUE,0);
src/mame/drivers/aeroboto.c
r3957r3958
2323****************************************************************************/
2424
2525#include "driver.h"
26#include "cpu/m6809/m6809.h"
2627#include "sound/ay8910.h"
2728
2829
src/mame/drivers/konamigv.c
r3957r3958
206206
207207/* SCSI */
208208
209static void scsi_dma_read( UINT32 n_address, INT32 n_size )
209static void scsi_dma_read( running_machine *machine, UINT32 n_address, INT32 n_size )
210210{
211211   int i;
212212   int n_this;
r3957r3958
249249   }
250250}
251251
252static void scsi_dma_write( UINT32 n_address, INT32 n_size )
252static void scsi_dma_write( running_machine *machine, UINT32 n_address, INT32 n_size )
253253{
254254   int i;
255255   int n_this;
src/mame/drivers/firetrap.c
r3957r3958
5757***************************************************************************/
5858
5959#include "driver.h"
60#include "cpu/z80/z80.h"
6061#include "deprecat.h"
6162#include "cpu/m6502/m6502.h"
6263#include "sound/3812intf.h"
r3957r3958
239240
240241static WRITE8_HANDLER( flip_screen_w )
241242{
242   flip_screen_set(data);
243   flip_screen_set(space->machine, data);
243244}
244245
245246
src/mame/drivers/crgolf.c
r3957r3958
3030***************************************************************************/
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
3334#include "crgolf.h"
3435#include "sound/ay8910.h"
3536#include "sound/msm5205.h"
r3957r3958
375376   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
376377
377378   MDRV_MACHINE_START(crgolf)
378   MDRV_INTERLEAVE(100)
379   MDRV_QUANTUM_TIME(HZ(6000))
379380
380381   /* video hardware */
381382   MDRV_IMPORT_FROM(crgolf_video)
src/mame/drivers/mastboy.c
r3957r3958
434434*/
435435
436436#include "driver.h"
437#include "cpu/z180/z180.h"
437438#include "sound/saa1099.h"
438439#include "sound/msm5205.h"
439440
src/mame/drivers/thedeep.c
r3957r3958
2525***************************************************************************/
2626
2727#include "driver.h"
28#include "cpu/z80/z80.h"
29#include "cpu/m6502/m6502.h"
2830#include "deprecat.h"
2931#include "thedeep.h"
3032#include "sound/2203intf.h"
r3957r3958
7173   switch (protection_command)
7274   {
7375      case 0x11:
74         flip_screen_set(1);
76         flip_screen_set(space->machine, 1);
7577      break;
7678
7779      case 0x20:
78         flip_screen_set(0);
80         flip_screen_set(space->machine, 0);
7981      break;
8082
8183      case 0x30:
src/mame/drivers/oneshot.c
r3957r3958
3030*/
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
34#include "cpu/m68000/m68000.h"
3335#include "sound/okim6295.h"
3436#include "sound/3812intf.h"
3537#include "includes/oneshot.h"
src/mame/drivers/stlforce.c
r3957r3958
6868*/
6969
7070#include "driver.h"
71#include "cpu/m68000/m68000.h"
7172#include "machine/eeprom.h"
7273#include "sound/okim6295.h"
7374
src/mame/drivers/rmhaihai.c
r3957r3958
2929***************************************************************************/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
3233#include "sound/ay8910.h"
3334#include "sound/msm5205.h"
3435
r3957r3958
142143
143144static WRITE8_HANDLER( ctrl_w )
144145{
145   flip_screen_set(data & 0x01);
146   flip_screen_set(space->machine, data & 0x01);
146147
147148   // (data & 0x02) is switched on and off in service mode
148149
src/mame/drivers/topspeed.c
r3957r3958
230230***************************************************************************/
231231
232232#include "driver.h"
233#include "cpu/z80/z80.h"
233234#include "taitoipt.h"
234235#include "cpu/m68000/m68000.h"
235236#include "video/taitoic.h"
src/mame/drivers/zr107.c
r3957r3958
174174*/
175175
176176#include "driver.h"
177#include "deprecat.h"
177#include "cpu/m68000/m68000.h"
178178#include "cpu/powerpc/ppc.h"
179179#include "cpu/sharc/sharc.h"
180180#include "sound/k054539.h"
r3957r3958
299299
300300static CUSTOM_INPUT( adcdo_r )
301301{
302   return adc083x_do_read(0);
302   return adc083x_do_read(field->port->machine, 0);
303303}
304304
305305static READ8_HANDLER( sysreg_r )
r3957r3958
323323                0x20 = SARS (A/D busy flag)
324324                0x10 = EEPDO (EEPROM DO)
325325            */
326         r = (adc083x_sars_read(0) << 5) | (eeprom_read_bit() << 4);
326         r = (adc083x_sars_read(space->machine, 0) << 5) | (eeprom_read_bit() << 4);
327327         break;
328328
329329      case 5:   /* Parallel data port */
r3957r3958
382382         if (data & 0x40)   /* CG Board 0 IRQ Ack */
383383            cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_IRQ0, CLEAR_LINE);
384384         set_cgboard_id((data >> 4) & 3);
385         adc083x_cs_write(0, (data >> 2) & 1);
386         adc083x_di_write(0, (data >> 1) & 1);
387         adc083x_clk_write(0, (data >> 0) & 1);
385         adc083x_cs_write(space->machine, 0, (data >> 2) & 1);
386         adc083x_di_write(space->machine, 0, (data >> 1) & 1);
387         adc083x_clk_write(space->machine, 0, (data >> 0) & 1);
388388         mame_printf_debug("System register 1 = %02X\n", data);
389389         break;
390390
r3957r3958
399399   }
400400}
401401
402static double adc0838_callback(int input)
402static double adc0838_callback(running_machine *machine, int input)
403403{
404404   switch (input)
405405   {
406406      case ADC083X_CH0:
407         return (double)(5 * input_port_read(Machine, "ANALOG1")) / 255.0;
407         return (double)(5 * input_port_read(machine, "ANALOG1")) / 255.0;
408408      case ADC083X_CH1:
409         return (double)(5 * input_port_read(Machine, "ANALOG2")) / 255.0;
409         return (double)(5 * input_port_read(machine, "ANALOG2")) / 255.0;
410410      case ADC083X_CH2:
411         return (double)(5 * input_port_read(Machine, "ANALOG3")) / 255.0;
411         return (double)(5 * input_port_read(machine, "ANALOG3")) / 255.0;
412412      case ADC083X_CH3:
413413         return 0;
414414      case ADC083X_COM:
r3957r3958
459459static MACHINE_START( zr107 )
460460{
461461   /* set conservative DRC options */
462   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
462   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
463463
464464   /* configure fast RAM regions for DRC */
465   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
466   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
467   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff);
468   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
469   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
465   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
466   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
467   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x000fffff);
468   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, workram);
469   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
470470}
471471
472472static ADDRESS_MAP_START( zr107_map, ADDRESS_SPACE_PROGRAM, 32 )
r3957r3958
748748   MDRV_CPU_CONFIG(sharc_cfg)
749749   MDRV_CPU_DATA_MAP(sharc_map, 0)
750750
751   MDRV_INTERLEAVE(500)
751   MDRV_QUANTUM_TIME(HZ(30000))
752752
753753   MDRV_NVRAM_HANDLER(93C46)
754754   MDRV_MACHINE_START(zr107)
r3957r3958
793793   MDRV_CPU_CONFIG(sharc_cfg)
794794   MDRV_CPU_DATA_MAP(sharc_map, 0)
795795
796   MDRV_INTERLEAVE(500)
796   MDRV_QUANTUM_TIME(HZ(30000))
797797
798798   MDRV_NVRAM_HANDLER(93C46)
799799   MDRV_MACHINE_START(zr107)
r3957r3958
853853
854854static DRIVER_INIT(zr107)
855855{
856   init_konami_cgboard(1, CGBOARD_TYPE_ZR107);
856   init_konami_cgboard(machine, 1, CGBOARD_TYPE_ZR107);
857857   init_zr107(machine);
858858}
859859
860860static DRIVER_INIT(jetwave)
861861{
862   init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB);
862   init_konami_cgboard(machine, 1, CGBOARD_TYPE_GTICLUB);
863863   init_zr107(machine);
864864}
865865
src/mame/drivers/amspdwy.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
1718#include "sound/2151intf.h"
1819
1920/* Variables & functions defined in video: */
src/mame/drivers/segae.c
r3957r3958
296296*/
297297
298298#include "driver.h"
299#include "deprecat.h"
299#include "cpu/z80/z80.h"
300300#include "sound/sn76496.h"
301301#include "machine/mc8123.h"
302302#include "machine/segacrpt.h"
r3957r3958
570570   GEN_VDP = 3   // Genesis VDP running in SMS2 Mode
571571};
572572
573static int sms_vdp_null_irq_callback(int status)
573static int sms_vdp_null_irq_callback(running_machine *machine, int status)
574574{
575575   return -1;
576576}
577577
578static int sms_vdp_cpu0_irq_callback(int status)
578static int sms_vdp_cpu0_irq_callback(running_machine *machine, int status)
579579{
580580   if (status==1)
581      cpu_set_input_line(Machine->cpu[0],0,HOLD_LINE);
581      cpu_set_input_line(machine->cpu[0],0,HOLD_LINE);
582582   else
583      cpu_set_input_line(Machine->cpu[0],0,CLEAR_LINE);
583      cpu_set_input_line(machine->cpu[0],0,CLEAR_LINE);
584584
585585   return 0;
586586}
587587
588static int sms_vdp_cpu1_irq_callback(int status)
588static int sms_vdp_cpu1_irq_callback(running_machine *machine, int status)
589589{
590590   if (status==1)
591      cpu_set_input_line(Machine->cpu[1],0,HOLD_LINE);
591      cpu_set_input_line(machine->cpu[1],0,HOLD_LINE);
592592   else
593      cpu_set_input_line(Machine->cpu[1],0,CLEAR_LINE);
593      cpu_set_input_line(machine->cpu[1],0,CLEAR_LINE);
594594
595595   return 0;
596596}
597597
598598
599static int sms_vdp_cpu2_irq_callback(int status)
599static int sms_vdp_cpu2_irq_callback(running_machine *machine, int status)
600600{
601601   if (status==1)
602      cpu_set_input_line(Machine->cpu[2],0,HOLD_LINE);
602      cpu_set_input_line(machine->cpu[2],0,HOLD_LINE);
603603   else
604      cpu_set_input_line(Machine->cpu[2],0,CLEAR_LINE);
604      cpu_set_input_line(machine->cpu[2],0,CLEAR_LINE);
605605
606606   return 0;
607607}
r3957r3958
648648   int sms_framerate;
649649   emu_timer* sms_scanline_timer;
650650   UINT16* cram_mamecolours; // for use on RGB_DIRECT screen
651   int    (*set_irq)(int state);
651   int    (*set_irq)(running_machine *machine, int state);
652652
653653};
654654
r3957r3958
687687   chip->vram = auto_malloc(0x4000);
688688   memset(chip->vram,0x00,0x4000);
689689
690   //printf("%d\n", (*chip->set_irq)(200));
690   //printf("%d\n", (*chip->set_irq)(machine, 200));
691691
692692   if (chip->vdp_type==GG_VDP)
693693   {
r3957r3958
825825
826826}
827827
828static UINT8 vdp_ctrl_r(struct sms_vdp *chip)
828static UINT8 vdp_ctrl_r(const address_space *space, struct sms_vdp *chip)
829829{
830830   UINT8 retvalue;
831831
r3957r3958
839839   chip->sprite_collision = 0;
840840   chip->sprite_overflow = 0;
841841
842   (chip->set_irq)(0); // clear IRQ;
842   (chip->set_irq)(space->machine, 0); // clear IRQ;
843843
844844
845845   return retvalue;
r3957r3958
852852   chip->cmd_reg = (chip->cmd_part2&0xc0)>>6;
853853}
854854
855static void vdp_set_register(struct sms_vdp *chip)
855static void vdp_set_register(running_machine *machine, struct sms_vdp *chip)
856856{
857857   UINT8 reg = chip->cmd_part2&0x0f;
858858   chip->regs[reg] = chip->cmd_part1;
r3957r3958
865865   {
866866      if ((chip->regs[0x1]&0x20) && chip->frame_irq_pending)
867867      {
868         (chip->set_irq)(1); // set IRQ;
868         (chip->set_irq)(machine, 1); // set IRQ;
869869      }
870870      else
871871      {
872         (chip->set_irq)(0); // clear IRQ;
872         (chip->set_irq)(machine, 0); // clear IRQ;
873873      }
874874   }
875875
r3957r3958
877877   {
878878      if ((chip->regs[0x0]&0x10) && chip->line_irq_pending)
879879      {
880         (chip->set_irq)(1); // set IRQ;
880         (chip->set_irq)(machine, 1); // set IRQ;
881881      }
882882      else
883883      {
884         (chip->set_irq)(0); // clear IRQ;
884         (chip->set_irq)(machine, 0); // clear IRQ;
885885      }
886886   }
887887
r3957r3958
889889//  printf("VDP: setting register %01x to %02x\n",reg, chip->cmd_part1);
890890}
891891
892static void vdp_ctrl_w(UINT8 data, struct sms_vdp *chip)
892static void vdp_ctrl_w(const address_space *space, UINT8 data, struct sms_vdp *chip)
893893{
894894   if (chip->cmd_pend)
895895   { /* Part 2 of a command word write */
r3957r3958
910910            break;
911911
912912         case 0x2: /* REG setting */
913            vdp_set_register(chip);
913            vdp_set_register(space->machine, chip);
914914            chip->writemode = 0;
915915            break;
916916
r3957r3958
946946
947947READ8_HANDLER( md_sms_vdp_ctrl_r )
948948{
949   return vdp_ctrl_r(md_sms_vdp);
949   return vdp_ctrl_r(space, md_sms_vdp);
950950}
951951
952952WRITE8_HANDLER( md_sms_vdp_ctrl_w )
953953{
954   vdp_ctrl_w(data, md_sms_vdp);
954   vdp_ctrl_w(space, data, md_sms_vdp);
955955}
956956
957957
r3957r3958
974974
975975READ8_HANDLER( sms_vdp_ctrl_r )
976976{
977   return vdp_ctrl_r(vdp1);
977   return vdp_ctrl_r(space, vdp1);
978978}
979979
980980WRITE8_HANDLER( sms_vdp_ctrl_w )
981981{
982   vdp_ctrl_w(data, vdp1);
982   vdp_ctrl_w(space, data, vdp1);
983983}
984984
985985WRITE8_HANDLER( sms_sn76496_w )
r3957r3958
13131313            chip->hint_counter=chip->regs[0xa];
13141314            if (chip->regs[0x0]&0x10)
13151315            {
1316               (chip->set_irq)(1); // set IRQ;
1316               (chip->set_irq)(machine, 1); // set IRQ;
13171317            }
13181318            else
13191319            {
1320               (chip->set_irq)(0); // clear IRQ;
1320               (chip->set_irq)(machine, 0); // clear IRQ;
13211321            }
13221322         }
13231323
r3957r3958
13331333         chip->frame_irq_pending = 1;
13341334         if (chip->regs[0x1]&0x20)
13351335         {
1336            (chip->set_irq)(1); // set IRQ;
1336            (chip->set_irq)(machine, 1); // set IRQ;
13371337         }
13381338         else
13391339         {
1340            (chip->set_irq)(0); // clear IRQ;
1340            (chip->set_irq)(machine, 0); // clear IRQ;
13411341         }
13421342      }
13431343   }
r3957r3958
20922092
20932093static READ8_HANDLER( sms_vdp_2_ctrl_r )
20942094{
2095   return vdp_ctrl_r(vdp2);
2095   return vdp_ctrl_r(space, vdp2);
20962096}
20972097
20982098static WRITE8_HANDLER( sms_vdp_2_ctrl_w )
20992099{
2100   vdp_ctrl_w(data, vdp2);
2100   vdp_ctrl_w(space, data, vdp2);
21012101}
21022102
21032103static WRITE8_HANDLER( segasyse_videoram_w )
src/mame/drivers/fantland.c
r3957r3958
4444***************************************************************************************/
4545
4646#include "driver.h"
47#include "cpu/z80/z80.h"
48#include "cpu/nec/nec.h"
49#include "cpu/i86/i86.h"
50#include "cpu/i86/i86.h"
4751#include "sound/2151intf.h"
4852#include "sound/3812intf.h"
4953#include "sound/dac.h"
r3957r3958
826830
827831   MDRV_MACHINE_RESET(fantland)
828832
829   MDRV_INTERLEAVE(8000/60)   // sound irq must feed the DAC at 8kHz
833   MDRV_QUANTUM_TIME(HZ(8000))   // sound irq must feed the DAC at 8kHz
830834
831835   /* video hardware */
832836   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/dominob.c
r3957r3958
5050
5151      sx = spriteram[offs];
5252      sy = 248 - spriteram[offs + 1];
53      if (flip_screen_x_get()) sx = 248 - sx;
54      if (flip_screen_y_get()) sy = 248 - sy;
53      if (flip_screen_x_get(machine)) sx = 248 - sx;
54      if (flip_screen_y_get(machine)) sy = 248 - sy;
5555
5656      code = spriteram[offs + 3] + ((spriteram[offs + 2] & 0x03) << 8)  ;
5757
5858      drawgfx(bitmap,machine->gfx[0],
5959            2 * code,
6060            ((spriteram[offs + 2] & 0xf8) >> 3)  ,
61            flip_screen_x_get(),flip_screen_y_get(),
62            sx,sy + (flip_screen_y_get() ? 8 : -8),
61            flip_screen_x_get(machine),flip_screen_y_get(machine),
62            sx,sy + (flip_screen_y_get(machine) ? 8 : -8),
6363            cliprect,TRANSPARENCY_PEN,0);
6464      drawgfx(bitmap,machine->gfx[0],
6565            2 * code + 1,
6666            ((spriteram[offs + 2] & 0xf8) >> 3)  ,
67            flip_screen_x_get(),flip_screen_y_get(),
67            flip_screen_x_get(machine),flip_screen_y_get(machine),
6868            sx,sy,
6969            cliprect,TRANSPARENCY_PEN,0);
7070   }
src/mame/drivers/ksys573.c
r3957r3958
205205*/
206206
207207#include "driver.h"
208#include "deprecat.h"
209208#include "cdrom.h"
210209#include "cpu/mips/psx.h"
211210#include "includes/psx.h"
r3957r3958
289288
290289static READ32_HANDLER( jamma_r )
291290{
291   running_machine *machine = space->machine;
292292   UINT32 data = 0;
293293
294294   switch (offset)
295295   {
296296   case 0:
297      data = input_port_read(space->machine, "IN0");
297      data = input_port_read(machine, "IN0");
298298      break;
299299   case 1:
300300   {
301      data = input_port_read(space->machine, "IN1");
301      data = input_port_read(machine, "IN1");
302302      data |= 0x000000c0;
303303
304304      if( has_ds2401[ security_cart_number ] )
305305      {
306         data |= ds2401_read( security_cart_number ) << 14;
306         data |= ds2401_read( machine, security_cart_number ) << 14;
307307      }
308308
309      data |= adc083x_do_read( 0 ) << 16;
309      data |= adc083x_do_read( machine, 0 ) << 16;
310310
311311      switch( chiptype[ security_cart_number ] )
312312      {
313313      case 1:
314         data |= x76f041_sda_read( security_cart_number ) << 18;
314         data |= x76f041_sda_read( machine, security_cart_number ) << 18;
315315         break;
316316
317317      case 2:
318         data |= x76f100_sda_read( security_cart_number ) << 18;
318         data |= x76f100_sda_read( machine, security_cart_number ) << 18;
319319         break;
320320
321321      case 3:
322         data |= zs01_sda_read( security_cart_number ) << 18;
322         data |= zs01_sda_read( machine, security_cart_number ) << 18;
323323         break;
324324      }
325325
r3957r3958
334334      break;
335335   }
336336   case 2:
337      data = input_port_read(space->machine, "IN2");
337      data = input_port_read(machine, "IN2");
338338      break;
339339   case 3:
340      data = input_port_read(space->machine, "IN3");
340      data = input_port_read(machine, "IN3");
341341      break;
342342   }
343343
344   verboselog( space->machine, 2, "jamma_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
344   verboselog( machine, 2, "jamma_r( %08x, %08x ) %08x\n", offset, mem_mask, data );
345345
346346   return data;
347347}
348348
349349static WRITE32_HANDLER( jamma_w )
350350{
351   verboselog( space->machine, 2, "jamma_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
351   running_machine *machine = space->machine;
352   verboselog( machine, 2, "jamma_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
352353
353354   switch( offset )
354355   {
355356   case 0:
356      adc083x_cs_write( 0, ( data >> 1 ) & 1 );
357      adc083x_clk_write( 0, ( data >> 2 ) & 1 );
358      adc083x_di_write( 0, ( data >> 0 ) & 1 );
359      adc083x_se_write( 0, 0 );
357      adc083x_cs_write( machine, 0, ( data >> 1 ) & 1 );
358      adc083x_clk_write( machine, 0, ( data >> 2 ) & 1 );
359      adc083x_di_write( machine, 0, ( data >> 0 ) & 1 );
360      adc083x_se_write( machine, 0, 0 );
360361      break;
361362
362363   default:
363      verboselog( space->machine, 0, "jamma_w: unhandled offset %08x %08x %08x\n", offset, mem_mask, data );
364      verboselog( machine, 0, "jamma_w: unhandled offset %08x %08x %08x\n", offset, mem_mask, data );
364365      break;
365366   }
366367}
r3957r3958
386387   switch( chiptype[ security_cart_number ] )
387388   {
388389   case 3:
389      zs01_sda_write( security_cart_number, !( ( control >> 6 ) & 1 ) ); /* 0x40 */
390      zs01_sda_write( space->machine, security_cart_number, !( ( control >> 6 ) & 1 ) ); /* 0x40 */
390391      break;
391392   }
392393
r3957r3958
908909   {
909910      if( get_disk_handle( diskregions[i] ) != NULL )
910911      {
911         SCSIAllocInstance( &SCSIClassCr589, &available_cdroms[ i ], diskregions[i] );
912         SCSIAllocInstance( machine, &SCSIClassCr589, &available_cdroms[ i ], diskregions[i] );
912913      }
913914      else
914915      {
r3957r3958
953954   }
954955}
955956
956static void cdrom_dma_read( UINT32 n_address, INT32 n_size )
957static void cdrom_dma_read( running_machine *machine, UINT32 n_address, INT32 n_size )
957958{
958   verboselog( Machine, 2, "cdrom_dma_read( %08x, %08x )\n", n_address, n_size );
959   verboselog( machine, 2, "cdrom_dma_read( %08x, %08x )\n", n_address, n_size );
959960//  mame_printf_debug("DMA read: address %08x size %08x\n", n_address, n_size);
960961}
961962
962static void cdrom_dma_write( UINT32 n_address, INT32 n_size )
963static void cdrom_dma_write( running_machine *machine, UINT32 n_address, INT32 n_size )
963964{
964   running_machine *machine = Machine;
965
966965   verboselog( machine, 2, "cdrom_dma_write( %08x, %08x )\n", n_address, n_size );
967966//  mame_printf_debug("DMA write: address %08x size %08x\n", n_address, n_size);
968967
r3957r3958
971970   verboselog( machine, 2, "atapi_xfer_end: %d %d\n", atapi_xferlen, atapi_xfermod );
972971
973972   // set a transfer complete timer (Note: CYCLES_PER_SECTOR can't be lower than 2000 or the BIOS ends up "out of order")
974   timer_adjust_oneshot(atapi_timer, cpu_clocks_to_attotime(Machine->cpu[0], (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
973   timer_adjust_oneshot(atapi_timer, cpu_clocks_to_attotime(machine->cpu[0], (ATAPI_CYCLES_PER_SECTOR * (atapi_xferlen/2048))), 0);
975974}
976975
977976static UINT32 m_n_security_control;
978static void (*security_bit7_write)( int data );
979static void (*security_bit6_write)( int data );
980static void (*security_bit5_write)( int data );
977static void (*security_bit7_write)( running_machine *machine, int data );
978static void (*security_bit6_write)( running_machine *machine, int data );
979static void (*security_bit5_write)( running_machine *machine, int data );
981980
982981static WRITE32_HANDLER( security_w )
983982{
983   running_machine *machine = space->machine;
984984   COMBINE_DATA( &m_n_security_control );
985985
986986   verboselog( space->machine, 2, "security_w( %08x, %08x, %08x )\n", offset, mem_mask, data );
r3957r3958
990990      switch( chiptype[ security_cart_number ] )
991991      {
992992      case 1:
993         x76f041_sda_write( security_cart_number, ( data >> 0 ) & 1 );
994         x76f041_scl_write( security_cart_number, ( data >> 1 ) & 1 );
995         x76f041_cs_write( security_cart_number, ( data >> 2 ) & 1 );
996         x76f041_rst_write( security_cart_number, ( data >> 3 ) & 1 );
993         x76f041_sda_write( machine, security_cart_number, ( data >> 0 ) & 1 );
994         x76f041_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 );
995         x76f041_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 );
996         x76f041_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 );
997997         break;
998998
999999      case 2:
1000         x76f100_sda_write( security_cart_number, ( data >> 0 ) & 1 );
1001         x76f100_scl_write( security_cart_number, ( data >> 1 ) & 1 );
1002         x76f100_cs_write( security_cart_number, ( data >> 2 ) & 1 );
1003         x76f100_rst_write( security_cart_number, ( data >> 3 ) & 1 );
1000         x76f100_sda_write( machine, security_cart_number, ( data >> 0 ) & 1 );
1001         x76f100_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 );
1002         x76f100_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 );
1003         x76f100_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 );
10041004         break;
10051005
10061006      case 3:
1007         zs01_scl_write( security_cart_number, ( data >> 1 ) & 1 );
1008         zs01_cs_write( security_cart_number, ( data >> 2 ) & 1 );
1009         zs01_rst_write( security_cart_number, ( data >> 3 ) & 1 );
1007         zs01_scl_write( machine, security_cart_number, ( data >> 1 ) & 1 );
1008         zs01_cs_write( machine, security_cart_number, ( data >> 2 ) & 1 );
1009         zs01_rst_write( machine, security_cart_number, ( data >> 3 ) & 1 );
10101010         break;
10111011      }
10121012
10131013      if( has_ds2401[ security_cart_number ] )
10141014      {
1015         ds2401_write( security_cart_number, !( ( data >> 4 ) & 1 ) );
1015         ds2401_write( machine, security_cart_number, !( ( data >> 4 ) & 1 ) );
10161016      }
10171017
10181018      if( security_bit5_write != NULL )
10191019      {
1020         security_bit5_write( ( data >> 5 ) & 1 );
1020         security_bit5_write( machine, ( data >> 5 ) & 1 );
10211021      }
10221022
10231023      if( security_bit6_write != NULL )
10241024      {
1025         security_bit6_write( ( data >> 6 ) & 1 );
1025         security_bit6_write( machine, ( data >> 6 ) & 1 );
10261026      }
10271027
10281028      if( security_bit7_write != NULL )
10291029      {
1030         security_bit7_write( ( data >> 7 ) & 1 );
1030         security_bit7_write( machine, ( data >> 7 ) & 1 );
10311031      }
10321032   }
10331033}
r3957r3958
11231123#define RC_CLC ( 0x100 )
11241124#define RC_DIV ( 0x200 )
11251125
1126static UINT64 psxcpu_gettotalcycles( void )
1126static UINT64 psxcpu_gettotalcycles( running_machine *machine )
11271127{
11281128   /* TODO: should return the start of the current tick. */
1129   return cpu_get_total_cycles(Machine->cpu[0]) * 2;
1129   return cpu_get_total_cycles(machine->cpu[0]) * 2;
11301130}
11311131
11321132static int root_divider( int n_counter )
r3957r3958
11471147   return 1;
11481148}
11491149
1150static UINT16 root_current( int n_counter )
1150static UINT16 root_current( running_machine *machine, int n_counter )
11511151{
11521152   if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 )
11531153   {
r3957r3958
11561156   else
11571157   {
11581158      UINT64 n_current;
1159      n_current = psxcpu_gettotalcycles() - m_p_n_root_start[ n_counter ];
1159      n_current = psxcpu_gettotalcycles(machine) - m_p_n_root_start[ n_counter ];
11601160      n_current /= root_divider( n_counter );
11611161      n_current += m_p_n_root_count[ n_counter ];
11621162      if( n_current > 0xffff )
11631163      {
11641164         /* TODO: use timer for wrap on 0x10000. */
11651165         m_p_n_root_count[ n_counter ] = n_current;
1166         m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
1166         m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(machine);
11671167      }
11681168      return n_current;
11691169   }
r3957r3958
11791179   return 0x10000;
11801180}
11811181
1182static void root_timer_adjust( int n_counter )
1182static void root_timer_adjust( running_machine *machine, int n_counter )
11831183{
11841184   if( ( m_p_n_root_mode[ n_counter ] & RC_STOP ) != 0 )
11851185   {
r3957r3958
11891189   {
11901190      int n_duration;
11911191
1192      n_duration = root_target( n_counter ) - root_current( n_counter );
1192      n_duration = root_target( n_counter ) - root_current( machine, n_counter );
11931193      if( n_duration < 1 )
11941194      {
11951195         n_duration += 0x10000;
r3957r3958
12091209   {
12101210      /* TODO: wrap should be handled differently as RC_COUNTTARGET & RC_IRQTARGET don't have to be the same. */
12111211      m_p_n_root_count[ n_counter ] = 0;
1212      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
1212      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(machine);
12131213   }
12141214   if( ( m_p_n_root_mode[ n_counter ] & RC_REPEAT ) != 0 )
12151215   {
1216      root_timer_adjust( n_counter );
1216      root_timer_adjust( machine, n_counter );
12171217   }
12181218   if( ( m_p_n_root_mode[ n_counter ] & RC_IRQOVERFLOW ) != 0 ||
12191219      ( m_p_n_root_mode[ n_counter ] & RC_IRQTARGET ) != 0 )
r3957r3958
12321232   {
12331233   case 0:
12341234      m_p_n_root_count[ n_counter ] = data;
1235      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
1235      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(space->machine);
12361236      break;
12371237   case 1:
1238      m_p_n_root_count[ n_counter ] = root_current( n_counter );
1239      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles();
1238      m_p_n_root_count[ n_counter ] = root_current( space->machine, n_counter );
1239      m_p_n_root_start[ n_counter ] = psxcpu_gettotalcycles(space->machine);
12401240      m_p_n_root_mode[ n_counter ] = data;
12411241
12421242      if( ( m_p_n_root_mode[ n_counter ] & RC_RESET ) != 0 )
r3957r3958
12591259      return;
12601260   }
12611261
1262   root_timer_adjust( n_counter );
1262   root_timer_adjust( space->machine, n_counter );
12631263}
12641264
12651265static READ32_HANDLER( k573_counter_r )
r3957r3958
12721272   switch( offset % 4 )
12731273   {
12741274   case 0:
1275      data = root_current( n_counter );
1275      data = root_current( space->machine, n_counter );
12761276      break;
12771277   case 1:
12781278      data = m_p_n_root_mode[ n_counter ];
r3957r3958
13781378   state_save_register_global(machine,  control );
13791379}
13801380
1381static double analogue_inputs_callback( int input )
1381static double analogue_inputs_callback( running_machine *machine, int input )
13821382{
13831383   switch( input )
13841384   {
13851385   case ADC083X_CH0:
1386      return (double) ( input_port_read_safe(Machine,  "analog0", 0 ) * 5 ) / 255;
1386      return (double) ( input_port_read_safe(machine,  "analog0", 0 ) * 5 ) / 255;
13871387   case ADC083X_CH1:
1388      return (double) ( input_port_read_safe(Machine,  "analog1", 0 ) * 5 ) / 255;
1388      return (double) ( input_port_read_safe(machine,  "analog1", 0 ) * 5 ) / 255;
13891389   case ADC083X_CH2:
1390      return (double) ( input_port_read_safe(Machine,  "analog2", 0 ) * 5 ) / 255;
1390      return (double) ( input_port_read_safe(machine,  "analog2", 0 ) * 5 ) / 255;
13911391   case ADC083X_CH3:
1392      return (double) ( input_port_read_safe(Machine,  "analog3", 0 ) * 5 ) / 255;
1392      return (double) ( input_port_read_safe(machine,  "analog3", 0 ) * 5 ) / 255;
13931393   case ADC083X_AGND:
13941394      return 0;
13951395   case ADC083X_VREF:
r3957r3958
14481448         break;
14491449
14501450      case 0x1014:
1451         zs01_init( cart, eeprom_rom, NULL, NULL, ds2401_rom );
1451         zs01_init( machine, cart, eeprom_rom, NULL, NULL, ds2401_rom );
14521452         chiptype[ cart ] = 3;
14531453
14541454         switch( cart )
r3957r3958
16851685*/
16861686
16871687static UINT8 gx700pwbf_output_data[ 4 ];
1688static void (*gx700pwfbf_output_callback)( int offset, int data );
1688static void (*gx700pwfbf_output_callback)( running_machine *machine, int offset, int data );
16891689
16901690static READ32_HANDLER( gx700pwbf_io_r )
16911691{
r3957r3958
17181718   return data;
17191719}
17201720
1721static void gx700pwbf_output( int offset, UINT8 data )
1721static void gx700pwbf_output( running_machine *machine, int offset, UINT8 data )
17221722{
17231723   if( gx700pwfbf_output_callback != NULL )
17241724   {
r3957r3958
17301730         int newbit = ( data >> shift[ i ] ) & 1;
17311731         if( oldbit != newbit )
17321732         {
1733            gx700pwfbf_output_callback( ( offset * 8 ) + i, newbit );
1733            gx700pwfbf_output_callback( machine, ( offset * 8 ) + i, newbit );
17341734         }
17351735      }
17361736   }
r3957r3958
17471747
17481748      if( ACCESSING_BITS_0_15 )
17491749      {
1750         gx700pwbf_output( 0, data & 0xff );
1750         gx700pwbf_output( space->machine, 0, data & 0xff );
17511751      }
17521752      break;
17531753
17541754   case 0x22:
17551755      if( ACCESSING_BITS_0_15 )
17561756      {
1757         gx700pwbf_output( 1, data & 0xff );
1757         gx700pwbf_output( space->machine, 1, data & 0xff );
17581758      }
17591759      break;
17601760
17611761   case 0x24:
17621762      if( ACCESSING_BITS_0_15 )
17631763      {
1764         gx700pwbf_output( 2, data & 0xff );
1764         gx700pwbf_output( space->machine, 2, data & 0xff );
17651765      }
17661766      break;
17671767
17681768   case 0x26:
17691769      if( ACCESSING_BITS_0_15 )
17701770      {
1771         gx700pwbf_output( 3, data & 0xff );
1771         gx700pwbf_output( space->machine, 3, data & 0xff );
17721772      }
17731773      break;
17741774
r3957r3958
17781778   }
17791779}
17801780
1781static void gx700pwfbf_init( running_machine *machine, void (*output_callback_func)( int offset, int data ) )
1781static void gx700pwfbf_init( running_machine *machine, void (*output_callback_func)( running_machine *machine, int offset, int data ) )
17821782{
17831783   memset( gx700pwbf_output_data, 0, sizeof( gx700pwbf_output_data ) );
17841784
r3957r3958
18261826   stage[ offset ].DO = !data;
18271827}
18281828
1829static void gn845pwbb_clk_w( int offset, int data )
1829static void gn845pwbb_clk_w( running_machine *machine, int offset, int data )
18301830{
18311831   int clk = !data;
18321832
r3957r3958
18701870      }
18711871   }
18721872
1873   verboselog( Machine, 2, "stage: %dp data clk=%d state=%d d0=%d shift=%08x bit=%d stage_mask=%08x\n", offset + 1, clk, stage[ offset ].state, stage[ offset ].DO, stage[ offset ].shift, stage[ offset ].bit, stage_mask );
1873   verboselog( machine, 2, "stage: %dp data clk=%d state=%d d0=%d shift=%08x bit=%d stage_mask=%08x\n", offset + 1, clk, stage[ offset ].state, stage[ offset ].DO, stage[ offset ].shift, stage[ offset ].bit, stage_mask );
18741874}
18751875
18761876static CUSTOM_INPUT( gn845pwbb_read )
r3957r3958
18781878   return input_port_read(field->port->machine,  "STAGE" ) & stage_mask;
18791879}
18801880
1881static void gn845pwbb_output_callback( int offset, int data )
1881static void gn845pwbb_output_callback( running_machine *machine, int offset, int data )
18821882{
18831883   switch( offset )
18841884   {
r3957r3958
19031903      break;
19041904
19051905   case 7:
1906      gn845pwbb_clk_w( 0, !data );
1906      gn845pwbb_clk_w( machine, 0, !data );
19071907      break;
19081908
19091909   case 8:
r3957r3958
19271927      break;
19281928
19291929   case 15:
1930      gn845pwbb_clk_w( 1, !data );
1930      gn845pwbb_clk_w( machine, 1, !data );
19311931      break;
19321932
19331933   case 17:
r3957r3958
21202120   case 0x3b:
21212121      if( ACCESSING_BITS_16_31 )
21222122      {
2123         data |= ds2401_read( 2 ) << 28;
2123         data |= ds2401_read( space->machine, 2 ) << 28;
21242124      }
21252125      break;
21262126   case 0x3d:
r3957r3958
21582158static UINT32 a,b,c,d;
21592159
21602160static UINT16 gx894pwbba_output_data[ 8 ];
2161static void (*gx894pwbba_output_callback)( int offset, int data );
2161static void (*gx894pwbba_output_callback)( running_machine *machine, int offset, int data );
21622162
2163static void gx894pwbba_output( int offset, UINT8 data )
2163static void gx894pwbba_output( running_machine *machine, int offset, UINT8 data )
21642164{
21652165   if( gx894pwbba_output_callback != NULL )
21662166   {
r3957r3958
21722172         int newbit = ( data >> shift[ i ] ) & 1;
21732173         if( oldbit != newbit )
21742174         {
2175            gx894pwbba_output_callback( ( offset * 4 ) + i, newbit );
2175            gx894pwbba_output_callback( machine, ( offset * 4 ) + i, newbit );
21762176         }
21772177      }
21782178   }
r3957r3958
22362236   case 0x38:
22372237      if( ACCESSING_BITS_16_31 )
22382238      {
2239         gx894pwbba_output( 0, ( data >> 28 ) & 0xf );
2239         gx894pwbba_output( space->machine, 0, ( data >> 28 ) & 0xf );
22402240      }
22412241      if( ACCESSING_BITS_0_15 )
22422242      {
2243         gx894pwbba_output( 1, ( data >> 12 ) & 0xf );
2243         gx894pwbba_output( space->machine, 1, ( data >> 12 ) & 0xf );
22442244      }
22452245      COMBINE_DATA( &a );
22462246      break;
22472247   case 0x39:
22482248      if( ACCESSING_BITS_16_31 )
22492249      {
2250         gx894pwbba_output( 7, ( data >> 28 ) & 0xf );
2250         gx894pwbba_output( space->machine, 7, ( data >> 28 ) & 0xf );
22512251      }
22522252      if( ACCESSING_BITS_0_15 )
22532253      {
2254         gx894pwbba_output( 3, ( data >> 12 ) & 0xf );
2254         gx894pwbba_output( space->machine, 3, ( data >> 12 ) & 0xf );
22552255      }
22562256      COMBINE_DATA( &b );
22572257      break;
22582258   case 0x3b:
22592259      if( ACCESSING_BITS_16_31 )
22602260      {
2261         ds2401_write( 2, !( ( data >> 28 ) & 1 ) );
2261         ds2401_write( space->machine, 2, !( ( data >> 28 ) & 1 ) );
22622262      }
22632263      break;
22642264   case 0x3e:
r3957r3958
22862286
22872287      if( ACCESSING_BITS_16_31 )
22882288      {
2289         gx894pwbba_output( 4, ( data >> 28 ) & 0xf );
2289         gx894pwbba_output( space->machine, 4, ( data >> 28 ) & 0xf );
22902290      }
22912291      COMBINE_DATA( &c );
22922292      break;
22932293   case 0x3f:
22942294      if( ACCESSING_BITS_16_31 )
22952295      {
2296         gx894pwbba_output( 2, ( data >> 28 ) & 0xf );
2296         gx894pwbba_output( space->machine, 2, ( data >> 28 ) & 0xf );
22972297      }
22982298      if( ACCESSING_BITS_0_15 )
22992299      {
2300         gx894pwbba_output( 5, ( data >> 12 ) & 0xf );
2300         gx894pwbba_output( space->machine, 5, ( data >> 12 ) & 0xf );
23012301      }
23022302      COMBINE_DATA( &d );
23032303      break;
r3957r3958
23112311   }
23122312}
23132313
2314static void gx894pwbba_init( running_machine *machine, void (*output_callback_func)( int offset, int data ) )
2314static void gx894pwbba_init( running_machine *machine, void (*output_callback_func)( running_machine *machine, int offset, int data ) )
23152315{
23162316   int gx894_ram_size = 24 * 1024 * 1024;
23172317
r3957r3958
23512351
23522352/* ddr solo */
23532353
2354static void ddrsolo_output_callback( int offset, int data )
2354static void ddrsolo_output_callback( running_machine *machine, int offset, int data )
23552355{
23562356   switch( offset )
23572357   {
r3957r3958
24132413
24142414/* drummania */
24152415
2416static void drmn_output_callback( int offset, int data )
2416static void drmn_output_callback( running_machine *machine, int offset, int data )
24172417{
24182418   switch( offset )
24192419   {
r3957r3958
24932493
24942494/* dance maniax */
24952495
2496static void dmx_output_callback( int offset, int data )
2496static void dmx_output_callback( running_machine *machine, int offset, int data )
24972497{
24982498   switch( offset )
24992499   {
r3957r3958
26492649static int salarymc_lamp_data;
26502650static int salarymc_lamp_clk;
26512651
2652static void salarymc_lamp_data_write( int data )
2652static void salarymc_lamp_data_write( running_machine *machine, int data )
26532653{
26542654   salarymc_lamp_data = data;
26552655}
26562656
2657static void salarymc_lamp_rst_write( int data )
2657static void salarymc_lamp_rst_write( running_machine *machine, int data )
26582658{
26592659   if( data )
26602660   {
r3957r3958
26632663   }
26642664}
26652665
2666static void salarymc_lamp_clk_write( int data )
2666static void salarymc_lamp_clk_write( running_machine *machine, int data )
26672667{
26682668   if( salarymc_lamp_clk != data )
26692669   {
r3957r3958
26832683         {
26842684            if( ( salarymc_lamp_shift & ~0xe38 ) != 0 )
26852685            {
2686               verboselog( Machine, 0, "unknown bits in salarymc_lamp_shift %08x\n", salarymc_lamp_shift & ~0xe38 );
2686               verboselog( machine, 0, "unknown bits in salarymc_lamp_shift %08x\n", salarymc_lamp_shift & ~0xe38 );
26872687            }
26882688
26892689            output_set_value( "player 1 red", ( salarymc_lamp_shift >> 11 ) & 1 );
r3957r3958
27152715   state_save_register_global(machine,  salarymc_lamp_clk );
27162716}
27172717
2718static const timekeeper_config timekeeper_intf =
2719{
2720   "m48t58"
2721};
2722
27232718static MACHINE_DRIVER_START( konami573 )
27242719   /* basic machine hardware */
27252720   MDRV_CPU_ADD("main",  PSXCPU, XTAL_67_7376MHz )
r3957r3958
27552750   MDRV_SOUND_ROUTE( 0, "left", 1.0 )
27562751   MDRV_SOUND_ROUTE( 1, "right", 1.0 )
27572752
2758   MDRV_DEVICE_ADD( "m48t58", M48T58 )
2759   MDRV_DEVICE_CONFIG( timekeeper_intf )
2753   MDRV_M48T58_ADD( "m48t58" )
27602754MACHINE_DRIVER_END
27612755
27622756static INPUT_PORTS_START( konami573 )
src/mame/drivers/atarig1.c
r3957r3958
1919
2020
2121#include "driver.h"
22#include "cpu/m68000/m68000.h"
2223#include "machine/atarigen.h"
2324#include "audio/atarijsa.h"
2425#include "video/atarirle.h"
r3957r3958
955956      state_save_register_postload(machine, pitfighb_state_postload, NULL);
956957   }
957958   else if (slapstic != 0)
958      atarigen_slapstic_init(machine, 0, slapstic_base, 0, slapstic);
959      atarigen_slapstic_init(machine->cpu[0], slapstic_base, 0, slapstic);
959960   atarijsa_init(machine, "IN0", 0x4000);
960961
961962   atarig1_pitfight = is_pitfight;
src/mame/drivers/sbrkout.c
r3957r3958
3131***************************************************************************/
3232
3333#include "driver.h"
34#include "cpu/m6502/m6502.h"
3435#include "sound/dac.h"
3536
3637#include "sbrkout.lh"
src/mame/drivers/bladestl.c
r3957r3958
322322   MDRV_CPU_ADD("audio", M6809, 2000000)
323323   MDRV_CPU_PROGRAM_MAP(sound_map, 0)
324324
325   MDRV_INTERLEAVE(10)
325   MDRV_QUANTUM_TIME(HZ(600))
326326
327327   /* video hardware */
328328   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/toobin.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "toobin.h"
src/mame/drivers/bwidow.c
r3957r3958
217217***************************************************************************/
218218
219219#include "driver.h"
220#include "cpu/m6502/m6502.h"
220221#include "video/vector.h"
221222#include "video/avgdvg.h"
222223#include "machine/atari_vg.h"
src/mame/drivers/srumbler.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "deprecat.h"
1314#include "cpu/m6809/m6809.h"
1415#include "sound/2203intf.h"
src/mame/drivers/midas.c
r3957r3958
4646*************************************************************************************************************/
4747
4848#include "driver.h"
49#include "cpu/m68000/m68000.h"
4950#include "sound/ymz280b.h"
5051#include "machine/eeprom.h"
5152
src/mame/drivers/mcr68.c
r3957r3958
4949***************************************************************************/
5050
5151#include "driver.h"
52#include "cpu/m68000/m68000.h"
5253#include "audio/mcr.h"
5354#include "audio/williams.h"
5455#include "mcr.h"
r3957r3958
158159/*  turbocs_reset_w(~control_word & 0x0080);*/
159160   turbocs_data_w(space, offset, (control_word >> 8) & 0x001f);
160161
161   soundsgood_reset_w(~control_word & 0x2000);
162   soundsgood_reset_w(space->machine, ~control_word & 0x2000);
162163   soundsgood_data_w(space, offset, (control_word >> 8) & 0x001f);
163164}
164165
r3957r3958
210211{
211212   COMBINE_DATA(&control_word);
212213   williams_cvsd_reset_w(~control_word & 0x0400);
213   williams_cvsd_data_w(control_word & 0x3ff);
214   williams_cvsd_data_w(space->machine, control_word & 0x3ff);
214215}
215216
216217
src/mame/drivers/pbaction.c
r3957r3958
6464***************************************************************************/
6565
6666#include "driver.h"
67#include "cpu/z80/z80.h"
6768#include "deprecat.h"
6869#include "sound/ay8910.h"
6970#include "machine/segacrpt.h"
src/mame/drivers/funworld.c
r3957r3958
77    Rewrite and aditional work:     Roberto Fresca.
88
99
10    Games running on this hardware:
1011
11    Games running in this hardware:
12
1312    * Jolly Card (austrian),                            TAB-Austria,        1985.
1413    * Jolly Card (3x3 deal),                            TAB-Austria,        1985.
1514    * Jolly Card Professional 2.0,                      Spale-Soft,         2000.
r3957r3958
1716    * Jolly Card (croatian, set 1),                     TAB-Austria,        1985.
1817    * Jolly Card (croatian, set 2),                     Soft Design,        1993.
1918    * Jolly Card (italian, blue TAB board, encrypted),  bootleg,            199?.
19    * Jolly Card (italian, encrypted bootleg),          bootleg,            1990.
2020    * Super Joly 2000 - 3x,                             M.P.                1985.
2121    * Jolly Card (austrian, Funworld, bootleg),         Inter Games,        1986.
2222    * Big Deal (hungarian, set 1),                      Funworld,           1986.
r3957r3958
459459    - 1x trimmer (volume)(missing)
460460
461461
462    Jolly Card (italian encrypted bootleg)
463    --------------------------------------
462464
465    - 1x UM6845P
466    - 1x R65C02P3 (main CPU)
467    - 1x AY-3-8910 (sound)
468    - 2x MC68B21P
469    - 1x oscillator 16.000 MHz
470    - ROMs  3x 27256.
471    - 1x PROM M1-7649-5 (not dumped)
472    - 2x PLD HY18CV8S (not dumped)
473    - 1x PAL16L8ACN (not dumped)
474    - 1x 22x2 edge connector
475    - 1x 18x2 edge connector
476    - 1x trimmer (volume)
477    - 1x 8x2 DIP switches.
478
479
463480    Big Deal (hungarian)
464481    ------------------
465482
r3957r3958
976993    - Renamed the sets magiccrd, magiccda and magiccdb, to magicrd2, magicd2a and magicd2b.
977994    - Updated technical notes.
978995
996    [2008/12/15]
997    - Added new set: Jolly Card (italian, encrypted bootleg).
998      No coins... Only remote credits. After nvram init, set the Payout DIP to 'manual'
999      to allow the remote credits mode to work.
1000    - Created inputs from the scratch for jolycdib.
1001    - Updated technical notes.
9791002
1003
9801004    *** TO DO ***
9811005
9821006    - Figure out the royalcdc & jokercrd encryption.
r3957r3958
9961020#define MASTER_CLOCK   XTAL_16MHz
9971021
9981022#include "driver.h"
1023#include "cpu/m6502/m6502.h"
9991024#include "video/mc6845.h"
10001025#include "machine/6821pia.h"
10011026#include "sound/ay8910.h"
r3957r3958
13141339   PORT_DIPSETTING(    0x80, "Manual Payout SW" )
13151340INPUT_PORTS_END
13161341
1342static INPUT_PORTS_START( jolycdib )
1343   PORT_START("IN0")
1344   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("Remote") PORT_CODE(KEYCODE_Q)
1345   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )   PORT_NAME("Stop (Hold) 1") PORT_CODE(KEYCODE_Z)
1346   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 )   PORT_NAME("Cancel / Autohold / Accredito (Take)") PORT_CODE(KEYCODE_N)
1347   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )      PORT_NAME("Start / Doppio (Double)")
1348   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )   PORT_NAME("Stop (Hold) 5 / Bet / Half Gamble") PORT_CODE(KEYCODE_B)
1349   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 )
1350   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE2 )
1351   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )   PORT_NAME("Stop (Hold) 4 / Alta (High)") PORT_CODE(KEYCODE_V)
1352
1353   PORT_START("IN1")
1354   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )   PORT_NAME("Stop (Hold) 2 / Bassa (Low)") PORT_CODE(KEYCODE_X)
1355   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )   PORT_NAME("Stop (Hold) 3") PORT_CODE(KEYCODE_C)
1356   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test1") PORT_CODE(KEYCODE_A)
1357   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test2") PORT_CODE(KEYCODE_S)
1358   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test3") PORT_CODE(KEYCODE_D)
1359   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
1360   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test4") PORT_CODE(KEYCODE_F)
1361   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 )   PORT_NAME("Payout") PORT_CODE(KEYCODE_M)
1362
1363   PORT_START("IN2")
1364   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1365   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test5") PORT_CODE(KEYCODE_G)
1366   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test6") PORT_CODE(KEYCODE_H)
1367   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test7") PORT_CODE(KEYCODE_J)
1368   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test8") PORT_CODE(KEYCODE_K)
1369   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test9") PORT_CODE(KEYCODE_L)
1370   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test10") PORT_CODE(KEYCODE_E)
1371   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("test11") PORT_CODE(KEYCODE_R)
1372
1373   PORT_START("DSW")
1374   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:8")
1375   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1376   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1377   PORT_DIPNAME( 0x02, 0x00, "Remote" )         PORT_DIPLOCATION("SW1:7")
1378   PORT_DIPSETTING(    0x00, "10 Points/Pulse" )
1379   PORT_DIPSETTING(    0x02, "100 Points/Pulse" )
1380   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:6")
1381   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1382   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1383   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:5")
1384   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1385   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1386   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW1:4")
1387   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1388   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1389   PORT_DIPNAME( 0x20, 0x00, "Joker" )            PORT_DIPLOCATION("SW1:3")
1390   PORT_DIPSETTING(    0x00, "With Joker" )   /* also enable Five of a Kind */
1391   PORT_DIPSETTING(    0x20, "Without Joker" )
1392   PORT_DIPNAME( 0x40, 0x00, "Auto Hold" )         PORT_DIPLOCATION("SW1:2")
1393   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1394   PORT_DIPSETTING(    0x00, DEF_STR( On ) )   /* when is ON, allow the player to activate/deactivate the autohold through CANCEL button */
1395
1396   /* after nvram init, set the following one to 'manual'
1397    to allow the remote credits mode to work */
1398   PORT_DIPNAME( 0x80, 0x00, "Payout" )         PORT_DIPLOCATION("SW1:1")
1399   PORT_DIPSETTING(    0x00, "Hopper" )
1400   PORT_DIPSETTING(    0x80, "Manual Payout SW" )
1401INPUT_PORTS_END
1402
13171403static INPUT_PORTS_START( jolyc980 )
13181404   PORT_START("IN0")
13191405   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE )   PORT_NAME("Navijanje (Remote)") PORT_CODE(KEYCODE_Q)
r3957r3958
19071993   MDRV_VIDEO_START(funworld)
19081994   MDRV_VIDEO_UPDATE(funworld)
19091995
1910   MDRV_DEVICE_ADD("crtc", MC6845)
1996   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
19111997
19121998    /* sound hardware */
19131999   MDRV_SPEAKER_STANDARD_MONO("mono")
r3957r3958
20572143   ROM_LOAD( "82s147.bin",   0x0000, 0x0200, CRC(5ebc5659) SHA1(8d59011a181399682ab6e8ed14f83101e9bfa0c6) )
20582144ROM_END
20592145
2060ROM_START( jolycdit )   /* encrypted graphics */
2146ROM_START( jolycdit )   /* blue TAB PCB, encrypted graphics */
20612147   ROM_REGION( 0x10000, "main", 0 )
20622148   ROM_LOAD( "jn.bin", 0x8000, 0x8000, CRC(6ae00ed0) SHA1(5921c2882aeb5eadd0e04a477fa505ad35e9d98c) )
20632149
r3957r3958
20722158   ROM_LOAD( "gal16v8b.bin", 0x0000, 0x0117, CRC(3ad712b1) SHA1(54214841fb178e4b59bf6051522718f7667bad28) )
20732159ROM_END
20742160
2161/* jolycdit vs jolycdib:
2162
21631.BIN                   1.BIN                   IDENTICAL
21642.BIN                   2.bin                   IDENTICAL
2165jn.BIN                  3.BIN                   97.726440%
2166
2167jolycdib program seems to be the original for blue TAB PCB.
2168jolycdit has some code patches and redirected parts to suspicious offsets (as d500, d000, etc)
2169*/
2170ROM_START( jolycdib )   /* bootleg PCB, encrypted graphics */
2171   ROM_REGION( 0x10000, "main", 0 )
2172   ROM_LOAD( "3.bin", 0x8000, 0x8000, CRC(c76fdc79) SHA1(fc75c274d64fa9c99a546d424f38e79f1acf2576) )
2173
2174   ROM_REGION( 0x10000, "gfx1", ROMREGION_DISPOSE )
2175   ROM_LOAD( "2.bin", 0x0000, 0x8000, CRC(46805150) SHA1(63687ac44f6ace6d8924b2629536bcc7d3979ed2) )
2176   ROM_LOAD( "1.bin", 0x8000, 0x8000, CRC(43bcb2df) SHA1(5022bc3a0b852a7cd433e25c3c90a720e6328261) )
2177
2178   ROM_REGION( 0x0200, "proms", 0 )
2179   ROM_LOAD( "82s147.bin",   0x0000, 0x0200, CRC(5ebc5659) SHA1(8d59011a181399682ab6e8ed14f83101e9bfa0c6) )
2180
2181   ROM_REGION( 0x0200, "plds", 0 )
2182   ROM_LOAD( "gal16v8b.bin", 0x0000, 0x0117, CRC(3ad712b1) SHA1(54214841fb178e4b59bf6051522718f7667bad28) )
2183ROM_END
2184
20752185ROM_START( sjcd2kx3 )   /* Super Joly 2000 3x */
20762186   ROM_REGION( 0x10000, "main", 0 )
20772187   ROM_LOAD( "sj3.bin", 0x8000, 0x8000, CRC(c530b518) SHA1(36934d8e1e2cb2f71eb44a05b86ec970c9f398cd) )
r3957r3958
28162926GAME( 1985, jolyccra, jollycrd, cuoreuno, jolycdcr, funworld, ROT0, "TAB-Austria",     "Jolly Card (croatian, set 1)",                    0 )
28172927GAME( 1993, jolyccrb, jollycrd, cuoreuno, jolycdcr, funworld, ROT0, "Soft Design",     "Jolly Card (croatian, set 2)",                    0 )
28182928GAME( 199?, jolycdit, jollycrd, cuoreuno, jolycdit, tabblue,  ROT0, "bootleg",         "Jolly Card (italian, blue TAB board, encrypted)", 0 )
2929GAME( 1990, jolycdib, jollycrd, cuoreuno, jolycdib, tabblue,  ROT0, "bootleg",         "Jolly Card (italian, encrypted bootleg)",         0 )   /* not a real TAB blue PCB */
28192930GAME( 1985, sjcd2kx3, jollycrd, funworld, funworld, funworld, ROT0, "M.P.",            "Super Joly 2000 - 3x",                            0 )
28202931GAME( 1986, jolycdab, jollycrd, funworld, funworld, funworld, ROT0, "Inter Games",     "Jolly Card (austrian, Funworld, bootleg)",        GAME_NOT_WORKING )
28212932GAME( 1986, bigdeal,  0,        funworld, bigdeal,  funworld, ROT0, "Funworld",        "Big Deal (hungarian, set 1)",                     GAME_IMPERFECT_COLORS )
src/mame/drivers/overdriv.c
r3957r3958
1919***************************************************************************/
2020
2121#include "driver.h"
22#include "cpu/m68000/m68000.h"
2223#include "deprecat.h"
2324#include "video/konamiic.h"
2425#include "machine/eeprom.h"
r3957r3958
401402                  /* 60 fps, that's how I fixed it for now. */
402403   MDRV_CPU_PROGRAM_MAP(overdriv_s_readmem,overdriv_s_writemem)
403404
404   MDRV_INTERLEAVE(200)
405   MDRV_QUANTUM_TIME(HZ(12000))
405406
406407   MDRV_MACHINE_RESET(overdriv)
407408   MDRV_NVRAM_HANDLER(overdriv)
src/mame/drivers/thunderx.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1314#include "video/konamiic.h"
1415#include "sound/2151intf.h"
src/mame/drivers/jackpool.c
r3957r3958
99*/
1010
1111#include "driver.h"
12#include "cpu/m68000/m68000.h"
1213#include "deprecat.h"
1314#include "sound/okim6295.h"
1415
src/mame/drivers/spcforce.c
r3957r3958
256256   /* FIXME: The 8085A had a max clock of 6MHz, internally divided by 2! */
257257   MDRV_CPU_ADD("main", 8085A, 8000000 * 2)        /* 4.00 MHz??? */
258258   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
259   MDRV_CPU_VBLANK_INT("main", irq3_line_hold)
259   MDRV_CPU_VBLANK_INT("main", irq3_line_pulse)
260260
261261   MDRV_CPU_ADD("audio", I8035, 6144000)      /* divisor ??? */
262262   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
src/mame/drivers/gsword.c
r3957r3958
707707   MDRV_CPU_ADD("audio", Z80, XTAL_18MHz/6) /* verified on pcb */
708708   MDRV_CPU_PROGRAM_MAP(cpu3_map,0)
709709
710   MDRV_INTERLEAVE(200) /* Allow time for 2nd cpu to interleave*/
710   MDRV_QUANTUM_TIME(HZ(12000)) /* Allow time for 2nd cpu to interleave*/
711711
712712   MDRV_MACHINE_RESET(gsword)
713713
714714#if 1
715715   /* to MCU timeout champbbj */
716   MDRV_INTERLEAVE(100)
716   MDRV_QUANTUM_TIME(HZ(6000))
717717#endif
718718
719719   /* video hardware */
src/mame/drivers/galaxi.c
r3957r3958
4040***************************************************************************/
4141
4242#include "driver.h"
43#include "cpu/m68000/m68000.h"
4344#include "sound/okim6295.h"
4445#include "galaxi.lh"
4546
src/mame/drivers/nmg5.c
r3957r3958
220220*/
221221
222222#include "driver.h"
223#include "cpu/z80/z80.h"
224#include "cpu/m68000/m68000.h"
223225#include "sound/okim6295.h"
224226#include "sound/3812intf.h"
225227
src/mame/drivers/mario.c
r3957r3958
9090***************************************************************************/
9191
9292#include "driver.h"
93#include "cpu/z80/z80.h"
9394#include "machine/z80dma.h"
9495
9596#include "mario.h"
r3957r3958
105106
106107static const z80dma_interface mario_dma =
107108{
108   0,
109   Z80_CLOCK,
109   "main",
110110
111111   mario_dma_read_byte,
112112   mario_dma_write_byte,
r3957r3958
346346   MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)
347347
348348   /* devices */
349   MDRV_DEVICE_ADD("z80dma", Z80DMA)
350   MDRV_DEVICE_CONFIG(mario_dma)
349   MDRV_Z80DMA_ADD("z80dma", Z80_CLOCK, mario_dma)
351350
352351   /* video hardware */
353352   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/xmen.c
r3957r3958
1414
1515***************************************************************************/
1616#include "driver.h"
17#include "cpu/m68000/m68000.h"
1718#include "deprecat.h"
1819#include "video/konamiic.h"
1920#include "machine/eeprom.h"
src/mame/drivers/atarifb.c
r3957r3958
103103***************************************************************************/
104104
105105#include "driver.h"
106#include "cpu/m6502/m6502.h"
106107#include "deprecat.h"
107108#include "atarifb.h"
108109#include "sound/discrete.h"
src/mame/drivers/silkroad.c
r3957r3958
11#include "driver.h"
2#include "cpu/m68000/m68000.h"
23#include "sound/2151intf.h"
34#include "sound/okim6295.h"
45
src/mame/drivers/wink.c
r3957r3958
1212*/
1313
1414#include "driver.h"
15#include "cpu/z80/z80.h"
1516#include "sound/ay8910.h"
1617
1718static tilemap *bg_tilemap;
src/mame/drivers/lethal.c
r3957r3958
593593   memory_set_bankptr(machine, 1, &prgrom[0x10000]);
594594   memory_set_bankptr(machine, 2, &prgrom[0x48000]);
595595   /* force reset again to read proper reset vector */
596   cpu_reset(machine->cpu[0]);
596   device_reset(machine->cpu[0]);
597597}
598598
599599static const gfx_layout lethal_6bpp =
src/mame/drivers/videopin.c
r3957r3958
1111*************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/m6502/m6502.h"
1415#include "videopin.h"
1516#include "videopin.lh"
1617#include "sound/discrete.h"
src/mame/drivers/exprraid.c
r3957r3958
209209***************************************************************************/
210210
211211#include "driver.h"
212#include "cpu/m6502/m6502.h"
212213#include "cpu/m6809/m6809.h"
213214#include "sound/2203intf.h"
214215#include "sound/3812intf.h"
src/mame/drivers/tecmo16.c
r3957r3958
447447   MDRV_CPU_ADD("audio", Z80,8000000/2)         /* 4MHz */
448448   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
449449                        /* NMIs are triggered by the main CPU */
450   MDRV_INTERLEAVE(10)
450   MDRV_QUANTUM_TIME(HZ(600))
451451
452452   /* video hardware */
453453   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
487487   MDRV_CPU_ADD("audio", Z80,8000000/2)         /* 4MHz */
488488   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
489489                        /* NMIs are triggered by the main CPU */
490   MDRV_INTERLEAVE(10)
490   MDRV_QUANTUM_TIME(HZ(600))
491491
492492   /* video hardware */
493493   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/2mindril.c
r3957r3958
5353*/
5454
5555#include "driver.h"
56#include "cpu/m68000/m68000.h"
5657#include "sound/2610intf.h"
5758
5859static UINT16 *unkram;
src/mame/drivers/naughtyb.c
r3957r3958
103103 ***************************************************************************/
104104
105105#include "driver.h"
106#include "cpu/z80/z80.h"
106107#include "sound/custom.h"
107108#include "sound/tms36xx.h"
108109#include "includes/phoenix.h"
src/mame/drivers/runaway.c
r3957r3958
1111****************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/m6502/m6502.h"
1415#include "machine/atari_vg.h"
1516#include "sound/pokey.h"
1617
src/mame/drivers/taitowlf.c
r3957r3958
44*/
55
66#include "driver.h"
7#include "cpu/i386/i386.h"
78#include "memconv.h"
89#include "devconv.h"
9#include "deprecat.h"
1010#include "machine/8237dma.h"
1111#include "machine/pic8259.h"
1212#include "machine/pit8253.h"
r3957r3958
1616#include "machine/8042kbdc.h"
1717#include "machine/pckeybrd.h"
1818#include "machine/idectrl.h"
19#include "cpu/i386/i386.h"
2019
2120static void ide_interrupt(const device_config *device, int state);
2221
r3957r3958
386385
387386static const struct dma8237_interface dma8237_1_config =
388387{
389   0,
388   "main",
390389   1.0e-6, // 1us
391390
392391   pc_dma_read_byte,
r3957r3958
400399
401400static const struct dma8237_interface dma8237_2_config =
402401{
403   0,
402   "main",
404403   1.0e-6, // 1us
405404
406405   NULL,
r3957r3958
638637
639638MACHINE_DRIVER_END
640639
641static void set_gate_a20(int a20)
640static void set_gate_a20(running_machine *machine, int a20)
642641{
643   cpu_set_input_line(Machine->cpu[0], INPUT_LINE_A20, a20);
642   cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20);
644643}
645644
646static void keyboard_interrupt(int state)
645static void keyboard_interrupt(running_machine *machine, int state)
647646{
648647   pic8259_set_irq_line(taitowlf_devices.pic8259_1, 1, state);
649648}
r3957r3958
662661   KBDC8042_AT386, set_gate_a20, keyboard_interrupt, taitowlf_get_out2
663662};
664663
665static void taitowlf_set_keyb_int(int state) {
664static void taitowlf_set_keyb_int(running_machine *machine, int state) {
666665   pic8259_set_irq_line(taitowlf_devices.pic8259_1, 1, state);
667666}
668667
src/mame/drivers/toypop.c
r3957r3958
3030****************************************/
3131
3232#include "driver.h"
33#include "cpu/m6809/m6809.h"
34#include "cpu/m68000/m68000.h"
3335#include "machine/namcoio.h"
3436#include "sound/namco.h"
3537
r3957r3958
7779}
7880static WRITE8_HANDLER( flip )
7981{
80   flip_screen_set(data & 1);
82   flip_screen_set(space->machine, data & 1);
8183}
8284
8385/* chip #0: player inputs, buttons, coins */
r3957r3958
154156
155157static READ8_HANDLER( toypop_main_interrupt_enable_r )
156158{
157   cpu_interrupt_enable(0,1);
159   cpu_interrupt_enable(space->machine->cpu[0],1);
158160   return 0;
159161}
160162
161163static WRITE8_HANDLER( toypop_main_interrupt_enable_w )
162164{
163   cpu_interrupt_enable(0,1);
165   cpu_interrupt_enable(space->machine->cpu[0],1);
164166   cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
165167}
166168
167169static WRITE8_HANDLER( toypop_main_interrupt_disable_w )
168170{
169   cpu_interrupt_enable(0,0);
171   cpu_interrupt_enable(space->machine->cpu[0],0);
170172}
171173
172174static WRITE8_HANDLER( toypop_sound_interrupt_enable_acknowledge_w )
173175{
174   cpu_interrupt_enable(1,1);
176   cpu_interrupt_enable(space->machine->cpu[1],1);
175177   cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
176178}
177179
178180static WRITE8_HANDLER( toypop_sound_interrupt_disable_w )
179181{
180   cpu_interrupt_enable(1,0);
182   cpu_interrupt_enable(space->machine->cpu[1],0);
181183}
182184
183185static INTERRUPT_GEN( toypop_main_interrupt )
r3957r3958
212214
213215static TIMER_CALLBACK( disable_interrupts )
214216{
215   cpu_interrupt_enable(0,0);
217   cpu_interrupt_enable(machine->cpu[0],0);
216218   cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
217   cpu_interrupt_enable(1,0);
219   cpu_interrupt_enable(machine->cpu[1],0);
218220   cpu_set_input_line(machine->cpu[1], 0, CLEAR_LINE);
219221   interrupt_enable_68k = 0;
220222}
r3957r3958
580582   MDRV_CPU_PROGRAM_MAP(readmem_68k,writemem_68k)
581583   MDRV_CPU_VBLANK_INT("main", toypop_m68000_interrupt)
582584
583   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
585   MDRV_QUANTUM_TIME(HZ(6000))    /* 100 CPU slices per frame - an high value to ensure proper */
584586                     /* synchronization of the CPUs */
585587   MDRV_MACHINE_RESET(toypop)
586588
src/mame/drivers/tumbleb.c
r3957r3958
309309***************************************************************************/
310310
311311#include "driver.h"
312#include "cpu/z80/z80.h"
313#include "cpu/m68000/m68000.h"
312314#include "cpu/h6280/h6280.h"
313315#include "decocrpt.h"
314316#include "sound/2151intf.h"
src/mame/drivers/micro3d.c
r3957r3958
2222/*====================================================================*/
2323
2424#include "driver.h"
25#include "deprecat.h"
25#include "cpu/m68000/m68000.h"
2626#include "cpu/tms34010/tms34010.h"
2727#include "cpu/mcs51/mcs51.h"
2828#include "sound/2151intf.h"
r3957r3958
874874   MDRV_CPU_IO_MAP(soundmem_io,0)
875875
876876   MDRV_MACHINE_RESET(micro3d)
877   MDRV_INTERLEAVE(50)
877   MDRV_QUANTUM_TIME(HZ(3000))
878878
879879   MDRV_PALETTE_LENGTH(32768)
880880
src/mame/drivers/momoko.c
r3957r3958
4242*****************************************************************************/
4343
4444#include "driver.h"
45#include "cpu/z80/z80.h"
4546#include "sound/2203intf.h"
4647
4748extern UINT8 *momoko_bg_scrollx;
src/mame/drivers/olibochu.c
r3957r3958
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
1415#include "deprecat.h"
1516#include "sound/ay8910.h"
1617
r3957r3958
6768
6869static WRITE8_HANDLER( olibochu_flipscreen_w )
6970{
70   if (flip_screen_get() != (data & 0x80))
71   if (flip_screen_get(space->machine) != (data & 0x80))
7172   {
72      flip_screen_set(data & 0x80);
73      flip_screen_set(space->machine, data & 0x80);
7374      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
7475   }
7576
r3957r3958
108109      int sx = spriteram[offs+3];
109110      int sy = ((spriteram[offs+2] + 8) & 0xff) - 8;
110111
111      if (flip_screen_get())
112      if (flip_screen_get(machine))
112113      {
113114         sx = 240 - sx;
114115         sy = 240 - sy;
r3957r3958
136137      int sx = spriteram_2[offs+3];
137138      int sy = spriteram_2[offs+2];
138139
139      if (flip_screen_get())
140      if (flip_screen_get(machine))
140141      {
141142         sx = 248 - sx;
142143         sy = 248 - sy;
src/mame/drivers/ultratnk.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89#include "ultratnk.h"
910#include "audio/sprint4.h"
1011
src/mame/drivers/m90.c
r3957r3958
2525*****************************************************************************/
2626
2727#include "driver.h"
28#include "cpu/z80/z80.h"
29#include "cpu/nec/nec.h"
2830#include "deprecat.h"
2931#include "iremipt.h"
3032#include "machine/irem_cpu.h"
3133#include "audio/m72.h"
3234#include "sound/dac.h"
3335#include "sound/2151intf.h"
34#include "cpu/nec/nec.h"
3536
3637static UINT32 bankaddress;
3738
src/mame/drivers/tugboat.c
r3957r3958
2222****************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/m6502/m6502.h"
2526#include "machine/6821pia.h"
2627#include "sound/ay8910.h"
2728
src/mame/drivers/scotrsht.c
r3957r3958
3333***************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
37#include "cpu/m6809/m6809.h"
3638#include "sound/2203intf.h"
3739
3840extern UINT8 *scotrsht_scroll;
r3957r3958
5153static WRITE8_HANDLER( ctrl_w )
5254{
5355   irq_enable = data & 0x02;
54   flip_screen_set(data & 0x08);
56   flip_screen_set(space->machine, data & 0x08);
5557}
5658
5759static INTERRUPT_GEN( scotrsht_interrupt )
src/mame/drivers/taito_z.c
r3957r3958
858858***************************************************************************/
859859
860860#include "driver.h"
861#include "cpu/z80/z80.h"
861862#include "taitoipt.h"
862863#include "cpu/m68000/m68000.h"
863864#include "machine/eeprom.h"
r3957r3958
32533254
32543255   MDRV_MACHINE_START(taitoz)
32553256
3256   MDRV_INTERLEAVE(10)
3257   MDRV_QUANTUM_TIME(HZ(600))
32573258
32583259   /* video hardware */
32593260   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
33073308
33083309   MDRV_MACHINE_START(taitoz)
33093310
3310   MDRV_INTERLEAVE(100)
3311   MDRV_QUANTUM_TIME(HZ(6000))
33113312
33123313   /* video hardware */
33133314   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
33623363
33633364   MDRV_MACHINE_START(taitoz)
33643365
3365   MDRV_INTERLEAVE(50)
3366   MDRV_QUANTUM_TIME(HZ(3000))
33663367
33673368   /* video hardware */
33683369   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
34173418
34183419   MDRV_MACHINE_START(taitoz)
34193420
3420   MDRV_INTERLEAVE(100)
3421   MDRV_QUANTUM_TIME(HZ(6000))
34213422
34223423   /* video hardware */
34233424   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
34733474
34743475   MDRV_MACHINE_START(taitoz)
34753476
3476   MDRV_INTERLEAVE(500)
3477   MDRV_QUANTUM_TIME(HZ(30000))
34773478
34783479   /* video hardware */
34793480   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
35803581
35813582   MDRV_MACHINE_START(taitoz)
35823583
3583   MDRV_INTERLEAVE(10)
3584   MDRV_QUANTUM_TIME(HZ(600))
35843585
35853586   /* video hardware */
35863587   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
36343635   MDRV_CPU_VBLANK_INT("main", dblaxle_cpub_interrupt)
36353636
36363637   MDRV_MACHINE_START(taitoz)
3637   MDRV_INTERLEAVE(100)
3638   MDRV_QUANTUM_TIME(HZ(6000))
36383639
36393640   /* video hardware */
36403641   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/phoenix.c
r3957r3958
3030***************************************************************************/
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
3334#include "sound/tms36xx.h"
3435#include "cpu/i8085/i8085.h"
3536#include "sound/ay8910.h"
r3957r3958
503504
504505/* Same as Phoenix, but uses an AY8910 and an extra visible line (column) */
505506
507static const i8085_config survival_i8085_config =
508{
509   NULL,               /* INTE changed callback */
510   NULL,               /* STATUS changed callback */
511   NULL,               /* SOD changed callback (8085A only) */
512   survival_sid_callback   /* SID changed callback (8085A only) */
513};
514
506515static MACHINE_DRIVER_START( survival )
507516
508517   /* basic machine hardware */
509518   MDRV_CPU_ADD("main", 8085A, CPU_CLOCK)   /* 5.50 MHz */
519   MDRV_CPU_CONFIG(survival_i8085_config)
510520   MDRV_CPU_PROGRAM_MAP(survival_memory_map, 0)
511521
512522   MDRV_MACHINE_RESET(phoenix)
r3957r3958
10181028   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0x5000, 0, 0, input_port_read_handler8(machine->portconfig, "DSW1") );
10191029}
10201030
1021static DRIVER_INIT( survival )
1022{
1023   i8085_set_sid_callback(machine->cpu[0], survival_sid_callback);
1024}
10251031
10261032
1027
10281033GAME( 1980, phoenix,  0,        phoenix,  phoenix,  0,        ROT90, "Amstar", "Phoenix (Amstar)", GAME_SUPPORTS_SAVE )
10291034GAME( 1980, phoenixa, phoenix,  phoenix,  phoenixa, 0,        ROT90, "Amstar (Centuri license)", "Phoenix (Centuri, set 1)", GAME_SUPPORTS_SAVE )
10301035GAME( 1980, phoenixb, phoenix,  phoenix,  phoenixa, 0,        ROT90, "Amstar (Centuri license)", "Phoenix (Centuri, set 2)", GAME_SUPPORTS_SAVE )
r3957r3958
10481053GAME( 1981, pleiadce, pleiads,  pleiads,  pleiadce, 0,        ROT90, "Tehkan (Centuri license)", "Pleiads (Centuri)", GAME_IMPERFECT_COLORS )
10491054GAME( 1981, capitol,  pleiads,  phoenix,  capitol,  0,        ROT90, "Universal Video Spiel", "Capitol", GAME_IMPERFECT_COLORS )
10501055
1051GAME( 1982, survival, 0,        survival, survival, survival, ROT90, "Rock-ola", "Survival", GAME_IMPERFECT_COLORS )
1056GAME( 1982, survival, 0,        survival, survival, 0,        ROT90, "Rock-ola", "Survival", GAME_IMPERFECT_COLORS )
src/mame/drivers/markham.c
r3957r3958
99*****************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "sound/sn76496.h"
1314
1415WRITE8_HANDLER( markham_videoram_w );
r3957r3958
206207   MDRV_CPU_PROGRAM_MAP(readmem2,writemem2)
207208   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
208209
209   MDRV_INTERLEAVE(100)
210   MDRV_QUANTUM_TIME(HZ(6000))
210211
211212   /* video hardware */
212213   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/msisaac.c
r3957r3958
7676#if 0
7777static WRITE8_HANDLER( flip_screen_w )
7878{
79   flip_screen_set(data);
79   flip_screen_set(space->machine, data);
8080}
8181
8282static WRITE8_HANDLER( msisaac_coin_counter_w )
src/mame/drivers/superqix.c
r3957r3958
107107***************************************************************************/
108108
109109#include "driver.h"
110#include "cpu/z80/z80.h"
110111#include "deprecat.h"
111112#include "cpu/m6805/m6805.h"
112113#include "cpu/mcs51/mcs51.h"
r3957r3958
242243         coin_lockout_global_w((data & 1) ^ invert_coin_lockout);
243244         break;
244245      case 4:
245         flip_screen_set(data & 1);
246         flip_screen_set(space->machine, data & 1);
246247         break;
247248      case 5:
248249         port1 = data;
r3957r3958
304305
305306static WRITE8_HANDLER( bootleg_flipscreen_w )
306307{
307   flip_screen_set(~data & 1);
308   flip_screen_set(space->machine, ~data & 1);
308309}
309310
310311
r3957r3958
10601061   MDRV_CPU_ADD("mcu", I8751, 12000000/3)   /* ??? */
10611062   MDRV_CPU_IO_MAP(mcu_io_map,0)
10621063
1063   MDRV_INTERLEAVE(500)
1064   MDRV_QUANTUM_TIME(HZ(30000))
10641065
10651066   MDRV_MACHINE_START(superqix)
10661067
src/mame/drivers/dday.c
r3957r3958
5050***************************************************************************/
5151
5252#include "driver.h"
53#include "cpu/z80/z80.h"
5354#include "sound/ay8910.h"
5455
5556extern UINT8 *dday_bgvideoram;
src/mame/drivers/playch10.c
r3957r3958
290290***************************************************************************/
291291
292292#include "driver.h"
293#include "cpu/m6502/m6502.h"
293294#include "video/ppu2c0x.h"
294295#include "cpu/z80/z80.h"
295296#include "machine/rp5h01.h"
src/mame/drivers/cojag.c
r3957r3958
289289
290290
291291#include "driver.h"
292#include "cpu/m68000/m68000.h"
292293#include "cpu/mips/r3000.h"
293294#include "cpu/jaguar/jaguar.h"
294295#include "machine/idectrl.h"
r3957r3958
372373   jaguardsp_ctrl_w(machine->cpu[2], D_CTRL, 0, 0xffffffff);
373374
374375   /* init the sound system */
375   cojag_sound_reset();
376   cojag_sound_reset(machine);
376377
377378   /* reset the IDE controller */
378379   devtag_reset(machine, IDE_CONTROLLER, "ide");
r3957r3958
15041505static void cojag_common_init(running_machine *machine, UINT16 gpu_jump_offs, UINT16 spin_pc)
15051506{
15061507   /* copy over the ROM */
1507   cojag_is_r3000 = (machine->config->cpu[0].type == CPU_R3041BE);
1508   cojag_is_r3000 = (cpu_get_type(machine->cpu[0]) == CPU_R3041BE);
15081509
15091510   /* install synchronization hooks for GPU */
15101511   if (cojag_is_r3000)
src/mame/drivers/cyberbal.c
r3957r3958
2020
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
24#include "cpu/m6502/m6502.h"
2325#include "rendlay.h"
2426#include "machine/atarigen.h"
2527#include "audio/atarijsa.h"
r3957r3958
424426   MDRV_CPU_PROGRAM_MAP(sound_68k_map,0)
425427   MDRV_CPU_PERIODIC_INT(cyberbal_sound_68k_irq_gen, 10000)
426428
427   MDRV_INTERLEAVE(10)
429   MDRV_QUANTUM_TIME(HZ(600))
428430
429431   MDRV_MACHINE_RESET(cyberbal)
430432   MDRV_NVRAM_HANDLER(atarigen)
r3957r3958
971973static DRIVER_INIT( cyberbal )
972974{
973975   atarigen_eeprom_default = default_eeprom;
974   atarigen_slapstic_init(machine, 0, 0x018000, 0, 0);
976   atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 0);
975977}
976978
977979
978980static DRIVER_INIT( cyberbt )
979981{
980982   atarigen_eeprom_default = default_eeprom;
981   atarigen_slapstic_init(machine, 0, 0x018000, 0, 116);
983   atarigen_slapstic_init(machine->cpu[0], 0x018000, 0, 116);
982984}
983985
984986
src/mame/drivers/lockon.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/z80/z80.h"
14#include "cpu/nec/nec.h"
1315#include "sound/2203intf.h"
1416#include "sound/flt_vol.h"
1517#include "lockon.h"
r3957r3958
471473   MDRV_CPU_PROGRAM_MAP(sound_prg, 0)
472474   MDRV_CPU_IO_MAP(sound_io, 0)
473475
474   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_NSEC(PERIOD_OF_555_ASTABLE_NSEC(10000, 4700, 10000e-12) * 4096))
475   MDRV_INTERLEAVE(10)
476   MDRV_WATCHDOG_TIME_INIT(NSEC(PERIOD_OF_555_ASTABLE_NSEC(10000, 4700, 10000e-12) * 4096))
477   MDRV_QUANTUM_TIME(HZ(600))
476478
477479   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
478480
src/mame/drivers/mappy.c
r3957r3958
547547***************************************************************************/
548548
549549#include "driver.h"
550#include "cpu/m6809/m6809.h"
550551#include "machine/namcoio.h"
551552#include "sound/dac.h"
552553#include "sound/namco.h"
r3957r3958
702703   switch (offset & 0x0e)
703704   {
704705      case 0x00:   /* INT ON 2 */
705         cpu_interrupt_enable(1,bit);
706         cpu_interrupt_enable(space->machine->cpu[1],bit);
706707         if (!bit)
707708            cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
708709         break;
709710
710711      case 0x02:   /* INT ON */
711         cpu_interrupt_enable(0,bit);
712         cpu_interrupt_enable(space->machine->cpu[0],bit);
712713         if (!bit)
713714            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
714715         break;
r3957r3958
744745   switch (offset & 0x0e)
745746   {
746747      case 0x00:
747         cpu_interrupt_enable(1,bit);
748         cpu_interrupt_enable(space->machine->cpu[1],bit);
748749         if (!bit)
749750            cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
750751         break;
751752
752753      case 0x02:
753         cpu_interrupt_enable(0,bit);
754         cpu_interrupt_enable(space->machine->cpu[0],bit);
754755         if (!bit)
755756            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
756757         break;
757758
758759      case 0x04:
759         cpu_interrupt_enable(2,bit);
760         cpu_interrupt_enable(space->machine->cpu[2],bit);
760761         if (!bit)
761762            cpu_set_input_line(space->machine->cpu[2], 0, CLEAR_LINE);
762763         break;
r3957r3958
790791   switch (offset & 0x0e)
791792   {
792793      case 0x00:   /* INT ON 2 */
793         cpu_interrupt_enable(1,bit);
794         cpu_interrupt_enable(space->machine->cpu[1],bit);
794795         if (!bit)
795796            cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
796797         break;
797798
798799      case 0x02:   /* INT ON */
799         cpu_interrupt_enable(0,bit);
800         cpu_interrupt_enable(space->machine->cpu[0],bit);
800801         if (!bit)
801802            cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
802803         break;
803804
804805      case 0x04:   /* FLIP */
805         flip_screen_set(bit);
806         flip_screen_set(space->machine, bit);
806807         break;
807808
808809      case 0x06:   /* SOUND ON */
r3957r3958
15831584   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
15841585
15851586   MDRV_WATCHDOG_VBLANK_INIT(8)
1586   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
1587   MDRV_QUANTUM_TIME(HZ(6000))    /* 100 CPU slices per frame - an high value to ensure proper */
15871588                     /* synchronization of the CPUs */
15881589   MDRV_MACHINE_RESET(superpac)
15891590
r3957r3958
16341635   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16351636
16361637   MDRV_WATCHDOG_VBLANK_INIT(8)
1637   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
1638   MDRV_QUANTUM_TIME(HZ(6000))    /* 100 CPU slices per frame - an high value to ensure proper */
16381639                     /* synchronization of the CPUs */
16391640   MDRV_MACHINE_RESET(phozon)
16401641
r3957r3958
16711672   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
16721673
16731674   MDRV_WATCHDOG_VBLANK_INIT(8)
1674   MDRV_INTERLEAVE(100)    /* 100 CPU slices per frame - an high value to ensure proper */
1675   MDRV_QUANTUM_TIME(HZ(6000))    /* 100 CPU slices per frame - an high value to ensure proper */
16751676                     /* synchronization of the CPUs */
16761677   MDRV_MACHINE_RESET(mappy)
16771678
src/mame/drivers/safarir.c
r3957r3958
4545****************************************************************************/
4646
4747#include "driver.h"
48#include "cpu/i8085/i8085.h"
4849
4950
5051static UINT8 *ram_1, *ram_2;
src/mame/drivers/rastan.c
r3957r3958
157157***************************************************************************/
158158
159159#include "driver.h"
160#include "cpu/z80/z80.h"
161#include "cpu/m68000/m68000.h"
160162#include "taitoipt.h"
161163#include "video/taitoic.h"
162164#include "audio/taitosnd.h"
r3957r3958
390392   MDRV_CPU_ADD("audio", Z80, XTAL_16MHz/4)   /* verified on pcb */
391393   MDRV_CPU_PROGRAM_MAP(rastan_s_map,0)
392394
393   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
395   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
394396
395397   /* video hardware */
396398   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/pntnpuzl.c
r3957r3958
121121*/
122122
123123#include "driver.h"
124#include "cpu/m68000/m68000.h"
124125#include "machine/eeprom.h"
125126
126127
src/mame/drivers/gijoe.c
r3957r3958
3737***************************************************************************/
3838
3939#include "driver.h"
40#include "cpu/m68000/m68000.h"
4041#include "video/konamiic.h"
4142#include "cpu/z80/z80.h"
4243#include "machine/eeprom.h"
src/mame/drivers/uapce.c
r3957r3958
2525
2626#include "driver.h"
2727#include "deprecat.h"
28#include "cpu/z80/z80.h"
29#include "cpu/h6280/h6280.h"
30#include "sound/c6280.h"
2831#include "machine/pcecommn.h"
2932#include "video/vdc.h"
30#include "cpu/h6280/h6280.h"
31#include "sound/c6280.h"
3233
3334static UINT8 jamma_if_control_latch = 0;
3435
r3957r3958
9697   return dsw_val & 1;
9798}
9899
99static UINT8 jamma_if_read_joystick( void )
100static UINT8 jamma_if_read_joystick( running_machine *machine )
100101{
101102   if ( jamma_if_control_latch & 0x10 )
102103   {
103      return input_port_read(Machine,  "JOY" );
104      return input_port_read(machine,  "JOY" );
104105   }
105106   else
106107   {
107      return input_port_read(Machine,  "JOY" ) | 0x08;
108      return input_port_read(machine,  "JOY" ) | 0x08;
108109   }
109110}
110111
r3957r3958
187188   MDRV_CPU_ADD("sub", Z80, 1400000)
188189   MDRV_CPU_PROGRAM_MAP(z80_map, 0)
189190
190   MDRV_INTERLEAVE(1)
191   MDRV_QUANTUM_TIME(HZ(60))
191192
192193   MDRV_MACHINE_RESET( uapce )
193194
src/mame/drivers/tigeroad.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
2324#include "cpu/z80/z80.h"
2425#include "sound/2203intf.h"
2526#include "sound/msm5205.h"
src/mame/drivers/looping.c
r3957r3958
5353*/
5454
5555#include "driver.h"
56#include "cpu/tms9900/tms9900.h"
5657#include "sound/ay8910.h"
5758#include "sound/dac.h"
5859#include "sound/5220intf.h"
r3957r3958
192193static WRITE8_HANDLER( flip_screen_x_w )
193194{
194195   looping_state *state = space->machine->driver_data;
195   flip_screen_x_set(~data & 0x01);
196   tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen_get() ? 128 : 0);
196   flip_screen_x_set(space->machine, ~data & 0x01);
197   tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen_get(space->machine) ? 128 : 0);
197198}
198199
199200
200201static WRITE8_HANDLER( flip_screen_y_w )
201202{
202203   looping_state *state = space->machine->driver_data;
203   flip_screen_y_set(~data & 0x01);
204   tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen_get() ? 128 : 0);
204   flip_screen_y_set(space->machine, ~data & 0x01);
205   tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen_get(space->machine) ? 128 : 0);
205206}
206207
207208
r3957r3958
256257      int code  = source[1] & 0x3f;
257258      int color = source[2];
258259
259      if (flip_screen_x_get())
260      if (flip_screen_x_get(machine))
260261      {
261262         sx = 240 - sx;
262263         flipx = !flipx;
263264      }
264265
265      if (flip_screen_y_get())
266      if (flip_screen_y_get(machine))
266267      {
267268         sy = 240 - sy;
268269         flipy = !flipy;
src/mame/drivers/segas32.c
r3957r3958
292292***************************************************************************/
293293
294294#include "driver.h"
295#include "cpu/z80/z80.h"
296#include "cpu/v60/v60.h"
297#include "cpu/nec/nec.h"
295298#include "rendlay.h"
296299#include "segas32.h"
297300#include "machine/eeprom.h"
src/mame/drivers/1945kiii.c
r3957r3958
5454*/
5555
5656#include "driver.h"
57#include "cpu/m68000/m68000.h"
5758#include "sound/okim6295.h"
5859
5960static UINT16* k3_spriteram_1;
src/mame/drivers/badlands.c
r3957r3958
9393
9494
9595#include "driver.h"
96#include "cpu/z80/z80.h"
97#include "cpu/m68000/m68000.h"
98#include "cpu/m6502/m6502.h"
9699#include "machine/atarigen.h"
97100#include "badlands.h"
98101#include "sound/2151intf.h"
src/mame/drivers/slapfght.c
r3957r3958
399399***************************************************************************/
400400
401401#include "driver.h"
402#include "cpu/z80/z80.h"
402403#include "deprecat.h"
403404#include "cpu/m6805/m6805.h"
404405#include "sound/ay8910.h"
r3957r3958
932933   MDRV_CPU_PROGRAM_MAP(perfrman_sound_readmem,perfrman_sound_writemem)
933934   MDRV_CPU_VBLANK_INT_HACK(getstar_interrupt,4)   /* music speed, verified */
934935
935   MDRV_INTERLEAVE(10)      /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
936   MDRV_QUANTUM_TIME(HZ(600))      /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
936937
937938   MDRV_MACHINE_RESET(slapfight)
938939
r3957r3958
979980   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
980981   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,6)    /* ??? */
981982
982   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
983   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
983984
984985   MDRV_MACHINE_RESET(slapfight)
985986
r3957r3958
10281029   MDRV_CPU_ADD("mcu", M68705,XTAL_36MHz/12) /* verified on pcb */
10291030   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
10301031
1031   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1032   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
10321033
10331034   MDRV_MACHINE_RESET(slapfight)
10341035
r3957r3958
10751076   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
10761077   MDRV_CPU_VBLANK_INT_HACK(getstar_interrupt, 3)
10771078
1078   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
1079   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - enough for the sound CPU to read all commands */
10791080
10801081   MDRV_MACHINE_RESET(slapfight)
10811082
src/mame/drivers/astinvad.c
r3957r3958
1717***************************************************************************/
1818
1919#include "driver.h"
20#include "cpu/z80/z80.h"
2021#include "machine/8255ppi.h"
2122#include "sound/samples.h"
2223
src/mame/drivers/psikyosh.c
r3957r3958
11391139
11401140static DRIVER_INIT( soldivid )
11411141{
1142   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1142   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11431143   use_factory_eeprom=eeprom_0;
11441144}
11451145
11461146static DRIVER_INIT( s1945ii )
11471147{
1148   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1148   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11491149   use_factory_eeprom=eeprom_DEFAULT;
11501150}
11511151
r3957r3958
11531153{
11541154   UINT8 *RAM = memory_region(machine, "main");
11551155   memory_set_bankptr(machine, 1,&RAM[0x100000]);
1156   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1156   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11571157   use_factory_eeprom=eeprom_DARAKU;
11581158}
11591159
11601160static DRIVER_INIT( sbomberb )
11611161{
1162   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1162   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11631163   use_factory_eeprom=eeprom_DEFAULT;
11641164}
11651165
r3957r3958
11671167{
11681168   UINT8 *RAM = memory_region(machine, "main");
11691169   memory_set_bankptr(machine, 1,&RAM[0x100000]);
1170   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1170   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11711171   use_factory_eeprom=eeprom_DEFAULT;
11721172}
11731173
r3957r3958
11751175{
11761176   UINT8 *RAM = memory_region(machine, "main");
11771177   memory_set_bankptr(machine, 1,&RAM[0x100000]);
1178   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1178   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11791179   use_factory_eeprom=eeprom_S1945III;
11801180}
11811181
11821182static DRIVER_INIT( dragnblz )
11831183{
1184   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1184   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11851185   use_factory_eeprom=eeprom_DRAGNBLZ;
11861186}
11871187
11881188static DRIVER_INIT( gnbarich )
11891189{
1190   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1190   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11911191   use_factory_eeprom=eeprom_GNBARICH;
11921192}
11931193
11941194static DRIVER_INIT( mjgtaste )
11951195{
1196   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1196   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
11971197   use_factory_eeprom=eeprom_MJGTASTE;
11981198   /* needs to install mahjong controls too (can select joystick in test mode tho) */
11991199}
src/mame/drivers/quizdna.c
r3957r3958
99*****************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "sound/2203intf.h"
1314#include "sound/okim6295.h"
1415
src/mame/drivers/supertnk.c
r3957r3958
9696
9797
9898#include "driver.h"
99#include "cpu/tms9900/tms9900.h"
99100#include "sound/ay8910.h"
100101
101102
src/mame/drivers/darkhors.c
r3957r3958
5555***************************************************************************/
5656
5757#include "driver.h"
58#include "cpu/m68000/m68000.h"
5859#include "deprecat.h"
5960#include "machine/eeprom.h"
6061#include "sound/okim6295.h"
src/mame/drivers/offtwall.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "offtwall.h"
src/mame/drivers/upscope.c
r3957r3958
2424**********************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/m68000/m68000.h"
2728#include "includes/amiga.h"
2829#include "machine/6526cia.h"
2930
r3957r3958
5859 *
5960 *************************************/
6061
61static void upscope_reset(void)
62static void upscope_reset(running_machine *machine)
6263{
6364   prev_cia1_porta = 0xff;
6465}
r3957r3958
289290static const cia6526_interface cia_0_intf =
290291{
291292   amiga_cia_0_irq,                              /* irq_func */
292   AMIGA_68000_NTSC_CLOCK / 10,                     /* clock */
293293   0,                                          /* tod_clock */
294294   {
295295      { NULL, upscope_cia_0_porta_w },               /* port A */
r3957r3958
300300static const cia6526_interface cia_1_intf =
301301{
302302   amiga_cia_1_irq,                              /* irq_func */
303   AMIGA_68000_NTSC_CLOCK / 10,                     /* clock */
304303   0,                                          /* tod_clock */
305304   {
306305      { upscope_cia_1_porta_r, upscope_cia_1_porta_w, },   /* port A */
r3957r3958
344343   MDRV_SOUND_ROUTE(3, "right", 0.50)
345344
346345   /* cia */
347   MDRV_DEVICE_ADD("cia_0", CIA8520)
348   MDRV_DEVICE_CONFIG(cia_0_intf)
349   MDRV_DEVICE_ADD("cia_1", CIA8520)
350   MDRV_DEVICE_CONFIG(cia_1_intf)
346   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_intf)
347   MDRV_CIA8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK / 10, cia_1_intf)
351348MACHINE_DRIVER_END
352349
353350
src/mame/drivers/equites.c
r3957r3958
364364// Directives
365365
366366#include "driver.h"
367#include "cpu/m68000/m68000.h"
368#include "cpu/alph8201/alph8201.h"
367369#include "deprecat.h"
368370#include "cpu/i8085/i8085.h"
369371#include "sound/ay8910.h"
r3957r3958
396398
397399static MACHINE_RESET(equites)
398400{
399   flip_screen_set(0);
401   flip_screen_set(machine, 0);
400402}
401403
402404/******************************************************************************/
src/mame/drivers/esh.c
r3957r3958
2323*/
2424
2525#include "driver.h"
26#include "cpu/z80/z80.h"
2627#include "machine/laserdsc.h"
2728
2829/* From daphne */
src/mame/drivers/neodrvr.c
r3957r3958
77077707GAME( 2000, kof2000,  neogeo,   neogeo,   neogeo,   kof2000,  ROT0, "SNK", "The King of Fighters 2000" , 0 ) /* Encrypted Code & GFX */
77087708GAME( 2000, kof2000n, kof2000,  neogeo,   neogeo,   kof2000n, ROT0, "SNK", "The King of Fighters 2000 (not encrypted)" , 0 ) /* Encrypted GFX */
77097709GAME( 2001, zupapa,   neogeo,   neogeo,   neogeo,   zupapa,   ROT0, "SNK", "Zupapa!" , 0 )   /* Encrypted GFX */
7710GAME( 2001, sengoku3, neogeo,   neogeo,   neogeo,   sengoku3, ROT0, "SNK", "Sengoku 3" , 0 )   /* Encrypted GFX */
7710GAME( 2001, sengoku3, neogeo,   neogeo,   neogeo,   sengoku3, ROT0, "Noise Factory / SNK", "Sengoku 3" , 0 )   /* Encrypted GFX */
77117711GAME( 2001, kof2001,  neogeo,   neogeo,   neogeo,   kof2001,  ROT0, "Eolith / SNK", "The King of Fighters 2001 (set 1)" , 0 ) /* Encrypted GFX */
77127712GAME( 2001, kof2001h, kof2001,  neogeo,   neogeo,   kof2001,  ROT0, "Eolith / SNK", "The King of Fighters 2001 (set 2)" , 0 ) /* Encrypted GFX */
77137713GAME( 2003, cthd2003, kof2001,  neogeo,   neogeo,   cthd2003, ROT0, "bootleg", "Crouching Tiger Hidden Dragon 2003 (The King of Fighters 2001 bootleg)", 0 ) /* Protected Hack / Bootleg of kof2001 */
src/mame/drivers/mirax.c
r3957r3958
6161*/
6262
6363#include "driver.h"
64#include "cpu/z80/z80.h"
6465#include "deprecat.h"
6566#include "sound/ay8910.h"
6667
src/mame/drivers/gradius3.c
r3957r3958
349349   MDRV_CPU_ADD("audio", Z80, 3579545)
350350   MDRV_CPU_PROGRAM_MAP(gradius3_s_map,0)
351351
352   MDRV_INTERLEAVE(100)
352   MDRV_QUANTUM_TIME(HZ(6000))
353353
354354   MDRV_MACHINE_RESET(gradius3)
355355
src/mame/drivers/omegrace.c
r3957r3958
217217***************************************************************************/
218218
219219#include "driver.h"
220#include "cpu/z80/z80.h"
220221#include "video/vector.h"
221222#include "video/avgdvg.h"
222223#include "sound/ay8910.h"
src/mame/drivers/decocass.c
r3957r3958
5353 ***********************************************************************/
5454
5555#include "driver.h"
56#include "cpu/m6502/m6502.h"
57#include "cpu/i8x41/i8x41.h"
5658#include "machine/decocass.h"
5759#include "sound/ay8910.h"
5860
r3957r3958
388390   MDRV_CPU_ADD("mcu", I8041,500000*15) /* 500 kHz ( I doubt it is 400kHz Al! )*/
389391   MDRV_CPU_IO_MAP(decocass_mcu_portmap,0)
390392
391   MDRV_INTERLEAVE(70)            /* interleave CPUs */
393   MDRV_QUANTUM_TIME(HZ(4200))            /* interleave CPUs */
392394
393395   MDRV_MACHINE_RESET(decocass)
394396
src/mame/drivers/mystwarr.c
r3957r3958
942942   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
943943   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 480)
944944
945   MDRV_INTERLEAVE(32)
945   MDRV_QUANTUM_TIME(HZ(1920))
946946
947947   MDRV_NVRAM_HANDLER(mystwarr)
948948   MDRV_MACHINE_START(mystwarr)
src/mame/drivers/dlair.c
r3957r3958
3333*************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/z80/z80.h"
3637#include "render.h"
3738#include "cpu/z80/z80daisy.h"
3839#include "machine/laserdsc.h"
r3957r3958
106107
107108static const z80ctc_interface ctc_intf =
108109{
109   "main",            /* clock comes from main CPU's clock */
110   0,                  /* clock (filled in from the CPU clock) */
111110   0,                 /* timer disables */
112111   dleuro_interrupt,     /* interrupt handler */
113112   0,               /* ZC/TO0 callback */
r3957r3958
118117
119118static const z80sio_interface sio_intf =
120119{
121   "main",            /* clock comes from main CPU's clock */
122   0,                  /* clock (filled in from the CPU clock) */
123120   dleuro_interrupt,   /* interrupt handler */
124121   0,               /* DTR changed handler */
125122   0,               /* RTS changed handler */
r3957r3958
743740   MDRV_CPU_IO_MAP(dleuro_io_map,0)
744741   MDRV_CPU_VBLANK_INT("main", vblank_callback)
745742
746   MDRV_Z80CTC_ADD("ctc", ctc_intf)
747   MDRV_Z80SIO_ADD("sio", sio_intf)
743   MDRV_Z80CTC_ADD("ctc", MASTER_CLOCK_EURO/4 /* same as "main" */, ctc_intf)
744   MDRV_Z80SIO_ADD("sio", MASTER_CLOCK_EURO/4 /* same as "main" */, sio_intf)
748745
749   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ(MASTER_CLOCK_EURO/(16*16*16*16*16*8)))
746   MDRV_WATCHDOG_TIME_INIT(HZ(MASTER_CLOCK_EURO/(16*16*16*16*16*8)))
750747
751748   MDRV_MACHINE_START(dlair)
752749   MDRV_MACHINE_RESET(dlair)
src/mame/drivers/jollyjgr.c
r3957r3958
9898*/
9999
100100#include "driver.h"
101#include "cpu/z80/z80.h"
101102#include "sound/ay8910.h"
102103
103104static tilemap *bg_tilemap;
src/mame/drivers/skykid.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/m6809/m6809.h"
1718#include "cpu/m6800/m6800.h"
1819#include "sound/namco.h"
1920
r3957r3958
9091static WRITE8_HANDLER( skykid_irq_1_ctrl_w )
9192{
9293   int bit = !BIT(offset,11);
93   cpu_interrupt_enable(0,bit);
94   cpu_interrupt_enable(space->machine->cpu[0],bit);
9495   if (!bit)
9596      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
9697}
r3957r3958
9899static WRITE8_HANDLER( skykid_irq_2_ctrl_w )
99100{
100101   int bit = !BIT(offset,13);
101   cpu_interrupt_enable(1,bit);
102   cpu_interrupt_enable(space->machine->cpu[1],bit);
102103   if (!bit)
103104      cpu_set_input_line(space->machine->cpu[1], 0, CLEAR_LINE);
104105}
r3957r3958
459460   MDRV_CPU_IO_MAP(mcu_port_map,0)
460461   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
461462
462   MDRV_INTERLEAVE(100)   /* we need heavy synch */
463   MDRV_QUANTUM_TIME(HZ(6000))   /* we need heavy synch */
463464
464465   MDRV_MACHINE_START(skykid)
465466
src/mame/drivers/klax.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "klax.h"
2324#include "sound/okim6295.h"
src/mame/drivers/tarzan.c
r3957r3958
33/* CPU might not be z80 */
44
55#include "driver.h"
6#include "cpu/z80/z80.h"
67
78#if 0
89static UINT16 *file1_data;
src/mame/drivers/quizpani.c
r3957r3958
3333*************************************************************************/
3434
3535#include "driver.h"
36#include "cpu/m68000/m68000.h"
3637#include "machine/nmk112.h"
3738#include "sound/okim6295.h"
3839
src/mame/drivers/halleys.c
r3957r3958
158158// Compiler Directives
159159
160160#include "driver.h"
161#include "cpu/z80/z80.h"
161162#include "taitoipt.h"
162163#include "deprecat.h"
163164#include "cpu/m6809/m6809.h"
src/mame/drivers/ssfindo.c
r3957r3958
121121*/
122122
123123#include "driver.h"
124#include "cpu/arm7/arm7.h"
124125#include "cpu/arm7/arm7core.h"
125126
126127enum
src/mame/drivers/firetrk.c
r3957r3958
66
77
88#include "driver.h"
9#include "cpu/m6800/m6800.h"
910#include "firetrk.h"
1011#include "sound/discrete.h"
1112
src/mame/drivers/m57.c
r3957r3958
4848****************************************************************************/
4949
5050#include "driver.h"
51#include "cpu/z80/z80.h"
5152#include "iremipt.h"
5253#include "m57.h"
5354#include "audio/irem.h"
src/mame/drivers/peplus.c
r3957r3958
217217static const mc6845_interface mc6845_intf =
218218{
219219   "main",               /* screen we are acting on */
220   MC6845_CLOCK,         /* the clock (pin 21) of the chip */
221220   8,                  /* number of pixels per video memory address */
222221   NULL,               /* before pixel update callback */
223222   NULL,               /* row update callback */
r3957r3958
426425
427426static WRITE8_HANDLER(i2c_nvram_w)
428427{
429   i2cmem_write(0, I2CMEM_SCL, BIT(data, 2));
428   i2cmem_write(space->machine, 0, I2CMEM_SCL, BIT(data, 2));
430429   sda_dir = BIT(data, 1);
431   i2cmem_write(0, I2CMEM_SDA, BIT(data, 0));
430   i2cmem_write(space->machine, 0, I2CMEM_SDA, BIT(data, 0));
432431}
433432
434433
r3957r3958
518517   UINT8 sda = 0;
519518   if(!sda_dir)
520519   {
521      sda = i2cmem_read(0, I2CMEM_SDA);
520      sda = i2cmem_read(space->machine, 0, I2CMEM_SDA);
522521   }
523522
524523   if ((input_port_read_safe(space->machine, "SENSOR",0x00) & 0x01) == 0x01 && coin_state == 0) {
r3957r3958
10061005   MDRV_GFXDECODE(peplus)
10071006   MDRV_PALETTE_LENGTH(16*16)
10081007
1009   MDRV_DEVICE_ADD("crtc", R6545_1)
1010   MDRV_DEVICE_CONFIG(mc6845_intf)
1008   MDRV_MC6845_ADD("crtc", R6545_1, MC6845_CLOCK, mc6845_intf)
10111009
10121010   MDRV_PALETTE_INIT(peplus)
10131011   MDRV_VIDEO_START(peplus)
src/mame/drivers/segas24.c
r3957r3958
347347
348348UINT16* s24_mainram1;
349349
350extern void s24_fd1094_machine_init(void);
350extern void s24_fd1094_machine_init(running_machine *machine);
351351extern void s24_fd1094_driver_init(running_machine *machine);
352352
353353VIDEO_START(system24);
r3957r3958
697697         cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, PULSE_LINE);
698698//          mame_printf_debug("enable 2nd cpu!\n");
699699//          debugger_break(machine);
700         s24_fd1094_machine_init();
700         s24_fd1094_machine_init(machine);
701701
702702      } else
703703         cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
r3957r3958
18121812   MDRV_CPU_ADD("sub", M68000, MASTER_CLOCK/2)
18131813   MDRV_CPU_PROGRAM_MAP(system24_cpu2_map, 0)
18141814
1815   MDRV_INTERLEAVE(100)
1815   MDRV_QUANTUM_TIME(HZ(6000))
18161816
18171817   MDRV_MACHINE_START(system24)
18181818   MDRV_MACHINE_RESET(system24)
src/mame/drivers/mustache.c
r3957r3958
2828
2929***************************************************************************/
3030#include "driver.h"
31#include "cpu/z80/z80.h"
3132#include "audio/seibu.h"   // for seibu_sound_decrypt on the MAIN cpu (not sound)
3233#include "audio/t5182.h"
3334
src/mame/drivers/ddayjlc.c
r3957r3958
5252*/
5353
5454#include "driver.h"
55#include "cpu/z80/z80.h"
5556#include "sound/ay8910.h"
5657
5758static INT32 char_bank = 0;
r3957r3958
408409   MDRV_CPU_PROGRAM_MAP(sound_cpu,0)
409410   MDRV_CPU_VBLANK_INT("main", ddayjlc_snd_interrupt)
410411
411   MDRV_INTERLEAVE(100)
412   MDRV_QUANTUM_TIME(HZ(6000))
412413
413414   /* video hardware */
414415   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/segas16a.c
r3957r3958
144144*/
145145
146146#include "driver.h"
147#include "cpu/z80/z80.h"
148#include "cpu/m68000/m68000.h"
149#include "cpu/mcs51/mcs51.h"
147150#include "system16.h"
148151#include "machine/8255ppi.h"
149152#include "machine/fd1089.h"
src/mame/drivers/neogeo.c
r3957r3958
8080****************************************************************************/
8181
8282#include "driver.h"
83#include "cpu/m68000/m68000.h"
8384#include "neogeo.h"
8485#include "machine/pd4990a.h"
8586#include "cpu/z80/z80.h"
r3957r3958
10111012   /* reset system control registers */
10121013   for (offs = 0; offs < 8; offs++)
10131014      system_control_w(space, offs, 0, 0x00ff);
1014   cpu_reset(machine->cpu[0]);
1015   device_reset(machine->cpu[0]);
10151016
10161017   neogeo_reset_rng();
10171018
r3957r3958
12341235   MDRV_CPU_PROGRAM_MAP(audio_map,0)
12351236   MDRV_CPU_IO_MAP(auido_io_map,0)
12361237
1237   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_USEC(128762))
1238   MDRV_WATCHDOG_TIME_INIT(USEC(128762))
12381239
12391240   MDRV_MACHINE_START(neogeo)
12401241   MDRV_MACHINE_RESET(neogeo)
src/mame/drivers/snookr10.c
r3957r3958
362362#define MASTER_CLOCK   XTAL_16MHz
363363
364364#include "driver.h"
365#include "cpu/m6502/m6502.h"
365366#include "sound/okim6295.h"
366367#include "snookr10.lh"
367368
src/mame/drivers/konamigx.c
r3957r3958
847847
848848static READ32_HANDLER( adc0834_r )
849849{
850   return adc083x_do_read( 0 ) << 24;
850   return adc083x_do_read( space->machine, 0 ) << 24;
851851}
852852
853853static WRITE32_HANDLER( adc0834_w )
854854{
855   adc083x_clk_write( 0, ( data >> 24 ) & 1 );
856   adc083x_di_write( 0, ( data >> 25 ) & 1 );
857   adc083x_cs_write( 0, ( data >> 26 ) & 1 );
855   running_machine *machine = space->machine;
856   adc083x_clk_write( machine, 0, ( data >> 24 ) & 1 );
857   adc083x_di_write( machine, 0, ( data >> 25 ) & 1 );
858   adc083x_cs_write( machine, 0, ( data >> 26 ) & 1 );
858859}
859860
860static double adc0834_callback( int input )
861static double adc0834_callback( running_machine *machine, int input )
861862{
862863   switch( input )
863864   {
864865   case ADC083X_CH0:
865      return ( (double)5 * input_port_read(Machine,  "AN0" ) ) / 255; // steer
866      return ( (double)5 * input_port_read(machine,  "AN0" ) ) / 255; // steer
866867   case ADC083X_CH1:
867      return ( (double)5 * input_port_read(Machine,  "AN1" ) ) / 255; // gas
868      return ( (double)5 * input_port_read(machine,  "AN1" ) ) / 255; // gas
868869   case ADC083X_VREF:
869870      return 5;
870871   }
r3957r3958
13091310   MDRV_CPU_PROGRAM_MAP(gxsndmap, 0)
13101311   MDRV_CPU_PERIODIC_INT(irq2_line_hold, 480)
13111312
1312   MDRV_INTERLEAVE(32)
1313   MDRV_QUANTUM_TIME(HZ(1920))
13131314
13141315   MDRV_MACHINE_START(konamigx)
13151316   MDRV_MACHINE_RESET(konamigx)
src/mame/drivers/segahang.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
18#include "cpu/mcs51/mcs51.h"
1719#include "deprecat.h"
1820#include "system16.h"
1921#include "machine/segaic16.h"
r3957r3958
880882   MDRV_CPU_PROGRAM_MAP(sub_map,0)
881883
882884   MDRV_MACHINE_RESET(hangon)
883   MDRV_INTERLEAVE(100)
885   MDRV_QUANTUM_TIME(HZ(6000))
884886
885887   MDRV_PPI8255_ADD( "ppi8255_0", hangon_ppi_intf[0] )
886888   MDRV_PPI8255_ADD( "ppi8255_1", hangon_ppi_intf[1] )
src/mame/drivers/sprcros2.c
r3957r3958
5555*/
5656
5757#include "driver.h"
58#include "cpu/z80/z80.h"
5859#include "deprecat.h"
5960#include "sound/sn76496.h"
6061
src/mame/drivers/statriv2.c
r3957r3958
620620
621621static INTERRUPT_GEN( statriv2_interrupt )
622622{
623   cpu_set_input_line(device, I8085_RST75_LINE, HOLD_LINE);
623   cpu_set_input_line(device, I8085_RST75_LINE, ASSERT_LINE);
624   cpu_set_input_line(device, I8085_RST75_LINE, CLEAR_LINE);
624625}
625626
626627static MACHINE_DRIVER_START( statriv2 )
src/mame/drivers/carrera.c
r3957r3958
4242#define MASTER_CLOCK 22118400
4343
4444#include "driver.h"
45#include "cpu/z80/z80.h"
4546#include "sound/ay8910.h"
4647#include "video/mc6845.h"
4748
r3957r3958
304305
305306   MDRV_VIDEO_UPDATE(carrera)
306307
307   MDRV_DEVICE_ADD("crtc", MC6845)
308   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
308309
309310   /* sound hardware */
310311   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/dorachan.c
r3957r3958
99*/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "deprecat.h"
1314
1415
src/mame/drivers/thunderj.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "audio/atarijsa.h"
2324#include "thunderj.h"
r3957r3958
324325
325326   MDRV_MACHINE_RESET(thunderj)
326327   MDRV_NVRAM_HANDLER(atarigen)
327   MDRV_INTERLEAVE(100)
328   MDRV_QUANTUM_TIME(HZ(6000))
328329
329330   /* video hardware */
330331   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
src/mame/drivers/ultraman.c
r3957r3958
253253   MDRV_CPU_PROGRAM_MAP(sound_map,0)
254254   MDRV_CPU_IO_MAP(sound_io_map,0)
255255
256   MDRV_INTERLEAVE(10)
256   MDRV_QUANTUM_TIME(HZ(600))
257257
258258   /* video hardware */
259259   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/parodius.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1112#include "video/konamiic.h"
1213#include "sound/2151intf.h"
src/mame/drivers/ladybug.c
r3957r3958
5959 */
6060
6161#include "driver.h"
62#include "cpu/z80/z80.h"
6263#include "sound/sn76496.h"
6364
6465
src/mame/drivers/quantum.c
r3957r3958
4444***************************************************************************/
4545
4646#include "driver.h"
47#include "cpu/m68000/m68000.h"
4748#include "video/vector.h"
4849#include "video/avgdvg.h"
4950#include "sound/pokey.h"
src/mame/drivers/combatsc.c
r3957r3958
122122***************************************************************************/
123123
124124#include "driver.h"
125#include "cpu/hd6309/hd6309.h"
125126#include "cpu/z80/z80.h"
126127#include "sound/2203intf.h"
127128#include "sound/upd7759.h"
r3957r3958
582583   MDRV_CPU_ADD("audio", Z80,3579545)   /* 3.579545 MHz */
583584   MDRV_CPU_PROGRAM_MAP(combasc_readmem_sound,combasc_writemem_sound)
584585
585   MDRV_INTERLEAVE(20)
586   MDRV_QUANTUM_TIME(HZ(1200))
586587
587588   MDRV_MACHINE_RESET(combasc)
588589
r3957r3958
623624   MDRV_CPU_ADD("audio", Z80,3579545)   /* 3.579545 MHz */
624625   MDRV_CPU_PROGRAM_MAP(combasc_readmem_sound,combasc_writemem_sound) /* FAKE */
625626
626   MDRV_INTERLEAVE(20)
627   MDRV_QUANTUM_TIME(HZ(1200))
627628
628629   MDRV_MACHINE_RESET(combasc)
629630
src/mame/drivers/quizpun2.c
r3957r3958
3939***************************************************************************/
4040
4141#include "driver.h"
42#include "cpu/z80/z80.h"
4243#include "sound/2203intf.h"
4344
4445#define VERBOSE_PROTECTION_LOG 0
src/mame/drivers/stvinit.c
r3957r3958
119119void install_stvbios_speedups(running_machine *machine)
120120{
121121   // flushes 0 & 1 on both CPUs are for the BIOS speedups
122   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
123   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
124   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
125   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
122   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
123   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
124   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
125   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
126126
127   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
128   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
129   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
130   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
127   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
128   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
129   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
130   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
131131}
132132
133133DRIVER_INIT(shienryu)
r3957r3958
136136   stv_default_eeprom_length = sizeof(shienryu_default_eeprom);
137137
138138   // master
139   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
140   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c6);
139   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
140   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c6);
141141   // slave
142   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
143   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600440e);
142   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
143   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600440e);
144144
145145   DRIVER_INIT_CALL(stv);
146146}
r3957r3958
155155    (loops for 263473 instructions)
156156*/
157157   // master
158   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
159   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018640);
158   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
159   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018640);
160160   // slave
161   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
162   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018c6e);
161   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
162   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018c6e);
163163
164164   DRIVER_INIT_CALL(stv);
165165
r3957r3958
187187
188188   (loops for 288688 instructions)
189189*/
190   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
191   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6010160);
190   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
191   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6010160);
192192
193193   DRIVER_INIT_CALL(stv);
194194}
r3957r3958
214214
215215DRIVER_INIT(puyosun)
216216{
217   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
218   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6021cf0);
217   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
218   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6021cf0);
219219
220   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
221   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60236fe);
220   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
221   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60236fe);
222222
223223   DRIVER_INIT_CALL(stv);
224224
r3957r3958
238238
239239DRIVER_INIT(mausuke)
240240{
241   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
242   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60461A0);
241   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
242   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60461A0);
243243
244244   DRIVER_INIT_CALL(stv);
245245
r3957r3958
249249
250250DRIVER_INIT(cottonbm)
251251{
252//  cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
253//  cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6030ee2);
254//  cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
255//  cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6032b52);
252//  device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
253//  device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6030ee2);
254//  device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
255//  device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6032b52);
256256
257257   DRIVER_INIT_CALL(stv);
258258
r3957r3958
261261
262262DRIVER_INIT(cotton2)
263263{
264   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
265   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6031c7a);
266   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
267   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60338ea);
264   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
265   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6031c7a);
266   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
267   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60338ea);
268268
269269   DRIVER_INIT_CALL(stv);
270270
r3957r3958
274274DRIVER_INIT(dnmtdeka)
275275{
276276   // install all 3 speedups on both master and slave
277   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
278   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
279   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
280   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
281   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
282   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
277   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
278   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
279   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
280   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
281   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
282   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
283283
284   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
285   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
286   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
287   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
288   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
289   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
284   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
285   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
286   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
287   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
288   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
289   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
290290
291291   DRIVER_INIT_CALL(stv);
292292}
r3957r3958
294294DRIVER_INIT(diehard)
295295{
296296   // install all 3 speedups on both master and slave
297   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
298   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
299   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
300   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
301   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
302   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
297   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
298   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
299   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
300   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
301   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
302   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
303303
304   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
305   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
306   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
307   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
308   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
309   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
304   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
305   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
306   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
307   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
308   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
309   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
310310
311311   DRIVER_INIT_CALL(stv);
312312}
313313
314314DRIVER_INIT(fhboxers)
315315{
316   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
317   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c2);
318   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
319   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600bb0a);
320   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
321   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600b31e);
316   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
317   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c2);
318   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
319   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600bb0a);
320   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
321   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600b31e);
322322
323323   DRIVER_INIT_CALL(stv);
324324}
r3957r3958
342342
343343DRIVER_INIT( groovef )
344344{
345   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
346   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e7c);
347   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
348   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e86);
349   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
350   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a4970);
345   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
346   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e7c);
347   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
348   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e86);
349   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
350   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a4970);
351351
352   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
353   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60060c2);
352   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
353   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60060c2);
354354
355355   /* prevent game from hanging on startup -- todo: remove these hacks */
356356   memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ca6cc, 0x60ca6cf, 0, 0, groovef_hack2_r );
r3957r3958
399399
400400DRIVER_INIT( danchih )
401401{
402   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
403   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028b28);
404   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
405   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028c8e);
406   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
407   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602ae26);
402   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
403   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028b28);
404   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
405   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028c8e);
406   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
407   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602ae26);
408408
409409   /* prevent game from hanging on title screen -- todo: remove these hacks */
410410   memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x60ffcbc, 0x60ffcbf, 0, 0, danchih_hack_r );
r3957r3958
445445
446446DRIVER_INIT( astrass )
447447{
448   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
449   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60011b8);
450   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
451   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605b9da);
448   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
449   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60011b8);
450   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
451   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605b9da);
452452
453453   memory_install_read32_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x06000770, 0x06000773, 0, 0, astrass_hack_r );
454454
r3957r3958
459459
460460DRIVER_INIT(thunt)
461461{
462   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
463   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602A024);
464   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
465   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013EEA);
466   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
467   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602AAF8);
462   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
463   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602A024);
464   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
465   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013EEA);
466   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
467   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602AAF8);
468468
469469   DRIVER_INIT_CALL(stv);
470470
r3957r3958
473473
474474DRIVER_INIT(sandor)
475475{
476   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
477   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602a0f8);
478   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
479   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013fbe);
480   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
481   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602abcc);
476   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
477   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602a0f8);
478   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
479   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013fbe);
480   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
481   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602abcc);
482482
483483   DRIVER_INIT_CALL(stv);
484484   minit_boost_timeslice = sinit_boost_timeslice = ATTOTIME_IN_USEC(1);
r3957r3958
487487
488488DRIVER_INIT(grdforce)
489489{
490   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
491   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6041e32);
492   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
493   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6043aa2);
490   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
491   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6041e32);
492   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
493   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6043aa2);
494494
495495   DRIVER_INIT_CALL(stv);
496496
r3957r3958
499499
500500DRIVER_INIT(batmanfr)
501501{
502   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
503   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60121c0);
504   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
505   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60125bc);
502   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
503   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60121c0);
504   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
505   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60125bc);
506506
507507   DRIVER_INIT_CALL(stv);
508508
r3957r3958
512512
513513DRIVER_INIT(colmns97)
514514{
515   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
516   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60298a2);
515   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
516   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60298a2);
517517
518518   DRIVER_INIT_CALL(stv);
519519
r3957r3958
523523
524524DRIVER_INIT(winterht)
525525{
526   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
527   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6098aea);
528   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
529   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x609ae4e);
526   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
527   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6098aea);
528   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
529   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x609ae4e);
530530
531531   DRIVER_INIT_CALL(stv);
532532
r3957r3958
535535
536536DRIVER_INIT(seabass)
537537{
538   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
539   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602cbfa);
540   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
541   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60321ee);
538   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
539   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602cbfa);
540   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
541   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60321ee);
542542
543543   DRIVER_INIT_CALL(stv);
544544
r3957r3958
547547
548548DRIVER_INIT(vfremix)
549549{
550   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
551   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602c30c);
552   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
553   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604c332);
550   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
551   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602c30c);
552   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
553   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604c332);
554554
555555   DRIVER_INIT_CALL(stv);
556556
r3957r3958
559559
560560DRIVER_INIT(sss)
561561{
562   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
563   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6026398);
564   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
565   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028cd6);
562   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
563   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6026398);
564   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
565   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028cd6);
566566
567567   install_standard_protection(machine);
568568
r3957r3958
573573
574574DRIVER_INIT(othellos)
575575{
576   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
577   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602bcbe);
578   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
579   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602d92e);
576   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
577   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602bcbe);
578   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
579   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602d92e);
580580
581581   DRIVER_INIT_CALL(stv);
582582
r3957r3958
586586
587587DRIVER_INIT(sasissu)
588588{
589   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
590   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60710be);
589   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
590   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60710be);
591591
592592   DRIVER_INIT_CALL(stv);
593593
r3957r3958
596596
597597DRIVER_INIT(gaxeduel)
598598{
599   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
600   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ee4);
599   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
600   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ee4);
601601
602602   DRIVER_INIT_CALL(stv);
603603}
604604
605605DRIVER_INIT(suikoenb)
606606{
607   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
608   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013f7a);
607   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
608   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013f7a);
609609
610610   DRIVER_INIT_CALL(stv);
611611}
r3957r3958
620620
621621DRIVER_INIT(znpwfv)
622622{
623   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
624   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ec2);
625   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
626   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60175a6);
623   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
624   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ec2);
625   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
626   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60175a6);
627627
628628   DRIVER_INIT_CALL(stv);
629629   minit_boost_timeslice = sinit_boost_timeslice = ATTOTIME_IN_NSEC(500);
r3957r3958
631631
632632DRIVER_INIT(twcup98)
633633{
634   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
635   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605edde);
636   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
637   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
634   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
635   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605edde);
636   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
637   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
638638
639639   DRIVER_INIT_CALL(stv);
640640   install_standard_protection(machine);
r3957r3958
644644
645645DRIVER_INIT(smleague)
646646{
647   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
648   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6063bf4);
649   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
650   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
647   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
648   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6063bf4);
649   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
650   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
651651
652652   DRIVER_INIT_CALL(stv);
653653
r3957r3958
656656
657657DRIVER_INIT(finlarch)
658658{
659   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
660   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6064d60);
659   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
660   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6064d60);
661661
662662   DRIVER_INIT_CALL(stv);
663663
r3957r3958
665665
666666DRIVER_INIT(maruchan)
667667{
668   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
669   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
670   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
671   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
668   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
669   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
670   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
671   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
672672
673673   DRIVER_INIT_CALL(stv);
674674
r3957r3958
677677
678678DRIVER_INIT(pblbeach)
679679{
680   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
681   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605eb78);
680   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
681   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605eb78);
682682
683683   DRIVER_INIT_CALL(stv);
684684}
685685
686686DRIVER_INIT(shanhigw)
687687{
688   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
689   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6020c5c);
688   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
689   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6020c5c);
690690
691691   DRIVER_INIT_CALL(stv);
692692}
693693
694694DRIVER_INIT(elandore)
695695{
696   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
697   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604eac0);
698   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
699   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605340a);
696   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
697   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604eac0);
698   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
699   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605340a);
700700
701701   install_standard_protection(machine);
702702
r3957r3958
707707
708708DRIVER_INIT(rsgun)
709709{
710   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
711   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6034d04);
712   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
713   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6036152);
710   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
711   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6034d04);
712   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
713   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6036152);
714714
715715   install_standard_protection(machine);
716716
r3957r3958
734734
735735DRIVER_INIT(nameclv3)
736736{
737   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
738   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601eb4c);
739   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
740   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b80e);
737   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
738   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601eb4c);
739   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
740   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b80e);
741741
742742   DRIVER_INIT_CALL(stv);
743743}
src/mame/drivers/ttchamp.c
r3957r3958
4242*/
4343
4444#include "driver.h"
45#include "cpu/nec/nec.h"
4546
4647static UINT16 *peno_vram;
4748
src/mame/drivers/egghunt.c
r3957r3958
4242*/
4343
4444#include "driver.h"
45#include "cpu/z80/z80.h"
4546#include "sound/okim6295.h"
4647
4748static UINT8 *egghunt_bgram;
src/mame/drivers/gotcha.c
r3957r3958
5858***************************************************************************/
5959
6060#include "driver.h"
61#include "cpu/z80/z80.h"
62#include "cpu/m68000/m68000.h"
6163#include "sound/2151intf.h"
6264#include "sound/okim6295.h"
6365
src/mame/drivers/starshp1.c
r3957r3958
88***************************************************************************/
99
1010#include "driver.h"
11#include "cpu/m6502/m6502.h"
1112#include "includes/starshp1.h"
1213
1314int starshp1_attract;
src/mame/drivers/bigstrkb.c
r3957r3958
1313*/
1414
1515#include "driver.h"
16#include "cpu/m68000/m68000.h"
1617#include "sound/okim6295.h"
1718
1819/*
src/mame/drivers/pandoras.c
r3957r3958
392392   MDRV_CPU_PROGRAM_MAP(i8039_readmem,i8039_writemem)
393393   MDRV_CPU_IO_MAP(i8039_io_map,0)
394394
395   MDRV_INTERLEAVE(50)   /* slices per frame */
395   MDRV_QUANTUM_TIME(HZ(3000))   /* slices per frame */
396396
397397   MDRV_MACHINE_RESET(pandoras)
398398
src/mame/drivers/taito_f2.c
r3957r3958
293293***************************************************************************/
294294
295295#include "driver.h"
296#include "cpu/z80/z80.h"
296297#include "taitoipt.h"
297298#include "cpu/m68000/m68000.h"
298299#include "video/taitoic.h"
src/mame/drivers/gberet.c
r3957r3958
6666***************************************************************************/
6767
6868#include "driver.h"
69#include "cpu/z80/z80.h"
6970#include "deprecat.h"
7071#include "sound/sn76496.h"
7172
r3957r3958
119120   nmi_enable = data & 0x01;
120121   irq_enable = data & 0x04;
121122
122   flip_screen_set(data & 0x08);
123   flip_screen_set(space->machine, data & 0x08);
123124}
124125
125126static WRITE8_HANDLER( mrgoemon_coin_counter_w )
r3957r3958
140141   nmi_enable = data & 0x01;
141142   irq_enable = data & 0x02;
142143
143   flip_screen_set(data & 0x08);
144   flip_screen_set(space->machine, data & 0x08);
144145}
145146
146147/* Memory Maps */
src/mame/drivers/stfight.c
r3957r3958
229229*****************************************************************************/
230230
231231#include "driver.h"
232#include "cpu/z80/z80.h"
232233#include "sound/2203intf.h"
233234#include "sound/msm5205.h"
234235#include "includes/stfight.h"
r3957r3958
462463   MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
463464   MDRV_CPU_PERIODIC_INT(irq0_line_hold,120)
464465
465   MDRV_INTERLEAVE(10)
466   MDRV_QUANTUM_TIME(HZ(600))
466467
467468   MDRV_MACHINE_RESET(stfight)
468469
src/mame/drivers/gottlieb.c
r3957r3958
177177***************************************************************************/
178178
179179#include "driver.h"
180#include "cpu/i86/i86.h"
180181#include "machine/6532riot.h"
181182#include "machine/laserdsc.h"
182183#include "sound/ay8910.h"
src/mame/drivers/sandscrp.c
r3957r3958
7171*/
7272
7373#include "driver.h"
74#include "cpu/z80/z80.h"
75#include "cpu/m68000/m68000.h"
7476#include "machine/eeprom.h"
7577#include "includes/kaneko16.h"
7678#include "sound/2203intf.h"
r3957r3958
441443   MDRV_CPU_PROGRAM_MAP(sandscrp_soundmem,0)
442444   MDRV_CPU_IO_MAP(sandscrp_soundport,0)
443445
444   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
446   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
445447
446448   MDRV_MACHINE_RESET(sandscrp)
447449
src/mame/drivers/gpworld.c
r3957r3958
4040
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "machine/laserdsc.h"
4445
4546/* Assumed to be the same as segald hardware */
r3957r3958
7677   }
7778}
7879
79INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color)
80INLINE void draw_pixel(bitmap_t *bitmap,const rectangle *cliprect,int x,int y,int color,int flip)
8081{
81   if (flip_screen_get())
82   if (flip)
8283   {
8384      x = bitmap->width - x - 1;
8485      y = bitmap->height - y - 1;
r3957r3958
103104   const int SPR_SKIP_HI   = 5;
104105   const int SPR_GFXOFS_LO = 6;
105106   const int SPR_GFXOFS_HI = 7;
107   int flip = flip_screen_get(machine);
106108
107109   int i;
108110
r3957r3958
133135
134136            logerror("%02x %02x %02x %02x %02x %02x %02x %02x\n", spr_reg[SPR_Y_TOP], spr_reg[SPR_Y_BOTTOM], spr_reg[SPR_X_LO], spr_reg[SPR_X_HI],
135137                                                                  spr_reg[SPR_SKIP_LO], spr_reg[SPR_SKIP_HI], spr_reg[SPR_GFXOFS_LO], spr_reg[SPR_GFXOFS_HI]);
136            draw_pixel(bitmap,cliprect,sx,sy,0xffffffff);
138            draw_pixel(bitmap,cliprect,sx,sy,0xffffffff,flip);
137139*/
138140
139141         for (row = 0; row < height; row++)
r3957r3958
179181               }
180182
181183               /* Daphne says "don't draw the pixel if it's black". */
182               draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(machine, pixel1 + (sprite_color*0x10 + 0x200)));
183               draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(machine, pixel2 + (sprite_color*0x10 + 0x200)));
184               draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(machine, pixel3 + (sprite_color*0x10 + 0x200)));
185               draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(machine, pixel4 + (sprite_color*0x10 + 0x200)));
184               draw_pixel(bitmap,cliprect,x+0,y,palette_get_color(machine, pixel1 + (sprite_color*0x10 + 0x200)),flip);
185               draw_pixel(bitmap,cliprect,x+1,y,palette_get_color(machine, pixel2 + (sprite_color*0x10 + 0x200)),flip);
186               draw_pixel(bitmap,cliprect,x+2,y,palette_get_color(machine, pixel3 + (sprite_color*0x10 + 0x200)),flip);
187               draw_pixel(bitmap,cliprect,x+3,y,palette_get_color(machine, pixel4 + (sprite_color*0x10 + 0x200)),flip);
186188
187189               x += 4;
188190
src/mame/drivers/ddragon.c
r3957r3958
6969***************************************************************************/
7070
7171#include "driver.h"
72#include "cpu/hd6309/hd6309.h"
7273#include "cpu/m6800/m6800.h"
7374#include "cpu/m6805/m6805.h"
7475#include "cpu/m6809/m6809.h"
r3957r3958
215216{
216217   ddragon_scrollx_hi = ((data & 0x01) << 8);
217218   ddragon_scrolly_hi = ((data & 0x02) << 7);
218   flip_screen_set(~data & 0x04);
219   flip_screen_set(space->machine, ~data & 0x04);
219220
220221   /* bit 3 unknown */
221222
r3957r3958
233234   ddragon_scrollx_hi = ((data & 0x01) << 8);
234235   ddragon_scrolly_hi = ((data & 0x02) << 7);
235236
236//  flip_screen_set(~data & 0x04);
237//  flip_screen_set(space->machine, ~data & 0x04);
237238
238239   /* bit 3 unknown */
239240
r3957r3958
290291   ddragon_scrollx_hi = ((data & 0x01) << 8);
291292   ddragon_scrolly_hi = ((data & 0x02) << 7);
292293
293//  flip_screen_set(~data & 0x04);
294//  flip_screen_set(space->machine, ~data & 0x04);
294295
295296   /* bit 3 unknown */
296297
r3957r3958
986987    MDRV_CPU_ADD("sound", M6809, MAIN_CLOCK/2)   /* 6MHz / 4 internally */
987988   MDRV_CPU_PROGRAM_MAP(sound_map,0)
988989
989   MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */
990   MDRV_QUANTUM_TIME(HZ(60000)) /* heavy interleaving to sync up sprite<->main cpu's */
990991
991992   MDRV_MACHINE_START(ddragon)
992993   MDRV_MACHINE_RESET(ddragon)
r3957r3958
10511052    MDRV_CPU_ADD("sound", M6809, MAIN_CLOCK/2)   /* 6MHz / 4 internally */
10521053   MDRV_CPU_PROGRAM_MAP(sound_map,0)
10531054
1054   MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */
1055   MDRV_QUANTUM_TIME(HZ(60000)) /* heavy interleaving to sync up sprite<->main cpu's */
10551056
10561057   MDRV_MACHINE_START(ddragon)
10571058   MDRV_MACHINE_RESET(ddragon)
r3957r3958
10971098   MDRV_CPU_ADD("sound", Z80, 3579545)
10981099   MDRV_CPU_PROGRAM_MAP(dd2_sound_map,0)
10991100
1100   MDRV_INTERLEAVE(1000) /* heavy interleaving to sync up sprite<->main cpu's */
1101   MDRV_QUANTUM_TIME(HZ(60000)) /* heavy interleaving to sync up sprite<->main cpu's */
11011102
11021103   MDRV_MACHINE_START(ddragon)
11031104   MDRV_MACHINE_RESET(ddragon)
src/mame/drivers/acommand.c
r3957r3958
5656*******************************************************************************************/
5757
5858#include "driver.h"
59#include "cpu/m68000/m68000.h"
5960#include "deprecat.h"
6061#include "sound/okim6295.h"
6162
r3957r3958
112113         int xx,yy,x;
113114         int delta = 16;
114115
115         flipx ^= flip_screen_get();
116         flipy ^= flip_screen_get();
116         flipx ^= flip_screen_get(machine);
117         flipy ^= flip_screen_get(machine);
117118
118119         if ((pri&pri_mask)!=priority) continue;
119120
120         if (flip_screen_get())
121         if (flip_screen_get(machine))
121122         {
122123            sx = 368 - sx;
123124            sy = 240 - sy;
src/mame/drivers/asterix.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/m68000/m68000.h"
1314#include "video/konamiic.h"
1415#include "cpu/z80/z80.h"
1516#include "machine/eeprom.h"
src/mame/drivers/tubep.c
r3957r3958
9999
100100
101101#include "driver.h"
102#include "cpu/m6800/m6800.h"
102103#include "cpu/z80/z80.h"
103104#include "cpu/m6805/m6805.h"
104105#include "sound/ay8910.h"
r3957r3958
917918   MDRV_CPU_ADD("nsc",NSC8105,6000000)   /* 6 MHz Xtal - divided internally ??? */
918919   MDRV_CPU_PROGRAM_MAP(nsc_map,0)
919920
920   MDRV_INTERLEAVE(100)
921   MDRV_QUANTUM_TIME(HZ(6000))
921922
922923   MDRV_MACHINE_START(tubep)
923924   MDRV_MACHINE_RESET(tubep)
src/mame/drivers/goldnpkr.c
r3957r3958
594594#define CPU_CLOCK      (MASTER_CLOCK/16)
595595
596596#include "driver.h"
597#include "cpu/m6502/m6502.h"
597598#include "video/mc6845.h"
598599#include "machine/6821pia.h"
599600#include "sound/discrete.h"
r3957r3958
22662267   MDRV_SCREEN_SIZE((39+1)*8, (31+1)*8)                  /* From MC6845 init, registers 00 & 04 (programmed with value-1). */
22672268   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 29*8-1)    /* From MC6845 init, registers 01 & 06. */
22682269
2269   MDRV_DEVICE_ADD("crtc", MC6845)
2270   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
22702271
22712272   MDRV_GFXDECODE(goldnpkr)
22722273   MDRV_PALETTE_INIT(goldnpkr)
src/mame/drivers/ppmast93.c
r3957r3958
130130*/
131131
132132#include "driver.h"
133#include "cpu/z80/z80.h"
133134#include "sound/3812intf.h"
134135#include "sound/2413intf.h"
135136#include "sound/dac.h"
src/mame/drivers/homedata.c
r3957r3958
217217***************************************************************************/
218218
219219#include "driver.h"
220#include "cpu/z80/z80.h"
220221#include "cpu/m6809/m6809.h"
221222#include "cpu/upd7810/upd7810.h"
222223#include "homedata.h"
r3957r3958
12861287   MDRV_CPU_IO_MAP(reikaids_upd7807_io_map,0)
12871288   MDRV_CPU_VBLANK_INT("main", upd7807_irq)
12881289
1289   MDRV_INTERLEAVE(500)   // very high interleave required to sync for startup tests
1290   MDRV_QUANTUM_TIME(HZ(30000))   // very high interleave required to sync for startup tests
12901291
12911292   MDRV_MACHINE_RESET(reikaids_upd7807)
12921293
r3957r3958
13361337   MDRV_CPU_IO_MAP(pteacher_upd7807_io_map,0)
13371338   MDRV_CPU_VBLANK_INT("main", upd7807_irq)
13381339
1339   MDRV_INTERLEAVE(100)   // should be enough
1340   MDRV_QUANTUM_TIME(HZ(6000))   // should be enough
13401341
13411342   MDRV_MACHINE_RESET(pteacher_upd7807)
13421343
src/mame/drivers/exidy.c
r3957r3958
126126***************************************************************************/
127127
128128#include "driver.h"
129#include "cpu/m6502/m6502.h"
129130#include "deprecat.h"
130131#include "exidy.h"
131132#include "targ.h"
r3957r3958
843844   MDRV_CPU_MODIFY("main")
844845   MDRV_CPU_PROGRAM_MAP(exidy_map,venture_map)
845846
846   MDRV_INTERLEAVE(10)
847   MDRV_QUANTUM_TIME(HZ(600))
847848
848849   /* audio hardware */
849850   MDRV_IMPORT_FROM(venture_audio)
r3957r3958
864865   /* basic machine hardware */
865866   MDRV_IMPORT_FROM(venture)
866867
867   MDRV_INTERLEAVE(32)
868   MDRV_QUANTUM_TIME(HZ(1920))
868869
869870   /* audio hardware */
870871   MDRV_IMPORT_FROM(mtrap_cvsd_audio)
src/mame/drivers/xxmissio.c
r3957r3958
99*****************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "deprecat.h"
1314#include "sound/2203intf.h"
1415
r3957r3958
317318   MDRV_CPU_PROGRAM_MAP(map2,0)
318319   MDRV_CPU_VBLANK_INT_HACK(xxmissio_interrupt_s,2)
319320
320   MDRV_INTERLEAVE(100)
321   MDRV_QUANTUM_TIME(HZ(6000))
321322
322323   MDRV_MACHINE_START(xxmissio)
323324
src/mame/drivers/mugsmash.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
44#include "cpu/m68000/m68000.h"
4345#include "sound/2151intf.h"
4446#include "sound/okim6295.h"
4547
src/mame/drivers/jokrwild.c
r3957r3958
9191#define MASTER_CLOCK   XTAL_8MHz   /* guess */
9292
9393#include "driver.h"
94#include "cpu/m6809/m6809.h"
9495#include "video/mc6845.h"
9596#include "machine/6821pia.h"
9697
r3957r3958
357358   MDRV_VIDEO_START(jokrwild)
358359   MDRV_VIDEO_UPDATE(jokrwild)
359360
360   MDRV_DEVICE_ADD("crtc", MC6845)
361   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
361362
362363MACHINE_DRIVER_END
363364
src/mame/drivers/hyhoo.c
r3957r3958
2222******************************************************************************/
2323
2424#include "driver.h"
25#include "cpu/z80/z80.h"
2526#include "nb1413m3.h"
2627#include "sound/ay8910.h"
2728#include "sound/dac.h"
src/mame/drivers/hng64.c
r3957r3958
458458
459459#define MASTER_CLOCK   50000000
460460#include "driver.h"
461#include "cpu/z80/z80.h"
462#include "cpu/nec/nec.h"
461463#include "deprecat.h"
462464#include "cpu/mips/mips3.h"
463465
r3957r3958
14881490   activeBuffer = 0 ;
14891491
14901492   /* set the fastest DRC options */
1491   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
1493   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_DRC_OPTIONS, MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY);
14921494
14931495   /* configure fast RAM regions for DRC */
1494   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
1495   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
1496   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x00ffffff);
1497   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, hng_mainram);
1498   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
1496   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 0);
1497   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x00000000);
1498   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x00ffffff);
1499   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, hng_mainram);
1500   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 0);
14991501
1500   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
1501   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x04000000);
1502   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x05ffffff);
1503   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, hng_cart);
1504   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
1502   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 1);
1503   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x04000000);
1504   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x05ffffff);
1505   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, hng_cart);
1506   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
15051507
1506   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 2);
1507   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
1508   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
1509   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
1510   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
1508   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_SELECT, 2);
1509   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_START, 0x1fc00000);
1510   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_END, 0x1fc7ffff);
1511   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_MIPS3_FASTRAM_BASE, rombase);
1512   device_set_info_int(machine->cpu[0], CPUINFO_INT_MIPS3_FASTRAM_READONLY, 1);
15111513}
15121514
15131515
src/mame/drivers/macrossp.c
r3957r3958
3737******************************************************************************/
3838
3939#include "driver.h"
40#include "cpu/m68000/m68000.h"
4041#include "sound/es5506.h"
4142
4243/*** README INFO **************************************************************
src/mame/drivers/gladiatr.c
r3957r3958
182182***************************************************************************/
183183
184184#include "driver.h"
185#include "cpu/m6809/m6809.h"
185186#include "machine/tait8741.h"
186187#include "cpu/z80/z80.h"
187188#include "sound/2203intf.h"
r3957r3958
271272   {
272273      UINT8 *rom = memory_region(machine, "audio") + 0x10000;
273274      memory_set_bankptr(machine, 2,rom);
274      cpu_reset(machine->cpu[2]);
275      device_reset(machine->cpu[2]);
275276   }
276277}
277278
r3957r3958
321322
322323static WRITE8_HANDLER( gladiatr_flipscreen_w )
323324{
324   flip_screen_set(data & 1);
325   flip_screen_set(space->machine, data & 1);
325326}
326327
327328
r3957r3958
704705   MDRV_CPU_ADD("audio", M6809, XTAL_12MHz/16) /* verified on pcb */
705706   MDRV_CPU_PROGRAM_MAP(ppking_cpu3_map,0)
706707
707   MDRV_INTERLEAVE(100)
708   MDRV_QUANTUM_TIME(HZ(6000))
708709
709710   MDRV_MACHINE_RESET(ppking)
710711   MDRV_NVRAM_HANDLER(generic_0fill)
r3957r3958
753754   MDRV_CPU_ADD("audio", M6809, XTAL_12MHz/16) /* verified on pcb */
754755   MDRV_CPU_PROGRAM_MAP(gladiatr_cpu3_map,0)
755756
756   MDRV_INTERLEAVE(10)
757   MDRV_QUANTUM_TIME(HZ(600))
757758
758759   MDRV_MACHINE_RESET(gladiator)
759760   MDRV_NVRAM_HANDLER(generic_0fill)
src/mame/drivers/imolagp.c
r3957r3958
415415   MDRV_CPU_IO_MAP(readport_slave,0)
416416   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
417417
418   MDRV_INTERLEAVE(100)
418   MDRV_QUANTUM_TIME(HZ(6000))
419419
420420   MDRV_PPI8255_ADD( "ppi8255", ppi8255_intf )
421421
src/mame/drivers/puckpkmn.c
r3957r3958
4343*/
4444
4545#include "driver.h"
46#include "cpu/m68000/m68000.h"
4647#include "genesis.h"
4748
4849#define MASTER_CLOCK      53693100
src/mame/drivers/stepstag.c
r3957r3958
88 */
99
1010#include "driver.h"
11#include "cpu/m68000/m68000.h"
1112
1213static READ16_HANDLER( unknown_read_0xc00000 )
1314{
src/mame/drivers/goindol.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/z80/z80.h"
2122#include "deprecat.h"
2223#include "sound/2203intf.h"
2324
r3957r3958
4950      tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
5051   }
5152
52   flip_screen_set(data & 0x20);
53   flip_screen_set(space->machine, data & 0x20);
5354}
5455
5556
src/mame/drivers/eolith16.c
r3957r3958
1010**********************************************************************/
1111
1212#include "driver.h"
13#include "cpu/e132xs/e132xs.h"
1314#include "deprecat.h"
1415#include "machine/eeprom.h"
1516#include "sound/okim6295.h"
src/mame/drivers/taito_l.c
r3957r3958
21152115   MDRV_CPU_PROGRAM_MAP(fhawk_2_readmem,fhawk_2_writemem)
21162116   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,3) /* fixes slow down problems */
21172117
2118   MDRV_INTERLEAVE(100)
2118   MDRV_QUANTUM_TIME(HZ(6000))
21192119
21202120   MDRV_MACHINE_RESET(fhawk)
21212121
r3957r3958
22112211   MDRV_CPU_PROGRAM_MAP(kurikint_2_readmem,kurikint_2_writemem)
22122212   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
22132213
2214   MDRV_INTERLEAVE(100)
2214   MDRV_QUANTUM_TIME(HZ(6000))
22152215
22162216   MDRV_MACHINE_RESET(kurikint)
22172217
r3957r3958
23512351   MDRV_CPU_PROGRAM_MAP(evilston_2_readmem,evilston_2_writemem)
23522352   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
23532353
2354   MDRV_INTERLEAVE(100)
2354   MDRV_QUANTUM_TIME(HZ(6000))
23552355
23562356   MDRV_MACHINE_RESET(evilston)
23572357
src/mame/drivers/gyruss.c
r3957r3958
5656***************************************************************************/
5757
5858#include "driver.h"
59#include "cpu/z80/z80.h"
60#include "cpu/m6809/m6809.h"
5961#include "machine/konami1.h"
6062#include "cpu/mcs48/mcs48.h"
6163#include "sound/ay8910.h"
r3957r3958
519521   MDRV_CPU_PROGRAM_MAP(audio_cpu2_map,0)
520522   MDRV_CPU_IO_MAP(audio_cpu2_io_map,0)
521523
522   MDRV_INTERLEAVE(100)
524   MDRV_QUANTUM_TIME(HZ(6000))
523525
524526   /* video hardware */
525527   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/gamecstl.c
r3957r3958
6060*/
6161
6262#include "driver.h"
63#include "cpu/i386/i386.h"
6364#include "memconv.h"
6465#include "devconv.h"
65#include "deprecat.h"
6666#include "machine/8237dma.h"
6767#include "machine/pic8259.h"
6868#include "machine/pit8253.h"
r3957r3958
7272#include "machine/8042kbdc.h"
7373#include "machine/pckeybrd.h"
7474#include "machine/idectrl.h"
75#include "cpu/i386/i386.h"
7675
7776static void ide_interrupt(const device_config *device, int state);
7877
r3957r3958
441440
442441static const struct dma8237_interface dma8237_1_config =
443442{
444   0,
443   "main",
445444   1.0e-6, // 1us
446445
447446   pc_dma_read_byte,
r3957r3958
455454
456455static const struct dma8237_interface dma8237_2_config =
457456{
458   0,
457   "main",
459458   1.0e-6, // 1us
460459
461460   NULL,
r3957r3958
689688
690689MACHINE_DRIVER_END
691690
692static void set_gate_a20(int a20)
691static void set_gate_a20(running_machine *machine, int a20)
693692{
694   cpu_set_input_line(Machine->cpu[0], INPUT_LINE_A20, a20);
693   cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20);
695694}
696695
697static void keyboard_interrupt(int state)
696static void keyboard_interrupt(running_machine *machine, int state)
698697{
699698   pic8259_set_irq_line( gamecstl_devices.pic8259_1, 1, state);
700699}
r3957r3958
713712   KBDC8042_AT386, set_gate_a20, keyboard_interrupt, gamecstl_get_out2
714713};
715714
716static void gamecstl_set_keyb_int(int state) {
715static void gamecstl_set_keyb_int(running_machine *machine, int state) {
717716   pic8259_set_irq_line(gamecstl_devices.pic8259_1, 1, state);
718717}
719718
src/mame/drivers/segald.c
r3957r3958
1818*/
1919
2020#include "driver.h"
21#include "cpu/z80/z80.h"
2122#include "render.h"
2223#include "machine/laserdsc.h"
2324
src/mame/drivers/kangaroo.c
r3957r3958
154154***************************************************************************/
155155
156156#include "driver.h"
157#include "cpu/mb88xx/mb88xx.h"
157158#include "kangaroo.h"
158159#include "cpu/z80/z80.h"
159160#include "sound/ay8910.h"
src/mame/drivers/wldarrow.c
r3957r3958
1616**********************************/
1717
1818#include "driver.h"
19#include "cpu/i8085/i8085.h"
1920#include "sound/dac.h"
2021
2122
src/mame/drivers/cabal.c
r3957r3958
4545******************************************************************/
4646
4747#include "driver.h"
48#include "cpu/m68000/m68000.h"
4849#include "cpu/z80/z80.h"
4950#include "audio/seibu.h"
5051#include "sound/2151intf.h"
r3957r3958
559560   MDRV_CPU_IO_MAP(cabalbl_talk2_portmap,0)
560561   MDRV_CPU_PERIODIC_INT(irq0_line_hold,8000)
561562
562   MDRV_INTERLEAVE(10)
563   MDRV_QUANTUM_TIME(HZ(600))
563564
564565   MDRV_MACHINE_RESET(cabalbl)
565566
src/mame/drivers/cidelsa.c
r3957r3958
246246
247247static CDP1852_INTERFACE( cidelsa_cdp1852_in0_intf )
248248{
249   CDP1852_CLOCK_HIGH, // really tied to CDP1876 CMSEL (pin 32)
250249   CDP1852_MODE_INPUT,
251250   cidelsa_in0_r,
252251   NULL,
r3957r3958
255254
256255static CDP1852_INTERFACE( cidelsa_cdp1852_in1_intf )
257256{
258   CDP1852_CLOCK_HIGH,
259257   CDP1852_MODE_INPUT,
260258   cidelsa_in1_r,
261259   NULL,
r3957r3958
264262
265263static CDP1852_INTERFACE( cidelsa_cdp1852_in2_intf )
266264{
267   CDP1852_CLOCK_HIGH,
268265   CDP1852_MODE_INPUT,
269266   cidelsa_in2_r,
270267   NULL,
r3957r3958
273270
274271static CDP1852_INTERFACE( altair_cdp1852_out1_intf )
275272{
276   ALTAIR_CHR1 / 8, // CDP1802 TPB
277273   CDP1852_MODE_OUTPUT,
278274   NULL,
279275   altair_out1_w,
r3957r3958
282278
283279static CDP1852_INTERFACE( draco_cdp1852_out1_intf )
284280{
285   DRACO_CHR1 / 8, // CDP1802 TPB
286281   CDP1852_MODE_OUTPUT,
287282   NULL,
288283   draco_out1_w,
r3957r3958
651646
652647   // input/output hardware
653648
654   MDRV_DEVICE_ADD("ic23", CDP1852)
655   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in0_intf)
649   MDRV_CDP1852_ADD("ic23", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in0_intf)   /* clock is really tied to CDP1876 CMSEL (pin 32) */
650   MDRV_CDP1852_ADD("ic24", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in1_intf)
651   MDRV_CDP1852_ADD("ic25", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in2_intf)
652   MDRV_CDP1852_ADD("ic26", ALTAIR_CHR1 / 8, altair_cdp1852_out1_intf)      /* clock is CDP1802 TPB */
656653
657   MDRV_DEVICE_ADD("ic24", CDP1852)
658   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in1_intf)
659
660   MDRV_DEVICE_ADD("ic25", CDP1852)
661   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in2_intf)
662
663   MDRV_DEVICE_ADD("ic26", CDP1852)
664   MDRV_DEVICE_CONFIG(altair_cdp1852_out1_intf)
665
666654   // video hardware
667655
668656   MDRV_IMPORT_FROM(altair_video)
r3957r3958
696684
697685   // input/output hardware
698686
699   MDRV_DEVICE_ADD("ic29", CDP1852)
700   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in0_intf)
687   MDRV_CDP1852_ADD("ic29", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in0_intf)   /* clock is really tied to CDP1876 CMSEL (pin 32) */
688   MDRV_CDP1852_ADD("ic30", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in1_intf)
689   MDRV_CDP1852_ADD("ic31", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in2_intf)
690   MDRV_CDP1852_ADD("ic32", DRACO_CHR1 / 8, draco_cdp1852_out1_intf)      /* clock is CDP1802 TPB */
701691
702   MDRV_DEVICE_ADD("ic30", CDP1852)
703   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in1_intf)
704
705   MDRV_DEVICE_ADD("ic31", CDP1852)
706   MDRV_DEVICE_CONFIG(cidelsa_cdp1852_in2_intf)
707
708   MDRV_DEVICE_ADD("ic32", CDP1852)
709   MDRV_DEVICE_CONFIG(draco_cdp1852_out1_intf)
710
711692   // video hardware
712693
713694   MDRV_IMPORT_FROM(draco_video)
src/mame/drivers/hotblock.c
r3957r3958
4242*/
4343
4444#include "driver.h"
45#include "cpu/i86/i86.h"
4546#include "sound/ay8910.h"
4647
4748static UINT8 *hotblock_ram;
src/mame/drivers/srmp5.c
r3957r3958
3030
3131
3232#include "driver.h"
33#include "cpu/z80/z80.h"
3334#include "cpu/mips/r3000.h"
3435#include "sound/st0016.h"
3536#include "st0016.h"
r3957r3958
639640   MDRV_CPU_PROGRAM_MAP(srmp5_mem,0)
640641   MDRV_CPU_VBLANK_INT("main", irq4_gen)
641642
642   MDRV_INTERLEAVE(100)
643   MDRV_QUANTUM_TIME(HZ(6000))
643644
644645   /* video hardware */
645646   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/m92.c
r3957r3958
194194*****************************************************************************/
195195
196196#include "driver.h"
197#include "cpu/nec/nec.h"
197198#include "m92.h"
198199#include "iremipt.h"
199200#include "machine/irem_cpu.h"
200201#include "sound/2151intf.h"
201202#include "sound/iremga20.h"
202#include "cpu/nec/nec.h"
203203
204204static UINT8 irqvector;
205205static UINT16 sound_status;
src/mame/drivers/m58.c
r3957r3958
1010****************************************************************************/
1111
1212#include "driver.h"
13#include "cpu/z80/z80.h"
1314#include "iremipt.h"
1415#include "m58.h"
1516#include "audio/irem.h"
src/mame/drivers/vendetta.c
r3957r3958
8787***************************************************************************/
8888
8989#include "driver.h"
90#include "cpu/z80/z80.h"
9091#include "video/konamiic.h"
9192#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
9293#include "machine/eeprom.h"
src/mame/drivers/fcombat.c
r3957r3958
2929*/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
3233#include "sound/ay8910.h"
3334
3435
src/mame/drivers/destroyr.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89#include "deprecat.h"
910
1011extern VIDEO_UPDATE( destroyr );
src/mame/drivers/segas16b.c
r3957r3958
868868
869869
870870#include "driver.h"
871#include "deprecat.h"
871#include "cpu/z80/z80.h"
872#include "cpu/m68000/m68000.h"
873#include "cpu/mcs51/mcs51.h"
872874#include "system16.h"
873875#include "machine/segaic16.h"
874876#include "machine/fd1089.h"
r3957r3958
13421344}
13431345
13441346
1345static void upd7759_generate_nmi(int state)
1347static void upd7759_generate_nmi(const device_config *device, int state)
13461348{
13471349   if (state)
1348      cpu_set_input_line(Machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
1350      cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_NMI, PULSE_LINE);
13491351}
13501352
13511353
src/mame/drivers/wwfwfest.c
r3957r3958
3838*******************************************************************************/
3939
4040#include "driver.h"
41#include "deprecat.h"
4241#include "cpu/m68000/m68000.h"
4342#include "cpu/z80/z80.h"
4443#include "wwfwfest.h"
4544#include "sound/2151intf.h"
4645#include "sound/okim6295.h"
4746
47#define MASTER_CLOCK      XTAL_24MHz
48#define CPU_CLOCK         MASTER_CLOCK / 2
49#define PIXEL_CLOCK      MASTER_CLOCK / 4
50
4851/*- in this file -*/
4952static READ16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_r );
5053static WRITE16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_w );
r3957r3958
5255static WRITE16_HANDLER( wwfwfest_scroll_write ); /* scrolling write */
5356static WRITE8_HANDLER( oki_bankswitch_w );
5457static WRITE16_HANDLER ( wwfwfest_soundwrite );
58static WRITE16_HANDLER ( wwfwfest_flipscreen_w );
59static WRITE16_HANDLER ( wwfwfest_irq_ack_w );
5560
56static WRITE16_HANDLER( wwfwfest_flipscreen_w )
57{
58   flip_screen_set(data&1);
59}
60
6161/*******************************************************************************
6262 Memory Maps
6363********************************************************************************
r3957r3958
7474   AM_RANGE(0x082000, 0x082fff) AM_RAM_WRITE(wwfwfest_bg1_videoram_w) AM_BASE(&wwfwfest_bg1_videoram)   /* BG1 Ram - 2 bytes per tile */
7575   AM_RANGE(0x100000, 0x100007) AM_WRITE(wwfwfest_scroll_write)
7676   AM_RANGE(0x10000a, 0x10000b) AM_WRITE(wwfwfest_flipscreen_w)
77   AM_RANGE(0x140000, 0x140001) AM_WRITE(SMH_NOP) /* Irq 3 ack */
78   AM_RANGE(0x140002, 0x140003) AM_WRITE(SMH_NOP) /* Irq 2 ack */
77   AM_RANGE(0x140000, 0x140003) AM_WRITE(wwfwfest_irq_ack_w)
7978   AM_RANGE(0x14000c, 0x14000d) AM_WRITE(wwfwfest_soundwrite)
8079   AM_RANGE(0x140010, 0x140011) AM_WRITE(wwfwfest_1410_write)
8180   AM_RANGE(0x140020, 0x140021) AM_READ_PORT("P1")
r3957r3958
102101 as used by the above memory map
103102*******************************************************************************/
104103
104static WRITE16_HANDLER( wwfwfest_irq_ack_w )
105{
106   if (offset == 0)
107      cpu_set_input_line(space->machine->cpu[0], 3, CLEAR_LINE);
108
109   else
110      cpu_set_input_line(space->machine->cpu[0], 2, CLEAR_LINE);
111}
112
113static WRITE16_HANDLER( wwfwfest_flipscreen_w )
114{
115   flip_screen_set(space->machine, data&1);
116}
117
105118/*- Palette Reads/Writes -*/
106119
107120static READ16_HANDLER( wwfwfest_paletteram16_xxxxBBBBGGGGRRRR_word_r )
r3957r3958
331344 Interrupt Function
332345*******************************************************************************/
333346
334static INTERRUPT_GEN( wwfwfest_interrupt ) {
335   if( cpu_getiloops(device) == 0 )
336      cpu_set_input_line(device, 3, HOLD_LINE);
337   else
338      cpu_set_input_line(device, 2, HOLD_LINE);
347static TIMER_DEVICE_CALLBACK( wwfwfest_scanline )
348{
349   int scanline = param;
350
351   /* An interrupt is generated every 16 scanlines */
352   if (scanline % 16 == 0)
353   {
354      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
355      cpu_set_input_line(timer->machine->cpu[0], 2, ASSERT_LINE);
356   }
357
358   /* Vblank is raised on scanline 248 */
359   if (scanline == 248)
360   {
361      video_screen_update_partial(timer->machine->primary_screen, scanline - 1);
362      cpu_set_input_line(timer->machine->cpu[0], 3, ASSERT_LINE);
363   }
364
365   /* Adjust for next scanline */
366   if (++scanline >= video_screen_get_height(timer->machine->primary_screen))
367   {
368      scanline = 0;
369   }
339370}
340371
341372/*******************************************************************************
r3957r3958
368399static MACHINE_DRIVER_START( wwfwfest )
369400
370401   /* basic machine hardware */
371   MDRV_CPU_ADD("main", M68000, XTAL_24MHz / 2)   /* 24 crystal, 12 rated chip */
402   MDRV_CPU_ADD("main", M68000, CPU_CLOCK)   /* 24 crystal, 12 rated chip */
372403   MDRV_CPU_PROGRAM_MAP(main_map,0)
373   MDRV_CPU_VBLANK_INT_HACK(wwfwfest_interrupt,2)
404   MDRV_TIMER_ADD_SCANLINE("scantimer", wwfwfest_scanline, "main", 0, 1)
374405
375406   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz)
376407   MDRV_CPU_PROGRAM_MAP(sound_map,0)
r3957r3958
379410   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
380411
381412   MDRV_SCREEN_ADD("main", RASTER)
382   MDRV_SCREEN_REFRESH_RATE(60)
383   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
384413   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
385   MDRV_SCREEN_SIZE(320, 256)
386   MDRV_SCREEN_VISIBLE_AREA(0, 319, 1*8, 31*8-1)
414   MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 320, 272, 8, 248)   /* HTOTAL and VTOTAL are guessed */
387415
388416   MDRV_GFXDECODE(wwfwfest)
389417   MDRV_PALETTE_LENGTH(8192)
src/mame/drivers/marineb.c
r3957r3958
3636***************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/z80/z80.h"
3940#include "sound/ay8910.h"
4041#include "includes/espial.h"
4142
src/mame/drivers/pktgaldx.c
r3957r3958
5454*/
5555
5656#include "driver.h"
57#include "cpu/m68000/m68000.h"
5758#include "decocrpt.h"
5859#include "decoprot.h"
5960#include "deco16ic.h"
src/mame/drivers/timeplt.c
r3957r3958
4545***************************************************************************/
4646
4747#include "driver.h"
48#include "cpu/z80/z80.h"
4849#include "timeplt.h"
4950#include "audio/timeplt.h"
5051
src/mame/drivers/multigam.c
r3957r3958
4040*/
4141
4242#include "driver.h"
43#include "deprecat.h"
4443#include "video/ppu2c0x.h"
4544#include "sound/nes_apu.h"
4645#include "cpu/m6502/m6502.h"
r3957r3958
206205static int multigam3_mmc3_last_bank;
207206static UINT8* multigmc_mmc3_6000_ram;
208207
209static void multigam3_mmc3_scanline_cb( int num, int scanline, int vblank, int blanked )
208static void multigam3_mmc3_scanline_cb( running_machine *machine, int num, int scanline, int vblank, int blanked )
210209{
211210   if ( !vblank && !blanked )
212211   {
213212      if ( --multigam3_mmc3_scanline_counter == -1 )
214213      {
215214         multigam3_mmc3_scanline_counter = multigam3_mmc3_scanline_latch;
216         generic_pulse_irq_line(Machine->cpu[0], 0);
215         generic_pulse_irq_line(machine->cpu[0], 0);
217216      }
218217   }
219218}
r3957r3958
513512   ppu2c0x_init_palette(machine, 0 );
514513}
515514
516static void ppu_irq( int num, int *ppu_regs )
515static void ppu_irq( running_machine *machine, int num, int *ppu_regs )
517516{
518   cpu_set_input_line(Machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
517   cpu_set_input_line(machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
519518}
520519
521520/* our ppu interface                                            */
src/mame/drivers/atarigx2.c
r3957r3958
2020
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
2324#include "machine/atarigen.h"
2425#include "audio/atarijsa.h"
2526#include "video/atarirle.h"
src/mame/drivers/fuukifg2.c
r3957r3958
3535***************************************************************************/
3636
3737#include "driver.h"
38#include "cpu/z80/z80.h"
39#include "cpu/m68000/m68000.h"
3840#include "sound/2203intf.h"
3941#include "sound/3812intf.h"
4042#include "sound/okim6295.h"
src/mame/drivers/nwk-tr.c
r3957r3958
213213*/
214214
215215#include "driver.h"
216#include "deprecat.h"
216#include "cpu/m68000/m68000.h"
217217#include "cpu/powerpc/ppc.h"
218218#include "cpu/sharc/sharc.h"
219219#include "machine/konppc.h"
r3957r3958
734734
735735/*****************************************************************************/
736736
737static double adc12138_input_callback(int input)
737static double adc12138_input_callback(running_machine *machine, int input)
738738{
739739   int value = 0;
740740   switch (input)
741741   {
742      case 0:      value = input_port_read(Machine, "ANALOG1") - 0x800; break;
743      case 1:      value = input_port_read(Machine, "ANALOG2"); break;
744      case 2:      value = input_port_read(Machine, "ANALOG3"); break;
745      case 3:      value = input_port_read(Machine, "ANALOG4"); break;
746      case 4:      value = input_port_read(Machine, "ANALOG5"); break;
742      case 0:      value = input_port_read(machine, "ANALOG1") - 0x800; break;
743      case 1:      value = input_port_read(machine, "ANALOG2"); break;
744      case 2:      value = input_port_read(machine, "ANALOG3"); break;
745      case 3:      value = input_port_read(machine, "ANALOG4"); break;
746      case 4:      value = input_port_read(machine, "ANALOG5"); break;
747747   }
748748
749749   return (double)(value) / 2047.0;
r3957r3958
804804         int di = (data >> 25) & 0x1;
805805         int sclk = (data >> 24) & 0x1;
806806
807         adc1213x_cs_w(0, cs);
807         adc1213x_cs_w(space->machine, 0, cs);
808808         adc1213x_conv_w(0, conv);
809809         adc1213x_di_w(0, di);
810810         adc1213x_sclk_w(0, sclk);
r3957r3958
949949static MACHINE_START( nwktr )
950950{
951951   /* set conservative DRC options */
952   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
952   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_DRC_OPTIONS, PPCDRC_COMPATIBLE_OPTIONS);
953953
954954   /* configure fast RAM regions for DRC */
955   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
956   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
957   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff);
958   cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
959   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
955   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_SELECT, 0);
956   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_START, 0x00000000);
957   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_END, 0x003fffff);
958   device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_PPC_FASTRAM_BASE, work_ram);
959   device_set_info_int(machine->cpu[0], CPUINFO_INT_PPC_FASTRAM_READONLY, 0);
960960}
961961
962962static ADDRESS_MAP_START( nwktr_map, ADDRESS_SPACE_PROGRAM, 32 )
r3957r3958
10901090   cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
10911091}
10921092
1093static const timekeeper_config timekeeper_intf =
1094{
1095   "m48t58"
1096};
1097
10981093static MACHINE_DRIVER_START( nwktr )
10991094
11001095   /* basic machine hardware */
r3957r3958
11081103   MDRV_CPU_CONFIG(sharc_cfg)
11091104   MDRV_CPU_DATA_MAP(sharc_map, 0)
11101105
1111   MDRV_INTERLEAVE(100)
1106   MDRV_QUANTUM_TIME(HZ(6000))
11121107
11131108   MDRV_MACHINE_START(nwktr)
11141109   MDRV_MACHINE_RESET(nwktr)
r3957r3958
11371132   MDRV_SOUND_ROUTE(0, "left", 1.0)
11381133   MDRV_SOUND_ROUTE(1, "right", 1.0)
11391134
1140   MDRV_DEVICE_ADD( "m48t58", M48T58 )
1141   MDRV_DEVICE_CONFIG( timekeeper_intf )
1135   MDRV_M48T58_ADD( "m48t58" )
11421136MACHINE_DRIVER_END
11431137
11441138/*****************************************************************************/
r3957r3958
11531147
11541148static DRIVER_INIT(nwktr)
11551149{
1156   init_konami_cgboard(1, CGBOARD_TYPE_NWKTR);
1157   set_cgboard_texture_bank(0, 5, memory_region(machine, "user5"));
1150   init_konami_cgboard(machine, 1, CGBOARD_TYPE_NWKTR);
1151   set_cgboard_texture_bank(machine, 0, 5, memory_region(machine, "user5"));
11581152
11591153   sharc_dataram = auto_malloc(0x100000);
11601154   led_reg0 = led_reg1 = 0x7f;
r3957r3958
11621156   K056800_init(machine, sound_irq_callback);
11631157   K033906_init(machine);
11641158
1165//  cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_SPU_TX_HANDLER, (genf *)jamma_jvs_w);
1166//  cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_SPU_RX_HANDLER, (genf *)jamma_jvs_r);
1159//  device_set_info_fct(machine->cpu[0], CPUINFO_FCT_SPU_TX_HANDLER, (genf *)jamma_jvs_w);
1160//  device_set_info_fct(machine->cpu[0], CPUINFO_FCT_SPU_RX_HANDLER, (genf *)jamma_jvs_r);
11671161
11681162   adc1213x_init(0, adc12138_input_callback);
11691163   lanc2_init();
src/mame/drivers/vulgus.c
r3957r3958
4040***************************************************************************/
4141
4242#include "driver.h"
43#include "cpu/z80/z80.h"
4344#include "deprecat.h"
4445#include "sound/ay8910.h"
4546
src/mame/drivers/circus.c
r3957r3958
3434***************************************************************************/
3535
3636#include "driver.h"
37#include "cpu/m6502/m6502.h"
3738#include "deprecat.h"
3839#include "sound/samples.h"
3940#include "circus.h"
src/mame/drivers/sderby.c
r3957r3958
5959*******************************************************************************************/
6060
6161#include "driver.h"
62#include "cpu/m68000/m68000.h"
6263#include "sound/okim6295.h"
6364#include "sderby.lh"
6465#include "spacewin.lh"
src/mame/drivers/vcombat.c
r3957r3958
6969
7070#include <stdio.h>
7171#include "driver.h"
72#include "cpu/m68000/m68000.h"
7273#include "video/generic.h"
7374
7475static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
75   AM_RANGE(0x000000, 0xfffff) AM_ROM
76   AM_RANGE(0x000000, 0x0fffff) AM_ROM
77   AM_RANGE(0x200000, 0x201fff) AM_RAM      /* At the very least! */
7678ADDRESS_MAP_END
7779
7880static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 16 )
79   AM_RANGE(0x000000, 0x3ffff) AM_ROM
81   AM_RANGE(0x000000, 0x03ffff) AM_ROM
8082ADDRESS_MAP_END
8183
8284/*
r3957r3958
9395   return 0;
9496}
9597
98static const gfx_layout vcombat_charlayout =
99{
100   8, 8,
101   0x100000 / 0x80,
102   8,
103   { 0,1,2,3,4,5,6,7 },
104   { 0*16,  1*16,  2*16,  3*16,  4*16,  5*16,  6*16,  7*16 },
105   { 0*16*8, 1*16*8, 2*16*8, 3*16*8, 4*16*8, 5*16*8, 6*16*8, 7*16*8 },
106   8 * 0x80
107};
108
109static GFXDECODE_START( vcombat )
110   GFXDECODE_ENTRY( "main", 0, vcombat_charlayout, 0, 256 )
111GFXDECODE_END
112
96113static MACHINE_DRIVER_START( vcombat )
97114   MDRV_CPU_ADD("main", M68000, XTAL_12MHz)
98115   MDRV_CPU_PROGRAM_MAP(main_map,0)
116   MDRV_CPU_VBLANK_INT("main", irq7_line_hold)         /* The only un-masked irq thus far */
99117
100118   MDRV_CPU_ADD("sound", M68000, XTAL_12MHz)
101119   MDRV_CPU_PROGRAM_MAP(sound_map,0)
120
102121/*
103122    Virtual combat has an i860 on each of its two upper boards.
104123    MDRV_CPU_ADD("video", i860, XTAL_20MHz)
r3957r3958
110129   MDRV_SCREEN_REFRESH_RATE(60)
111130   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
112131   MDRV_SCREEN_SIZE(640, 480)
132   MDRV_GFXDECODE(vcombat)
113133   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
114134
115   MDRV_PALETTE_LENGTH(0x100)
135   /*MDRV_PALETTE_LENGTH(0x100)*/
116136
137   MDRV_QUANTUM_TIME(HZ(120000))   /* Temporary */
138
117139   MDRV_VIDEO_UPDATE(vcombat)
118140MACHINE_DRIVER_END
119141
r3957r3958
137159   ROM_LOAD( "ds1220y.b53", 0x000, 0x800, CRC(b21cfe5f) SHA1(898ace3cd0913ea4b0dc84320219777773ef856f) )
138160
139161   /* These roms are identical on both of the upper boards */
140   ROM_REGION( 0x200000, "gfx1", 0 )
141   ROM_LOAD( "9.u54",  0x000000, 0x80000, CRC(a276e18b) SHA1(6d60e519196a4858b82241504592413df498e12f) )
142   ROM_LOAD( "10.u55", 0x080000, 0x80000, CRC(8921f20e) SHA1(6e9ca2eaad3e1108ba0e1d7792fd5d0305bec201) )
143   ROM_LOAD( "11.u56", 0x100000, 0x80000, CRC(a83094ce) SHA1(c3512375fecdb5e7eb02a4aa140ae4efe0233cb8) )
144   ROM_LOAD( "12.u57", 0x180000, 0x80000, CRC(0cdffd4f) SHA1(65ace78711b3ef6e0ff9a7ad7343b5558e652f6c) )
162   ROM_REGION( 0x200000, "3d", 0 )
163   ROM_LOAD16_BYTE( "11.u56", 0x000000, 0x80000, CRC(a83094ce) SHA1(c3512375fecdb5e7eb02a4aa140ae4efe0233cb8) )
164   ROM_LOAD16_BYTE( "9.u54",  0x000001, 0x80000, CRC(a276e18b) SHA1(6d60e519196a4858b82241504592413df498e12f) )
165   ROM_LOAD16_BYTE( "12.u57", 0x100000, 0x80000, CRC(0cdffd4f) SHA1(65ace78711b3ef6e0ff9a7ad7343b5558e652f6c) )
166   ROM_LOAD16_BYTE( "10.u55", 0x100001, 0x80000, CRC(8921f20e) SHA1(6e9ca2eaad3e1108ba0e1d7792fd5d0305bec201) )
145167
146168   ROM_REGION( 0x400, "plds", 0 )
147169   ROM_LOAD( "pal1_w2.u51", 0x000, 0x1f1, CRC(af497420) SHA1(03aa82189d91ae194dd5a6e7b9dbdb7cd473ddb6) )
r3957r3958
164186   ROM_REGION( 0x800, "user1", 0 )   /* The SRAM module */
165187   ROM_LOAD( "shadfgtr.b53", 0x000, 0x800, CRC(e766a3ab) SHA1(e7696ec08d5c86f64d768480f43edbd19ded162d) )
166188
167   ROM_REGION( 0x200000, "gfx1", 0 )
168   ROM_LOAD( "shadfgtr.u54", 0x000000, 0x80000, CRC(c45d68d6) SHA1(a133e4f13d3af18bccf0d060a659d64ac699b159) )
169   ROM_LOAD( "shadfgtr.u55", 0x080000, 0x80000, CRC(e807631d) SHA1(9027ff7dc60b808434dac292c08f0630d3d52186) )
170   ROM_LOAD( "shadfgtr.u56", 0x100000, 0x80000, CRC(fb76db5a) SHA1(fa546f465df113c13037abed1162bfa6f9b1dc9b) )
171   ROM_LOAD( "shadfgtr.u57", 0x180000, 0x80000, CRC(60d701d7) SHA1(936473b5e3b2e9e9e3b50cf977fc5a670a097850) )
189   /* These roms are identical on both of the upper boards */
190   ROM_REGION( 0x200000, "3d", 0 )
191   ROM_LOAD16_BYTE( "shadfgtr.u56", 0x000000, 0x80000, CRC(fb76db5a) SHA1(fa546f465df113c13037abed1162bfa6f9b1dc9b) )
192   ROM_LOAD16_BYTE( "shadfgtr.u54", 0x000001, 0x80000, CRC(c45d68d6) SHA1(a133e4f13d3af18bccf0d060a659d64ac699b159) )
193   ROM_LOAD16_BYTE( "shadfgtr.u57", 0x100000, 0x80000, CRC(60d701d7) SHA1(936473b5e3b2e9e9e3b50cf977fc5a670a097850) )
194   ROM_LOAD16_BYTE( "shadfgtr.u55", 0x100001, 0x80000, CRC(e807631d) SHA1(9027ff7dc60b808434dac292c08f0630d3d52186) )
172195
173196   ROM_REGION( 0x200, "plds", 0 )
174197   ROM_LOAD( "shadfgtr.u51", 0x000, 0x1f1, CRC(bab58337) SHA1(c4a79c8e53aeadb7f64d49d214b607b5b36f144e) )
src/mame/drivers/shangha3.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
2324#include "cpu/z80/z80.h"
2425#include "sound/ay8910.h"
2526#include "sound/okim6295.h"
src/mame/drivers/pkscram.c
r3957r3958
1212*/
1313
1414#include "driver.h"
15#include "cpu/m68000/m68000.h"
1516#include "sound/2203intf.h"
1617
1718static int interrupt_scanline=192;
src/mame/drivers/vastar.c
r3957r3958
6262***************************************************************************/
6363
6464#include "driver.h"
65#include "cpu/z80/z80.h"
6566#include "deprecat.h"
6667#include "sound/ay8910.h"
6768
r3957r3958
109110
110111static WRITE8_HANDLER( flip_screen_w )
111112{
112   flip_screen_set(data);
113   flip_screen_set(space->machine, data);
113114}
114115
115116
r3957r3958
317318   MDRV_CPU_IO_MAP(cpu2_port_map,0)
318319   MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)   /* ??? */
319320
320   MDRV_INTERLEAVE(10)   /* 10 CPU slices per frame - seems enough to ensure proper */
321   MDRV_QUANTUM_TIME(HZ(600))   /* 10 CPU slices per frame - seems enough to ensure proper */
321322                  /* synchronization of the CPUs */
322323   MDRV_MACHINE_RESET(vastar)
323324
src/mame/drivers/taotaido.c
r3957r3958
6464
6565
6666#include "driver.h"
67#include "cpu/z80/z80.h"
68#include "cpu/m68000/m68000.h"
6769#include "sound/2610intf.h"
6870#include "includes/taotaido.h"
6971
src/mame/drivers/fortecar.c
r3957r3958
2424*/
2525
2626#include "driver.h"
27#include "cpu/z80/z80.h"
2728#include "machine/eeprom.h"
2829#include "sound/ay8910.h"
2930#include "machine/8255ppi.h"
src/mame/drivers/relief.c
r3957r3958
1818
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "machine/atarigen.h"
2223#include "relief.h"
2324#include "sound/okim6295.h"
src/mame/drivers/gunpey.c
r3957r3958
4646*/
4747
4848#include "driver.h"
49#include "cpu/nec/nec.h"
4950
5051static UINT16 *unkram;
5152static UINT16 *mainram;
src/mame/drivers/taito_f3.c
r3957r3958
3636***************************************************************************/
3737
3838#include "driver.h"
39#include "cpu/m68000/m68000.h"
3940#include "machine/eeprom.h"
4041#include "taito_f3.h"
4142#include "sound/es5506.h"
src/mame/drivers/homerun.c
r3957r3958
1616*/
1717
1818#include "driver.h"
19#include "cpu/z80/z80.h"
1920#include "machine/8255ppi.h"
2021#include "sound/2203intf.h"
2122
src/mame/drivers/guab.c
r3957r3958
2020***************************************************************************/
2121
2222#include "driver.h"
23#include "cpu/m68000/m68000.h"
2324#include "machine/6840ptm.h"
2425#include "video/tms34061.h"
2526#include "sound/sn76496.h"
src/mame/drivers/baraduke.c
r3957r3958
105105***************************************************************************/
106106
107107#include "driver.h"
108#include "cpu/m6809/m6809.h"
108109#include "cpu/m6800/m6800.h"
109110#include "sound/namco.h"
110111
r3957r3958
401402   MDRV_CPU_IO_MAP(mcu_port_map,0)
402403   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
403404
404   MDRV_INTERLEAVE(100)      /* we need heavy synch */
405   MDRV_QUANTUM_TIME(HZ(6000))      /* we need heavy synch */
405406
406407   /* video hardware */
407408   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/champbas.c
r3957r3958
8181***************************************************************************/
8282
8383#include "driver.h"
84#include "cpu/z80/z80.h"
85#include "cpu/alph8201/alph8201.h"
8486#include "sound/ay8910.h"
8587#include "sound/dac.h"
8688
r3957r3958
128130{
129131   int bit = data & 1;
130132
131   cpu_interrupt_enable(0,bit);
133   cpu_interrupt_enable(space->machine->cpu[0],bit);
132134   if (!bit)
133135      cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
134136}
r3957r3958
637639   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
638640
639641   /* to MCU timeout champbbj */
640   MDRV_INTERLEAVE(50)
642   MDRV_QUANTUM_TIME(HZ(3000))
641643MACHINE_DRIVER_END
642644
643645
src/mame/drivers/mcr.c
r3957r3958
283283
284284
285285#include "driver.h"
286#include "cpu/z80/z80.h"
286287#include "deprecat.h"
287288#include "machine/z80ctc.h"
288289#include "machine/z80pio.h"
r3957r3958
15161517   MDRV_CPU_IO_MAP(cpu_90009_portmap,0)
15171518   MDRV_CPU_VBLANK_INT_HACK(mcr_interrupt,2)
15181519
1519   MDRV_Z80CTC_ADD("ctc", mcr_ctc_intf)
1520   MDRV_Z80CTC_ADD("ctc", MAIN_OSC_MCR_I/8 /* same as "main" */, mcr_ctc_intf)
15201521
15211522   MDRV_WATCHDOG_VBLANK_INIT(16)
15221523   MDRV_MACHINE_START(mcr)
r3957r3958
15781579   MDRV_IMPORT_FROM(mcr_90010)
15791580
15801581   /* basic machine hardware */
1581   MDRV_CPU_REPLACE("main", Z80, 5000000)
1582   MDRV_CPU_MODIFY("main")
1583   MDRV_CPU_CLOCK(5000000)
15821584   MDRV_CPU_PROGRAM_MAP(cpu_91490_map,0)
15831585   MDRV_CPU_IO_MAP(cpu_91490_portmap,0)
1586
1587   MDRV_DEVICE_MODIFY("ctc", Z80CTC)
1588   MDRV_DEVICE_CLOCK(5000000 /* same as "main" */)
15841589MACHINE_DRIVER_END
15851590
15861591
r3957r3958
16061611   MDRV_CPU_IO_MAP(ipu_91695_portmap,0)
16071612   MDRV_CPU_VBLANK_INT_HACK(mcr_ipu_interrupt,2)
16081613
1609   MDRV_Z80CTC_ADD("ipu_ctc", nflfoot_ctc_intf)
1614   MDRV_Z80CTC_ADD("ipu_ctc", 7372800/2 /* same as "ipu" */, nflfoot_ctc_intf)
16101615   MDRV_Z80PIO_ADD("ipu_pio0", nflfoot_pio_intf)
16111616   MDRV_Z80PIO_ADD("ipu_pio1", nflfoot_pio_intf)
1612   MDRV_Z80SIO_ADD("ipu_sio", nflfoot_sio_intf)
1617   MDRV_Z80SIO_ADD("ipu_sio", 7372800/2 /* same as "ipu" */, nflfoot_sio_intf)
16131618MACHINE_DRIVER_END
16141619
16151620
src/mame/drivers/beaminv.c
r3957r3958
5252***************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/z80/z80.h"
5556
5657
5758static UINT8 *beaminv_videoram;
src/mame/drivers/m107.c
r3957r3958
2424*******************************************************************************/
2525
2626#include "driver.h"
27#include "cpu/nec/nec.h"
2728#include "m107.h"
2829#include "iremipt.h"
2930#include "machine/irem_cpu.h"
3031#include "sound/2151intf.h"
3132#include "sound/iremga20.h"
32#include "cpu/nec/nec.h"
3333
3434
3535#define M107_IRQ_0 ((m107_irq_vectorbase+0)/4) /* VBL interrupt*/
src/mame/drivers/ninjaw.c
r3957r3958
190190***************************************************************************/
191191
192192#include "driver.h"
193#include "cpu/z80/z80.h"
193194#include "taitoipt.h"
194195#include "cpu/m68000/m68000.h"
195196#include "video/taitoic.h"
r3957r3958
631632   MDRV_CPU_PROGRAM_MAP(ninjaw_cpub_readmem,ninjaw_cpub_writemem)
632633   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
633634
634   MDRV_INTERLEAVE(100)   /* CPU slices */
635   MDRV_QUANTUM_TIME(HZ(6000))   /* CPU slices */
635636
636637   MDRV_MACHINE_START(ninjaw)
637638   MDRV_MACHINE_RESET(ninjaw)
r3957r3958
704705   MDRV_CPU_PROGRAM_MAP(darius2_cpub_readmem,darius2_cpub_writemem)
705706   MDRV_CPU_VBLANK_INT("left", irq4_line_hold)
706707
707   MDRV_INTERLEAVE(100)   /* CPU slices */
708   MDRV_QUANTUM_TIME(HZ(6000))   /* CPU slices */
708709
709710   MDRV_MACHINE_START(ninjaw)
710711   MDRV_MACHINE_RESET(ninjaw)
src/mame/drivers/matmania.c
r3957r3958
329329   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
330330   MDRV_CPU_VBLANK_INT_HACK(nmi_line_pulse,15)   /* ???? */
331331                        /* IRQs are caused by the main CPU */
332   MDRV_INTERLEAVE(10)
332   MDRV_QUANTUM_TIME(HZ(600))
333333
334334   /* video hardware */
335335   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
386386   MDRV_CPU_ADD("mcu", M68705, 1500000*2)   /* (don't know really how fast, but it doesn't need to even be this fast) */
387387   MDRV_CPU_PROGRAM_MAP(mcu_readmem,mcu_writemem)
388388
389   MDRV_INTERLEAVE(100)   /* 100 CPU slice per frame - high interleaving to sync main and mcu */
389   MDRV_QUANTUM_TIME(HZ(6000))   /* 100 CPU slice per frame - high interleaving to sync main and mcu */
390390
391391   /* video hardware */
392392   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/arkanoid.c
r3957r3958
469469***************************************************************************/
470470
471471#include "driver.h"
472#include "cpu/z80/z80.h"
472473#include "arkanoid.h"
473474#include "sound/ay8910.h"
474475#include "cpu/m6805/m6805.h"
r3957r3958
767768   MDRV_CPU_ADD("mcu", M68705, XTAL_12MHz/4) /* verified on pcb */
768769   MDRV_CPU_PROGRAM_MAP(mcu_map, 0)
769770
770   MDRV_INTERLEAVE(100)               // 100 CPU slices per second to synchronize between the MCU and the main CPU
771   MDRV_QUANTUM_TIME(HZ(6000))               // 100 CPU slices per second to synchronize between the MCU and the main CPU
771772
772773   MDRV_MACHINE_START(arkanoid)
773774   MDRV_MACHINE_RESET(arkanoid)
r3957r3958
10491050   ROM_LOAD( "82s129.5kl",   0x0300, 0x0100, CRC(085d625a) SHA1(26c96a1c1b7562fed84c31dd92fdf7829e96a9c7) )   /* green component = a75-08.bpr*/
10501051   ROM_LOAD( "82s129.5mn",   0x0400, 0x0100, CRC(0fe0b108) SHA1(fcf27619208922345a1e42b3a219b4274f66968d) )   /* blue component  + */
10511052   ROM_LOAD( "63s141.5m",    0x0500, 0x0100, CRC(5553f675) SHA1(c50255af8d99664b92e0bb34a527fd42ebf7e759) )   /* blue component  = a75-09.bpr*/
1053
1054   ROM_REGION( 0x0200, "pal", ROMREGION_DISPOSE )
1055   ROM_LOAD( "pal16r8.5f",   0x0000, 0x0104, CRC(36471917) SHA1(d0f295a94d480b44416e66be4b480b299aad5c3c) )
10521056ROM_END
10531057
10541058ROM_START( paddle2 )
src/mame/drivers/twin16.c
r3957r3958
905905   MDRV_CPU_ADD("audio", Z80, 3579545)
906906   MDRV_CPU_PROGRAM_MAP(sound_map,0)
907907
908   MDRV_INTERLEAVE(100)
908   MDRV_QUANTUM_TIME(HZ(6000))
909909
910910   // video hardware
911911   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r3957r3958
945945
946946static MACHINE_DRIVER_START( devilw )
947947   MDRV_IMPORT_FROM(twin16)
948   MDRV_INTERLEAVE(1000)
948   MDRV_QUANTUM_TIME(HZ(60000))
949949MACHINE_DRIVER_END
950950
951951static MACHINE_DRIVER_START( fround )
r3957r3958
957957   MDRV_CPU_ADD("audio", Z80, 3579545)
958958   MDRV_CPU_PROGRAM_MAP(sound_map,0)
959959
960   MDRV_INTERLEAVE(100)
960   MDRV_QUANTUM_TIME(HZ(6000))
961961
962962   /* video hardware */
963963   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/megasys1.c
r3957r3958
118118#define OKI4_SOUND_CLOCK   XTAL_4MHz
119119
120120#include "driver.h"
121#include "cpu/z80/z80.h"
122#include "cpu/m68000/m68000.h"
121123#include "deprecat.h"
122124#include "megasys1.h"
123125#include "sound/2203intf.h"
r3957r3958
604606   MDRV_CPU_ADD("sound", M68000, SOUND_CPU_CLOCK) /* 7MHz verified */
605607   MDRV_CPU_PROGRAM_MAP(sound_readmem_A,sound_writemem_A)
606608
607   MDRV_INTERLEAVE(2000)
609   MDRV_QUANTUM_TIME(HZ(120000))
608610
609611   MDRV_MACHINE_RESET(megasys1)
610612
src/mame/drivers/crshrace.c
r3957r3958
127127***************************************************************************/
128128
129129#include "driver.h"
130#include "cpu/z80/z80.h"
131#include "cpu/m68000/m68000.h"
130132#include "video/konamiic.h"
131133#include "sound/2610intf.h"
132134#include "crshrace.h"
src/mame/drivers/airbustr.c
r3957r3958
301301{
302302   airbustr_bankswitch(space->machine, "slave", 2, data);
303303
304   flip_screen_set(data & 0x10);
304   flip_screen_set(space->machine, data & 0x10);
305305
306306   // used at the end of levels, after defeating the boss, to leave trails
307307   pandora_set_clear_bitmap(data&0x20);
r3957r3958
619619   MDRV_CPU_IO_MAP(sound_io_map, 0)
620620   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)      // nmi are caused by sub cpu writing a sound command
621621
622   MDRV_INTERLEAVE(100)   // Palette RAM is filled by sub cpu with data supplied by main cpu
622   MDRV_QUANTUM_TIME(HZ(6000))   // Palette RAM is filled by sub cpu with data supplied by main cpu
623623                     // Maybe a high value is safer in order to avoid glitches
624624   MDRV_MACHINE_RESET(airbustr)
625   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
625   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
626626
627627   // video hardware
628628
r3957r3958
656656
657657static MACHINE_DRIVER_START( airbusb )
658658   MDRV_IMPORT_FROM(airbustr)
659   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(0)) // no protection device or watchdog
659   MDRV_WATCHDOG_TIME_INIT(SEC(0)) // no protection device or watchdog
660660MACHINE_DRIVER_END
661661
662662
src/mame/drivers/clshroad.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/z80/z80.h"
2122#include "sound/custom.h"
2223
2324/* Variables & functions defined in video: */
r3957r3958
4344
4445static MACHINE_RESET( clshroad )
4546{
46   flip_screen_set(0);
47   flip_screen_set(machine, 0);
4748}
4849
4950
src/mame/drivers/pacman.c
r3957r3958
337337****************************************************************************/
338338
339339#include "driver.h"
340#include "cpu/z80/z80.h"
340341#include "deprecat.h"
341342#include "pacman.h"
342343#include "cpu/s2650/s2650.h"
src/mame/drivers/dcheese.c
r3957r3958
2929
3030
3131#include "driver.h"
32#include "cpu/m6809/m6809.h"
33#include "cpu/m68000/m68000.h"
3234#include "machine/eeprom.h"
3335#include "machine/ticket.h"
3436#include "sound/bsmt2000.h"
src/mame/drivers/parentj.c
r0r3958
1/* Taito
2 'Parent Jack'
3 (Medal Game)
4*/
5
6
7
8#include "driver.h"
9#include "cpu/m68000/m68000.h"
10
11static UINT16* parentj_video;
12
13VIDEO_START(parentj)
14{
15
16
17}
18
19VIDEO_UPDATE(parentj)
20{
21   const gfx_element *gfx = screen->machine->gfx[0];
22   int count = 0x0c000/2;
23
24   int y,x;
25
26
27   for (y=0;y<64;y++)
28   {
29      for (x=0;x<64;x++)
30      {
31         int tile = parentj_video[count];
32         //int colour = tile>>12;
33         drawgfx(bitmap,gfx,tile,9,0,0,x*16,y*16,cliprect,TRANSPARENCY_NONE,0);
34
35         count++;
36      }
37   }
38
39
40   return 0;
41}
42
43static ADDRESS_MAP_START( parentj_map, ADDRESS_SPACE_PROGRAM, 16 )
44   AM_RANGE(0x000000, 0x01ffff) AM_ROM
45   AM_RANGE(0x100000, 0x103fff) AM_RAM
46
47
48   AM_RANGE(0x200004, 0x200005) AM_WRITE(SMH_NOP)
49
50   AM_RANGE(0x400000, 0x41ffff) AM_RAM AM_BASE(&parentj_video)
51
52   AM_RANGE(0x500800, 0x500fff) AM_RAM AM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
53
54
55ADDRESS_MAP_END
56
57
58
59static const gfx_layout parentj_layout =
60{
61   16,16,
62   RGN_FRAC(1,8),
63   4,
64   { 0,1,2,3 },
65   { RGN_FRAC(7,8)+4, RGN_FRAC(7,8)+0,
66     RGN_FRAC(6,8)+4, RGN_FRAC(6,8)+0,
67     RGN_FRAC(5,8)+4, RGN_FRAC(5,8)+0,
68     RGN_FRAC(4,8)+4, RGN_FRAC(4,8)+0,
69     RGN_FRAC(3,8)+4, RGN_FRAC(3,8)+0,
70     RGN_FRAC(2,8)+4, RGN_FRAC(2,8)+0,
71     RGN_FRAC(1,8)+4, RGN_FRAC(1,8)+0,
72     RGN_FRAC(0,8)+4, RGN_FRAC(0,8)+0
73     },
74   { 0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120},
75
76   1*128
77};
78
79static GFXDECODE_START( parentj )
80   GFXDECODE_ENTRY( "gfx1", 0, parentj_layout,  0x0, 0x400/16  )
81GFXDECODE_END
82
83
84static INPUT_PORTS_START( parentj )
85INPUT_PORTS_END
86
87static MACHINE_DRIVER_START( parentj )
88   MDRV_CPU_ADD("main", M68000, 16000000)   // ?
89   MDRV_CPU_PROGRAM_MAP(parentj_map,0)
90   MDRV_CPU_VBLANK_INT("main", irq4_line_hold) // 4/5/6 valid?
91
92   MDRV_GFXDECODE(parentj)
93
94   MDRV_SCREEN_ADD("main", RASTER)
95   MDRV_SCREEN_REFRESH_RATE(60)
96   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
97   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
98   MDRV_SCREEN_SIZE(64*16, 64*16)
99   MDRV_SCREEN_VISIBLE_AREA(32*16, 64*16-1, 0*16, 32*16-1)
100
101   MDRV_PALETTE_LENGTH(0x400)
102
103   MDRV_VIDEO_START(parentj)
104   MDRV_VIDEO_UPDATE(parentj)
105MACHINE_DRIVER_END
106
107
108ROM_START( parentj )
109   ROM_REGION( 0x20000, "main", 0 ) /* 68000 Code */
110   ROM_LOAD16_BYTE( "c42-13.21", 0x00000, 0x10000, CRC(823623eb) SHA1(7302cc0ac532f6190ae35218ea05bf8cf11fd687) )
111   ROM_LOAD16_BYTE( "c42-12.20", 0x00001, 0x10000, CRC(8654b0ab) SHA1(edd23a731c1c60cab353e51ef5e66d33bc3fde61) )
112
113   ROM_REGION( 0x100000, "gfx1", 0 )
114   ROM_LOAD( "c42-05.06", 0x00000, 0x20000, CRC(7af0d45d) SHA1(bc527b74185596e4e77b34d08eb3e1678614b451) )
115   ROM_LOAD( "c42-04.05", 0x20000, 0x20000, CRC(133009a1) SHA1(fae5dd600384790225c24a62d1f8a00f0366dae9) )
116   ROM_LOAD( "c42-09.13", 0x40000, 0x20000, CRC(ba35fb03) SHA1(b76e50d298ccc0f230c865b563cd8e02866a4ffb) )
117   ROM_LOAD( "c42-08.12", 0x60000, 0x20000, CRC(7fae35a7) SHA1(f4bc6c6fd4afc167eb36b8f16589e1bfd729085e) )
118   ROM_LOAD( "c42-07.10", 0x80000, 0x20000, CRC(f92c6f03) SHA1(ff42318ee425b423b67e2cec1fe3ef9d9785ebf6) )
119   ROM_LOAD( "c42-06.09", 0xa0000, 0x20000, CRC(3685febd) SHA1(637946377f6d934f791d52e9790c91f60a5b2c65) )
120   ROM_LOAD( "c42-11.17", 0xc0000, 0x20000, CRC(5d8d3c59) SHA1(c8a8a957ac9f2f1c346b4504495893c71fbfe14b) )
121   ROM_LOAD( "c42-10.16", 0xe0000, 0x20000, CRC(e85e536e) SHA1(9ed9e316869333338e39cb0d1293e3380861a3ca) )
122
123   ROM_REGION( 0x2dd, "misc", 0 )
124   ROM_LOAD( "ampal22v10a-0233.c42", 0x000, 0x2dd, CRC(0c030a81) SHA1(0f8198df2cb046683d2db9ac8e609cdff53083ed) )
125ROM_END
126
127GAME( 199?, parentj,    0,        parentj,   parentj,    0, ROT0,  "Taito", "Parent Jack", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/chqflag.c
r3957r3958
354354   MDRV_CPU_ADD("audio", Z80, XTAL_3_579545MHz) /* verified on pcb */
355355   MDRV_CPU_PROGRAM_MAP(chqflag_readmem_sound,chqflag_writemem_sound)
356356
357   MDRV_INTERLEAVE(10)
357   MDRV_QUANTUM_TIME(HZ(600))
358358
359359   /* video hardware */
360360   MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
src/mame/drivers/bwing.c
r3957r3958
399399   MDRV_CPU_IO_MAP(bwp3_io_map,0)
400400   MDRV_CPU_PERIODIC_INT(bwp3_interrupt, 1000)
401401
402   MDRV_INTERLEAVE(300)      // high enough?
402   MDRV_QUANTUM_TIME(HZ(18000))      // high enough?
403403
404404   MDRV_MACHINE_RESET(bwing)
405405
src/mame/drivers/srmp6.c
r3957r3958
6767
6868
6969#include "driver.h"
70#include "cpu/m68000/m68000.h"
7071#include "deprecat.h"
7172#include "sound/nile.h"
7273
src/mame/drivers/lsasquad.c
r3957r3958
147147***************************************************************************/
148148
149149#include "driver.h"
150#include "cpu/z80/z80.h"
150151#include "cpu/m6805/m6805.h"
151152#include "sound/ay8910.h"
152153#include "sound/2203intf.h"
r3957r3958
162163   /* bit 3 is zeroed on startup, maybe reset sound CPU */
163164
164165   /* bit 4 flips screen */
165   flip_screen_set(data & 0x10);
166   flip_screen_set(space->machine, data & 0x10);
166167
167168   /* other bits unknown */
168169}
r3957r3958
569570   MDRV_CPU_ADD("mcu", M68705,4000000)   /* ? */
570571   MDRV_CPU_PROGRAM_MAP(m68705_readmem,m68705_writemem)
571572
572   MDRV_INTERLEAVE(500)   /* 500 CPU slices per frame - an high value to ensure proper */
573   MDRV_QUANTUM_TIME(HZ(30000))   /* 500 CPU slices per frame - an high value to ensure proper */
573574                     /* synchronization of the CPUs */
574575                     /* main<->sound synchronization depends on this */
575576
r3957r3958
612613   MDRV_CPU_PROGRAM_MAP(sound_mem_daikaiju, 0)
613614   /* IRQs are triggered by the YM2203 */
614615
615   MDRV_INTERLEAVE(500)   /* 500 CPU slices per frame - an high value to ensure proper */
616   MDRV_QUANTUM_TIME(HZ(30000))   /* 500 CPU slices per frame - an high value to ensure proper */
616617                     /* synchronization of the CPUs */
617618                     /* main<->sound synchronization depends on this */
618619
src/mame/drivers/cball.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6800/m6800.h"
89
910static UINT8* cball_video_ram;
1011
src/mame/drivers/sengokmj.c
r3957r3958
5252*******************************************************************************************/
5353
5454#include "driver.h"
55#include "cpu/nec/nec.h"
5556#include "audio/seibu.h"
5657#include "sound/3812intf.h"
5758
src/mame/drivers/cave.c
r3957r3958
6969***************************************************************************/
7070
7171#include "driver.h"
72#include "cpu/m68000/m68000.h"
7273#include "machine/eeprom.h"
7374#include "machine/nmk112.h"
7475#include "cpu/z80/z80.h"
r3957r3958
23252326   MDRV_CPU_PROGRAM_MAP(mazinger_sound_readmem,mazinger_sound_writemem)
23262327   MDRV_CPU_IO_MAP(mazinger_sound_readport,mazinger_sound_writeport)
23272328
2328   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
2329   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
23292330
23302331   MDRV_MACHINE_RESET(cave)
23312332   MDRV_NVRAM_HANDLER(cave)
r3957r3958
23812382   MDRV_CPU_PROGRAM_MAP(metmqstr_sound_readmem,metmqstr_sound_writemem)
23822383   MDRV_CPU_IO_MAP(metmqstr_sound_readport,metmqstr_sound_writeport)
23832384
2384   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_SEC(3))   /* a guess, and certainly wrong */
2385   MDRV_WATCHDOG_TIME_INIT(SEC(3))   /* a guess, and certainly wrong */
23852386
23862387   MDRV_MACHINE_RESET(cave)   /* start with the watchdog armed */
23872388   MDRV_NVRAM_HANDLER(cave)
r3957r3958
24972498   MDRV_CPU_PROGRAM_MAP(sailormn_sound_readmem,sailormn_sound_writemem)
24982499   MDRV_CPU_IO_MAP(sailormn_sound_readport,sailormn_sound_writeport)
24992500
2500//  MDRV_INTERLEAVE(10)
2501//  MDRV_QUANTUM_TIME(HZ(600))
25012502
25022503   MDRV_MACHINE_RESET(cave)
25032504   MDRV_NVRAM_HANDLER(cave)
src/mame/drivers/cham24.c
r3957r3958
5555*/
5656
5757#include "driver.h"
58#include "deprecat.h"
5958#include "video/ppu2c0x.h"
6059#include "sound/nes_apu.h"
6160#include "cpu/m6502/m6502.h"
r3957r3958
203202
204203   memcpy( &dst[0x8000], &src[0x0f8000], 0x4000 );
205204   memcpy( &dst[0xc000], &src[0x0f8000], 0x4000 );
206   cpu_reset(machine->cpu[0]);
205   device_reset(machine->cpu[0]);
207206
208207   /* reset the ppu */
209208   ppu2c0x_reset( machine, 0, 1 );
r3957r3958
214213   ppu2c0x_init_palette(machine, 0 );
215214}
216215
217static void ppu_irq( int num, int *ppu_regs )
216static void ppu_irq( running_machine *machine, int num, int *ppu_regs )
218217{
219   cpu_set_input_line(Machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
218   cpu_set_input_line(machine->cpu[num], INPUT_LINE_NMI, PULSE_LINE );
220219}
221220
222221/* our ppu interface                                            */
src/mame/drivers/dooyong.c
r3957r3958
5050***************************************************************************/
5151
5252#include "driver.h"
53#include "cpu/z80/z80.h"
54#include "cpu/m68000/m68000.h"
5355#include "deprecat.h"
5456#include "sound/2203intf.h"
5557#include "sound/2151intf.h"
r3957r3958
7173
7274static WRITE8_HANDLER( flip_screen_w )
7375{
74   flip_screen_set(data);
76   flip_screen_set(space->machine, data);
7577}
7678
7779/***************************************************************************
src/mame/drivers/brkthru.c
r3957r3958
7272static WRITE8_HANDLER( brkthru_1803_w )
7373{
7474   /* bit 0 = NMI enable */
75   cpu_interrupt_enable(0, ~data & 1);
75   cpu_interrupt_enable(space->machine->cpu[0], ~data & 1);
7676
7777   /* bit 1 = ? maybe IRQ acknowledge */
7878}
7979static WRITE8_HANDLER( darwin_0803_w )
8080{
8181   /* bit 0 = NMI enable */
82   /*cpu_interrupt_enable(1, ~data & 1);*/
82   /*cpu_interrupt_enable(space->machine->cpu[1], ~data & 1);*/
8383   logerror("0803 %02X\n",data);
84   cpu_interrupt_enable(0, data & 1);
84   cpu_interrupt_enable(space->machine->cpu[0], data & 1);
8585   /* bit 1 = ? maybe IRQ acknowledge */
8686}
8787
src/mame/drivers/comebaby.c
r3957r3958
5757*/
5858
5959#include "driver.h"
60#include "cpu/i386/i386.h"
6061
6162static VIDEO_START(comebaby)
6263{
src/mame/drivers/williams.c
r3957r3958
492492***************************************************************************/
493493
494494#include "driver.h"
495#include "cpu/m6809/m6809.h"
496#include "cpu/m6800/m6800.h"
495497#include "machine/6821pia.h"
496498#include "audio/williams.h"
497499#include "williams.h"
src/mame/drivers/fuukifg3.c
r3957r3958
158158
159159
160160#include "driver.h"
161#include "cpu/z80/z80.h"
162#include "cpu/m68000/m68000.h"
161163#include "sound/262intf.h"
162164#include "sound/ymf278b.h"
163165
src/mame/drivers/dec8.c
r3957r3958
3838***************************************************************************/
3939
4040#include "driver.h"
41#include "cpu/hd6309/hd6309.h"
4142#include "cpu/m6809/m6809.h"
4243#include "cpu/m6502/m6502.h"
4344#include "sound/2203intf.h"
r3957r3958
367368
368369   if (data&1) int_enable=1; else int_enable=0;
369370   if (data&2) nmi_enable=1; else nmi_enable=0;
370   flip_screen_set(data & 0x08);
371   flip_screen_set(space->machine, data & 0x08);
371372}
372373
373374static WRITE8_HANDLER( csilver_control_w )
r3957r3958
493494
494495static READ8_HANDLER( shackled_sprite_r ) { return spriteram[offset]; }
495496static WRITE8_HANDLER( shackled_sprite_w ) { spriteram[offset]=data; }
496static WRITE8_HANDLER( flip_screen_w ) {   flip_screen_set(data); }
497static WRITE8_HANDLER( flip_screen_w ) {   flip_screen_set(space->machine, data); }
497498
498499/******************************************************************************/
499500
r3957r3958
22222223   MDRV_CPU_ADD("audio", M6502, XTAL_12MHz/8)
22232224   MDRV_CPU_PROGRAM_MAP(dec8_s_readmem,oscar_s_writemem)
22242225                        /* NMIs are caused by the main CPU */
2225   MDRV_INTERLEAVE(40) /* 40 CPU slices per frame */
2226   MDRV_QUANTUM_TIME(HZ(2400)) /* 40 CPU slices per frame */
22262227
22272228   /* video hardware */
22282229   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r3957r3958
22662267   MDRV_CPU_ADD("audio", M6502, 1500000)
22672268   MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem)
22682269                        /* NMIs are caused by the main CPU */
2269   MDRV_INTERLEAVE(200)
2270   MDRV_QUANTUM_TIME(HZ(12000))
22702271
22712272   /* video hardware */
22722273   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r3957r3958
23102311   MDRV_CPU_ADD("audio", M6502, 1500000)
23112312   MDRV_CPU_PROGRAM_MAP(ym3526_s_readmem,ym3526_s_writemem)
23122313                        /* NMIs are caused by the main CPU */
2313   MDRV_INTERLEAVE(80)
2314   MDRV_QUANTUM_TIME(HZ(4800))
23142315
23152316   /* video hardware */
23162317   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
r3957r3958
23552356   MDRV_CPU_ADD("audio", M6502, XTAL_12MHz/8) /* verified on pcb */
23562357   MDRV_CPU_PROGRAM_MAP(csilver_s_readmem,csilver_s_writemem)
23572358                        /* NMIs are caused by the main CPU */
2358   MDRV_INTERLEAVE(100)
2359   MDRV_QUANTUM_TIME(HZ(6000))
23592360
23602361   /* video hardware */
23612362   MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
src/mame/drivers/tbowl.c
r3957r3958
493493   MDRV_CPU_ADD("audio", Z80, 4000000) /* Actual Z80 */
494494   MDRV_CPU_PROGRAM_MAP(6206A_map,0)
495495
496   MDRV_INTERLEAVE(100)
496   MDRV_QUANTUM_TIME(HZ(6000))
497497
498498   /* video hardware */
499499   MDRV_GFXDECODE(tbowl)
src/mame/drivers/battlane.c
r3957r3958
4646        0x01    = Y Scroll MSB
4747    */
4848
49   flip_screen_set(data & 0x80);
49   flip_screen_set(space->machine, data & 0x80);
5050
5151   /*
5252        I think that the NMI is an inhibitor. It is constantly set
r3957r3958
262262   MDRV_CPU_ADD("sub", M6809, 1250000)        /* 1.25 MHz ? */
263263   MDRV_CPU_PROGRAM_MAP(battlane_map, 0)
264264
265   MDRV_INTERLEAVE(100)
265   MDRV_QUANTUM_TIME(HZ(6000))
266266
267267   /* video hardware */
268268   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/cherrym2.c
r3957r3958
2525*/
2626
2727#include "driver.h"
28#include "cpu/z80/z80.h"
2829#include "sound/ay8910.h"
2930/* video */
3031
src/mame/drivers/rbmk.c
r3957r3958
5050*/
5151
5252#include "driver.h"
53#include "cpu/m68000/m68000.h"
5354#include "sound/okim6295.h"
5455#include "machine/eeprom.h"
5556
src/mame/drivers/bigfghtr.c
r3957r3958
109109
110110**********************************************************************/
111111#include "driver.h"
112#include "cpu/z80/z80.h"
113#include "cpu/m68000/m68000.h"
112114#include "deprecat.h"
113115#include "sound/dac.h"
114116#include "sound/okim6295.h"
r3957r3958
286288static WRITE16_HANDLER( io_w )
287289{
288290   COMBINE_DATA(&vreg);
289   flip_screen_set(vreg & 0x1000);
291   flip_screen_set(space->machine, vreg & 0x1000);
290292}
291293
292294static int read_latch=0;
src/mame/drivers/genesis.c
r3957r3958
1212*/
1313
1414#include "driver.h"
15#include "cpu/z80/z80.h"
16#include "cpu/m68000/m68000.h"
1517#include "genesis.h"
1618
1719#define MASTER_CLOCK      53693100
r3957r3958
148150MACHINE_RESET( genesis )
149151{
150152   /* C2 doesn't have a Z80, so we can't just assume */
151   if (machine->config->cpu[1].type == CPU_Z80)
153   if (machine->cpu[1] != NULL && cpu_get_type(machine->cpu[1]) == CPU_Z80)
152154   {
153155       /* the following ensures that the Z80 begins without running away from 0 */
154156      /* 0x76 is just a forced 'halt' as soon as the CPU is initially run */
r3957r3958
651653   MDRV_CPU_PROGRAM_MAP(genesis_z80_readmem, genesis_z80_writemem)
652654   MDRV_CPU_VBLANK_INT("main", irq0_line_hold) /* from vdp at scanline 0xe0 */
653655
654   MDRV_INTERLEAVE(100)
656   MDRV_QUANTUM_TIME(HZ(6000))
655657
656658   MDRV_MACHINE_START(genesis)
657659   MDRV_MACHINE_RESET(genesis)
src/mame/drivers/thepit.c
r3957r3958
115115***************************************************************************/
116116
117117#include "driver.h"
118#include "cpu/z80/z80.h"
118119#include "sound/ay8910.h"
119120
120121
src/mame/drivers/trvmadns.c
r3957r3958
6161*/
6262
6363#include "driver.h"
64#include "cpu/z80/z80.h"
6465#include "sound/ay8910.h"
6566
6667static tilemap *bg_tilemap;
src/mame/drivers/cloud9.c
r3957r3958
9191***************************************************************************/
9292
9393#include "driver.h"
94#include "cpu/m6502/m6502.h"
9495#include "sound/pokey.h"
9596#include "cloud9.h"
9697
src/mame/drivers/rpunch.c
r3957r3958
105105
106106
107107#include "driver.h"
108#include "cpu/z80/z80.h"
109#include "cpu/m68000/m68000.h"
108110#include "cpu/m6809/m6809.h"
109111#include "sound/2151intf.h"
110112#include "sound/upd7759.h"
src/mame/drivers/crimfght.c
r3957r3958
1212***************************************************************************/
1313
1414#include "driver.h"
15#include "cpu/z80/z80.h"
1516#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1617#include "video/konamiic.h"
1718#include "sound/2151intf.h"
src/mame/drivers/rabbit.c
r3957r3958
8181*/
8282
8383#include "driver.h"
84#include "cpu/m68000/m68000.h"
8485#include "deprecat.h"
8586#include "machine/eeprom.h"
8687
src/mame/drivers/sstrangr.c
r3957r3958
66
77
88#include "driver.h"
9#include "cpu/i8085/i8085.h"
910#include "deprecat.h"
1011
1112
src/mame/drivers/asuka.c
r3957r3958
213213***************************************************************************/
214214
215215#include "driver.h"
216#include "cpu/z80/z80.h"
217#include "cpu/m68000/m68000.h"
216218#include "taitoipt.h"
217219#include "video/taitoic.h"
218220#include "audio/taitosnd.h"
r3957r3958
795797   MDRV_CPU_ADD("audio", Z80,4000000)    /* sound CPU, also required for test mode */
796798   MDRV_CPU_PROGRAM_MAP(bonzeadv_z80_map,0)
797799
798   MDRV_INTERLEAVE(10)
800   MDRV_QUANTUM_TIME(HZ(600))
799801
800802   /* video hardware */
801803   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
834836   MDRV_CPU_ADD("audio", Z80, XTAL_16MHz/4)   /* verified on pcb */
835837   MDRV_CPU_PROGRAM_MAP(z80_map,0)
836838
837   MDRV_INTERLEAVE(10)
839   MDRV_QUANTUM_TIME(HZ(600))
838840
839841   /* video hardware */
840842   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
876878   MDRV_CPU_ADD("audio", Z80, XTAL_8MHz/2)   /* verified on pcb */
877879   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
878880
879   MDRV_INTERLEAVE(10)
881   MDRV_QUANTUM_TIME(HZ(600))
880882
881883   /* video hardware */
882884   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
914916   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz ??? */
915917   MDRV_CPU_PROGRAM_MAP(z80_map,0)
916918
917   MDRV_INTERLEAVE(10)
919   MDRV_QUANTUM_TIME(HZ(600))
918920
919921   /* video hardware */
920922   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
956958   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz ??? */
957959   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
958960
959   MDRV_INTERLEAVE(10)
961   MDRV_QUANTUM_TIME(HZ(600))
960962
961963   /* video hardware */
962964   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
994996   MDRV_CPU_ADD("audio", Z80, 4000000)   /* 4 MHz ??? */
995997   MDRV_CPU_PROGRAM_MAP(cadash_z80_map,0)
996998
997   MDRV_INTERLEAVE(10)
999   MDRV_QUANTUM_TIME(HZ(600))
9981000
9991001   /* video hardware */
10001002   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/triplhnt.c
r3957r3958
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/m6800/m6800.h"
1415#include "triplhnt.h"
1516
1617static UINT8 triplhnt_cmos[16];
src/mame/drivers/pooyan.c
r3957r3958
99***************************************************************************/
1010
1111#include "driver.h"
12#include "cpu/z80/z80.h"
1213#include "pooyan.h"
1314#include "audio/timeplt.h"
1415
src/mame/drivers/backfire.c
r3957r3958
9191{
9292   int offs;
9393
94   flip_screen_set_no_update(1);
94   flip_screen_set_no_update(machine, 1);
9595
9696   for (offs = (0x1400/4)-4;offs >= 0;offs -= 4) // 0x1400 for charlien
9797   {
r3957r3958
141141         inc = 1;
142142      }
143143
144      if (flip_screen_x_get())
144      if (flip_screen_x_get(machine))
145145      {
146146         y=240-y;
147147         x=304-x;
src/mame/drivers/cubeqst.c
r3957r3958
1818****************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/m68000/m68000.h"
2122#include "cpu/cubeqcpu/cubeqcpu.h"
2223#include "sound/dac.h"
2324#include "sound/custom.h"
r3957r3958
504505   MDRV_CPU_PROGRAM_MAP(line_sound_map, 0)
505506   MDRV_CPU_CONFIG(snd_config)
506507
507   MDRV_INTERLEAVE(800)
508   MDRV_QUANTUM_TIME(HZ(48000))
508509
509510   MDRV_MACHINE_START(cubeqst)
510511   MDRV_MACHINE_RESET(cubeqst)
src/mame/drivers/rollerg.c
r3957r3958
77***************************************************************************/
88
99#include "driver.h"
10#include "cpu/z80/z80.h"
1011#include "video/konamiic.h"
1112#include "cpu/konami/konami.h" /* for the callback and the firq irq definition */
1213#include "machine/eeprom.h"
src/mame/drivers/starwars.c
r3957r3958
320320   MDRV_CPU_ADD("main", M6809, MASTER_CLOCK / 8)
321321   MDRV_CPU_PROGRAM_MAP(main_map,0)
322322   MDRV_CPU_PERIODIC_INT(irq0_line_assert, (double)MASTER_CLOCK / 4096 / 12)
323   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ(CLOCK_3KHZ / 128))
323   MDRV_WATCHDOG_TIME_INIT(HZ(CLOCK_3KHZ / 128))
324324
325325   MDRV_CPU_ADD("audio", M6809, MASTER_CLOCK / 8)
326326   MDRV_CPU_PROGRAM_MAP(sound_map,0)
src/mame/drivers/wolfpack.c
r3957r3958
55***************************************************************************/
66
77#include "driver.h"
8#include "cpu/m6502/m6502.h"
89#include "sound/s14001a.h"
910
1011extern int wolfpack_collision;
src/mame/drivers/pirates.c
r3957r3958
8888---*/
8989
9090#include "driver.h"
91#include "cpu/m68000/m68000.h"
9192#include "machine/eeprom.h"
9293#include "sound/okim6295.h"
9394
src/mame/drivers/exerion.c
r3957r3958
1414***************************************************************************/
1515
1616#include "driver.h"
17#include "cpu/z80/z80.h"
1718#include "exerion.h"
1819#include "sound/ay8910.h"
1920
src/mame/drivers/wrally.c
r3957r3958
256256   MDRV_CPU_PROGRAM_MAP(dallas_rom, 0)
257257   MDRV_CPU_IO_MAP(dallas_ram, 0)
258258
259   MDRV_INTERLEAVE(640)               /* heavy sync */
259   MDRV_QUANTUM_TIME(HZ(38400))               /* heavy sync */
260260
261261   /* video hardware */
262262   MDRV_SCREEN_ADD("main", RASTER)
src/mame/drivers/segas18.c
r3957r3958
2828***************************************************************************/
2929
3030#include "driver.h"
31#include "cpu/z80/z80.h"
32#include "cpu/m68000/m68000.h"
33#include "cpu/mcs51/mcs51.h"
3134#include "deprecat.h"
3235#include "machine/segaic16.h"
3336#include "system16.h"
r3957r3958
202205   fd1094_machine_init(machine->cpu[0]);
203206
204207   /* if we are running with a real live 8751, we need to boost the interleave at startup */
205   if (machine->config->cpu[2].type == CPU_I8751)
208   if (machine->cpu[2] != NULL && cpu_get_type(machine->cpu[2]) == CPU_I8751)
206209      timer_call_after_resynch(machine, NULL, 0, boost_interleave);
207210}
208211
src/mame/drivers/meijinsn.c
r3957r3958
5959
6060*/
6161#include "driver.h"
62#include "cpu/z80/z80.h"
63#include "cpu/m68000/m68000.h"
6264#include "deprecat.h"
6365#include "video/resnet.h"
6466#include "sound/ay8910.h"
src/mame/drivers/ltcasino.c
r3957r3958
1414*/
1515
1616#include "driver.h"
17#include "cpu/m6502/m6502.h"
1718#include "sound/ay8910.h"
1819
1920static UINT8 *ltcasino_tile_num_ram, *ltcasino_tile_atr_ram;
src/mame/drivers/astrocorp.c
r3957r3958
1212***************************************************************************/
1313
1414#include "driver.h"
15#include "cpu/m68000/m68000.h"
1516#include "machine/eeprom.h"
1617#include "sound/okim6295.h"
1718
src/mame/drivers/crospang.c
r3957r3958
2929*/
3030
3131#include "driver.h"
32#include "cpu/z80/z80.h"
33#include "cpu/m68000/m68000.h"
3234#include "sound/okim6295.h"
3335#include "sound/3812intf.h"
3436
src/mame/drivers/royalmah.c
r3957r3958
8585****************************************************************************/
8686
8787#include "driver.h"
88#include "cpu/z80/z80.h"
8889#include "deprecat.h"
8990#include "cpu/tlcs90/tlcs90.h"
9091#include "machine/msm6242.h"
r3957r3958
308309
309310static WRITE8_HANDLER( mjapinky_palbank_w )
310311{
311   flip_screen_set(~data & 4);
312   flip_screen_set(space->machine, ~data & 4);
312313   palette_base = (data >> 3) & 0x01;
313314   coin_counter_w(0,data & 2);   // in
314315   coin_counter_w(1,data & 1);   // out
r3957r3958
533534
534535static WRITE8_HANDLER( janptr96_coin_counter_w )
535536{
536   flip_screen_set(~data & 4);
537   flip_screen_set(space->machine, ~data & 4);
537538   coin_counter_w(0,data & 2);   // in
538539   coin_counter_w(1,data & 1);   // out
539540}
r3957r3958
562563
563564static WRITE8_HANDLER( mjifb_coin_counter_w )
564565{
565   flip_screen_set( data & 4);
566   flip_screen_set(space->machine, data & 4);
566567   coin_counter_w(0,data & 2);   // in
567568   coin_counter_w(1,data & 1);   // out
568569}
r3957r3958
23252326   MDRV_SCREEN_VISIBLE_AREA(0, 255, 9, 255-8)
23262327
23272328   /* devices */
2328   MDRV_DEVICE_ADD("rtc", MSM6242)
2329   MDRV_MSM6242_ADD("rtc")
23292330MACHINE_DRIVER_END
23302331
23312332
r3957r3958
23732374   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
23742375
23752376   /* devices */
2376   MDRV_DEVICE_ADD("rtc", MSM6242)
2377   MDRV_MSM6242_ADD("rtc")
23772378MACHINE_DRIVER_END
23782379
23792380static MACHINE_DRIVER_START( cafetime )
r3957r3958
23872388   MDRV_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8)
23882389
23892390   /* devices */
2390   MDRV_DEVICE_ADD("rtc", MSM6242)
2391   MDRV_MSM6242_ADD("rtc")
23912392MACHINE_DRIVER_END
23922393
23932394/***************************************************************************
src/mame/drivers/subs.c
r3957r3958
1818***************************************************************************/
1919
2020#include "driver.h"
21#include "cpu/m6502/m6502.h"
2122#include "deprecat.h"
2223#include "subs.h"
2324#include "sound/discrete.h"
src/mame/drivers/coolridr.c
r3957r3958
5050*/
5151
5252#include "driver.h"
53#include "cpu/sh2/sh2.h"
54#include "cpu/m68000/m68000.h"
5355#include "deprecat.h"
5456#include "sound/scsp.h"
5557
src/mame/drivers/darkmist.c
r3957r3958
2424*/
2525
2626#include "driver.h"
27#include "cpu/z80/z80.h"
2728#include "deprecat.h"
2829#include "audio/t5182.h"
2930
src/mame/drivers/ajax.c
r3957r3958
1111***************************************************************************/
1212
1313#include "driver.h"
14#include "cpu/z80/z80.h"
15#include "cpu/m6809/m6809.h"
16#include "cpu/konami/konami.h"
1417#include "video/konamiic.h"
1518#include "sound/2151intf.h"
1619#include "sound/k007232.h"
r3957r3958
236239   MDRV_CPU_ADD("audio", Z80, 3579545)   /* 3.58 MHz */
237240   MDRV_CPU_PROGRAM_MAP(ajax_sound_map,0)
238241
239   MDRV_INTERLEAVE(10)
242   MDRV_QUANTUM_TIME(HZ(600))
240243
241244   MDRV_MACHINE_RESET(ajax)
242245
src/mame/drivers/mquake.c
r3957r3958
88
99
1010#include "driver.h"
11#include "cpu/m68000/m68000.h"
1112#include "includes/amiga.h"
1213#include "sound/es5503.h"
1314#include "machine/6526cia.h"
r3957r3958
351352static const cia6526_interface cia_0_intf =
352353{
353354   amiga_cia_0_irq,                           /* irq_func */
354   AMIGA_68000_NTSC_CLOCK / 10,                  /* clock */
355355   0,                                       /* tod_clock */
356356   {
357357      { mquake_cia_0_porta_r, mquake_cia_0_porta_w },   /* port A */
r3957r3958
362362static const cia6526_interface cia_1_intf =
363363{
364364   amiga_cia_1_irq,                           /* irq_func */
365   AMIGA_68000_NTSC_CLOCK / 10,                  /* clock */
366365   0,                                       /* tod_clock */
367366   {
368367      { NULL, NULL },                           /* port A */
r3957r3958
413412   MDRV_SOUND_ROUTE(1, "right", 0.50)
414413
415414   /* cia */
416   MDRV_DEVICE_ADD("cia_0", CIA8520)
417   MDRV_DEVICE_CONFIG(cia_0_intf)
418   MDRV_DEVICE_ADD("cia_1", CIA8520)
419   MDRV_DEVICE_CONFIG(cia_1_intf)
415   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_intf)
416   MDRV_CIA8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK / 10, cia_1_intf)
420417MACHINE_DRIVER_END
421418
422419
src/mame/drivers/funybubl.c
r3957r3958
4949
5050
5151#include "driver.h"
52#include "cpu/z80/z80.h"
5253#include "sound/okim6295.h"
5354
5455/* video/funybubl.c */
src/mame/drivers/rotaryf.c
r3957r3958
3131   if (video_screen_get_vblank(device->machine->primary_screen))
3232      cpu_set_input_line(device, I8085_RST55_LINE, HOLD_LINE);
3333   else
34      cpu_set_input_line(device, I8085_RST75_LINE, HOLD_LINE);
35
34   {
35      cpu_set_input_line(device, I8085_RST75_LINE, ASSERT_LINE);
36      cpu_set_input_line(device, I8085_RST75_LINE, CLEAR_LINE);
37   }
3638}
3739
3840
src/mame/drivers/shisen.c
r3957r3958
66
77***************************************************************************/
88#include "driver.h"
9#include "cpu/z80/z80.h"
910#include "deprecat.h"
1011#include "audio/m72.h"
1112#include "sound/dac.h"
src/mame/drivers/nmk16.c
r3957r3958
152152********************************************************************/
153153
154154#include "driver.h"
155#include "cpu/z80/z80.h"
156#include "cpu/tlcs90/tlcs90.h"
157#include "cpu/m68000/m68000.h"
155158#include "deprecat.h"
156159#include "audio/seibu.h"
157160#include "sound/2203intf.h"
r3957r3958
46304633static WRITE16_HANDLER( twinactn_flipscreen_w )
46314634{
46324635   if (ACCESSING_BITS_0_7)
4633      flip_screen_set(data & 1);
4636      flip_screen_set(space->machine, data & 1);
46344637
46354638   if (data & (~1))
46364639      logerror("%06x: unknown flip screen bit written %04x\n", cpu_get_pc(space->cpu), data);
src/mame/drivers/m10.c
r3957r3958
111111
112112***************************************************************************/
113113#include "driver.h"
114#include "cpu/m6502/m6502.h"
114115#include "machine/rescap.h"
115116#include "sound/samples.h"
116117#include "machine/74123.h"
r3957r3958
833834
834835   /* 74LS123 */
835836
836   MDRV_DEVICE_ADD("ic8j1", TTL74123)
837   MDRV_DEVICE_CONFIG(ic8j1_intf)
838   MDRV_DEVICE_ADD("ic8j2", TTL74123)
839   MDRV_DEVICE_CONFIG(ic8j2_intf)
837   MDRV_TTL74123_ADD("ic8j1", ic8j1_intf)
838   MDRV_TTL74123_ADD("ic8j2", ic8j2_intf)
840839
841840   /* sound hardware */
842841   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mame/drivers/miniboy7.c
r3957r3958
124124#define MASTER_CLOCK   10000000   /* 10MHz */
125125
126126#include "driver.h"
127#include "cpu/m6502/m6502.h"
127128#include "video/mc6845.h"
128129
129130
r3957r3958
273274   MDRV_VIDEO_START(miniboy7)
274275   MDRV_VIDEO_UPDATE(miniboy7)
275276
276   MDRV_DEVICE_ADD("crtc", MC6845)
277   MDRV_MC6845_ADD("crtc", MC6845, 0, mc6845_null_interface)
277278MACHINE_DRIVER_END
278279
279280
src/mame/drivers/nitedrvr.c
r3957r3958
3535***************************************************************************/
3636
3737#include "driver.h"
38#include "cpu/m6502/m6502.h"
3839#include "machine/rescap.h"
3940#include "sound/discrete.h"
4041#include "nitedrvr.h"
src/osd/windows/output.c
r3957r3958
1414// MAME headers
1515#include "osdepend.h"
1616#include "driver.h"
17#include "deprecat.h"
1817
1918// MAMEOS headers
2019#include "output.h"
r3957r3958
111110                  NULL);
112111   assert(output_hwnd != NULL);
113112
113   // set a pointer to the running machine
114   SetWindowLongPtr(output_hwnd, GWLP_USERDATA, (LONG_PTR)machine);
115
114116   // allocate message ids
115117   om_mame_start = RegisterWindowMessage(OM_MAME_START);
116118   assert(om_mame_start != 0);
r3957r3958
187189
188190static LRESULT CALLBACK output_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
189191{
192   LONG_PTR ptr = GetWindowLongPtr(wnd, GWLP_USERDATA);
193   running_machine *machine = (running_machine *)ptr;
194
190195   // register a new client
191196   if (message == om_mame_register_client)
192197      return register_client((HWND)wparam, lparam);
r3957r3958
197202
198203   // get a string for an ID
199204   else if (message == om_mame_get_id_string)
200      return send_id_string(Machine, (HWND)wparam, lparam);
205      return send_id_string(machine, (HWND)wparam, lparam);
201206
202207   else
203208      return DefWindowProc(wnd, message, wparam, lparam);
src/osd/windows/input.c
r3957r3958
2929#include "osdepend.h"
3030#include "driver.h"
3131#include "ui.h"
32#include "deprecat.h"
3332
3433// MAMEOS headers
3534#include "winmain.h"
r3957r3958
145144   void               (*poll)(device_info *info);
146145
147146   // MAME information
147   running_machine *      machine;
148148   input_device *         device;
149149
150150   // device state
r3957r3958
226226static void device_list_reset_devices(device_info *devlist_head);
227227
228228// generic device management
229static device_info *generic_device_alloc(device_info **devlist_head_ptr, const TCHAR *name);
229static device_info *generic_device_alloc(running_machine *machine, device_info **devlist_head_ptr, const TCHAR *name);
230230static void generic_device_free(device_info *devinfo);
231231static int generic_device_index(device_info *devlist_head, device_info *devinfo);
232232static void generic_device_reset(device_info *devinfo);
r3957r3958
243243static void dinput_init(running_machine *machine);
244244static void dinput_exit(running_machine *machine);
245245static HRESULT dinput_set_dword_property(LPDIRECTINPUTDEVICE device, REFGUID property_guid, DWORD object, DWORD how, DWORD value);
246static device_info *dinput_device_create(device_info **devlist_head_ptr, LPCDIDEVICEINSTANCE instance, LPCDIDATAFORMAT format1, LPCDIDATAFORMAT format2, DWORD cooperative_level);
246static device_info *dinput_device_create(running_machine *machine, device_info **devlist_head_ptr, LPCDIDEVICEINSTANCE instance, LPCDIDATAFORMAT format1, LPCDIDATAFORMAT format2, DWORD cooperative_level);
247247static void dinput_device_release(device_info *devinfo);
248248static const char *dinput_device_item_name(device_info *devinfo, int offset, const TCHAR *defstring, const TCHAR *suffix);
249249static HRESULT dinput_device_poll(device_info *devinfo);
r3957r3958
258258// RawInput-specific code
259259static void rawinput_init(running_machine *machine);
260260static void rawinput_exit(running_machine *machine);
261static device_info *rawinput_device_create(device_info **devlist_head_ptr, PRAWINPUTDEVICELIST device);
261static device_info *rawinput_device_create(running_machine *machine, device_info **devlist_head_ptr, PRAWINPUTDEVICELIST device);
262262static void rawinput_device_release(device_info *info);
263263static TCHAR *rawinput_device_improve_name(TCHAR *name);
264static void rawinput_keyboard_enum(PRAWINPUTDEVICELIST device);
264static void rawinput_keyboard_enum(running_machine *machine, PRAWINPUTDEVICELIST device);
265265static void rawinput_keyboard_update(HANDLE device, RAWKEYBOARD *data);
266static void rawinput_mouse_enum(PRAWINPUTDEVICELIST device);
266static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST device);
267267static void rawinput_mouse_update(HANDLE device, RAWMOUSE *data);
268268static void rawinput_mouse_poll(device_info *devinfo);
269269
r3957r3958
742742
743743#ifdef MESS
744744         case IPT_OSD_2:
745            if (ui_mess_use_new_ui(Machine))
745            if (ui_mess_use_new_ui())
746746            {
747747               typedesc->token = "TOGGLE_MENUBAR";
748748               typedesc->name = "Toggle Menubar";
r3957r3958
789789//  generic_device_alloc
790790//============================================================
791791
792static device_info *generic_device_alloc(device_info **devlist_head_ptr, const TCHAR *name)
792static device_info *generic_device_alloc(running_machine *machine, device_info **devlist_head_ptr, const TCHAR *name)
793793{
794794   device_info **curdev_ptr;
795795   device_info *devinfo;
r3957r3958
798798   devinfo = malloc_or_die(sizeof(*devinfo));
799799   memset(devinfo, 0, sizeof(*devinfo));
800800   devinfo->head = devlist_head_ptr;
801   devinfo->machine = machine;
801802
802803   // allocate a UTF8 copy of the name
803804   devinfo->name = utf8_from_tstring(name);
r3957r3958
889890
890891static INT32 generic_button_get_state(void *device_internal, void *item_internal)
891892{
893   device_info *devinfo = device_internal;
892894   BYTE *itemdata = item_internal;
893895
894896   // return the current state
895   poll_if_necessary(Machine);
897   poll_if_necessary(devinfo->machine);
896898   return *itemdata >> 7;
897899}
898900
r3957r3958
903905
904906static INT32 generic_axis_get_state(void *device_internal, void *item_internal)
905907{
908   device_info *devinfo = device_internal;
906909   LONG *axisdata = item_internal;
907910
908911   // return the current state
909   poll_if_necessary(Machine);
912   poll_if_necessary(devinfo->machine);
910913   return *axisdata;
911914}
912915
r3957r3958
934937      int axisnum, butnum;
935938
936939      // allocate a device
937      devinfo = generic_device_alloc(&lightgun_list, gun_names[gunnum]);
940      devinfo = generic_device_alloc(machine, &lightgun_list, gun_names[gunnum]);
938941      if (devinfo == NULL)
939942         break;
940943
r3957r3958
10981101   if (keyboard_list == NULL)
10991102   {
11001103      // enumerate the ones we have
1101      result = IDirectInput_EnumDevices(dinput, didevtype_keyboard, dinput_keyboard_enum, 0, DIEDFL_ATTACHEDONLY);
1104      result = IDirectInput_EnumDevices(dinput, didevtype_keyboard, dinput_keyboard_enum, machine, DIEDFL_ATTACHEDONLY);
11021105      if (result != DI_OK)
11031106         fatalerror("DirectInput: Unable to enumerate keyboards (result=%08X)\n", (UINT32)result);
11041107   }
r3957r3958
11071110   if (mouse_list == NULL)
11081111   {
11091112      // enumerate the ones we have
1110      result = IDirectInput_EnumDevices(dinput, didevtype_mouse, dinput_mouse_enum, 0, DIEDFL_ATTACHEDONLY);
1113      result = IDirectInput_EnumDevices(dinput, didevtype_mouse, dinput_mouse_enum, machine, DIEDFL_ATTACHEDONLY);
11111114      if (result != DI_OK)
11121115         fatalerror("DirectInput: Unable to enumerate mice (result=%08X)\n", (UINT32)result);
11131116   }
11141117
11151118   // initialize joystick devices
1116   result = IDirectInput_EnumDevices(dinput, didevtype_joystick, dinput_joystick_enum, 0, DIEDFL_ATTACHEDONLY);
1119   result = IDirectInput_EnumDevices(dinput, didevtype_joystick, dinput_joystick_enum, machine, DIEDFL_ATTACHEDONLY);
11171120   if (result != DI_OK)
11181121      fatalerror("DirectInput: Unable to enumerate joysticks (result=%08X)\n", (UINT32)result);
11191122}
r3957r3958
11641167//  dinput_device_create
11651168//============================================================
11661169
1167static device_info *dinput_device_create(device_info **devlist_head_ptr, LPCDIDEVICEINSTANCE instance, LPCDIDATAFORMAT format1, LPCDIDATAFORMAT format2, DWORD cooperative_level)
1170static device_info *dinput_device_create(running_machine *machine, device_info **devlist_head_ptr, LPCDIDEVICEINSTANCE instance, LPCDIDATAFORMAT format1, LPCDIDATAFORMAT format2, DWORD cooperative_level)
11681171{
11691172   device_info *devinfo;
11701173   HRESULT result;
11711174
11721175   // allocate memory for the device object
1173   devinfo = generic_device_alloc(devlist_head_ptr, instance->tszInstanceName);
1176   devinfo = generic_device_alloc(machine, devlist_head_ptr, instance->tszInstanceName);
11741177
11751178   // attempt to create a device
11761179   result = IDirectInput_CreateDevice(dinput, &instance->guidInstance, &devinfo->dinput.device, NULL);
r3957r3958
13081311
13091312static BOOL CALLBACK dinput_keyboard_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
13101313{
1314   running_machine *machine = ref;
13111315   device_info *devinfo;
13121316   int keynum;
13131317
13141318   // allocate and link in a new device
1315   devinfo = dinput_device_create(&keyboard_list, instance, &c_dfDIKeyboard, NULL, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
1319   devinfo = dinput_device_create(machine, &keyboard_list, instance, &c_dfDIKeyboard, NULL, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
13161320   if (devinfo == NULL)
13171321      goto exit;
13181322
13191323   // add the device
1320   devinfo->device = input_device_add(Machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo);
1324   devinfo->device = input_device_add(machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo);
13211325   devinfo->poll = dinput_keyboard_poll;
13221326
13231327   // populate it
r3957r3958
13631367static BOOL CALLBACK dinput_mouse_enum(LPCDIDEVICEINSTANCE instance, LPVOID ref)
13641368{
13651369   device_info *devinfo, *guninfo = NULL;
1370   running_machine *machine = ref;
13661371   int axisnum, butnum;
13671372   HRESULT result;
13681373
13691374   // allocate and link in a new device
1370   devinfo = dinput_device_create(&mouse_list, instance, &c_dfDIMouse2, &c_dfDIMouse, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
1375   devinfo = dinput_device_create(machine, &mouse_list, instance, &c_dfDIMouse2, &c_dfDIMouse, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
13711376   if (devinfo == NULL)
13721377      goto exit;
13731378
r3957r3958
13751380   // we only support a single gun in dinput mode, so only add one
13761381   if (!lightgun_shared_axis_mode && devinfo == mouse_list)
13771382   {
1378      guninfo = generic_device_alloc(&lightgun_list, instance->tszInstanceName);
1383      guninfo = generic_device_alloc(machine, &lightgun_list, instance->tszInstanceName);
13791384      if (guninfo == NULL)
13801385         goto exit;
13811386   }
r3957r3958
13891394   }
13901395
13911396   // add the device
1392   devinfo->device = input_device_add(Machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo);
1397   devinfo->device = input_device_add(machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo);
13931398   devinfo->poll = dinput_mouse_poll;
13941399   if (guninfo != NULL)
13951400   {
1396      guninfo->device = input_device_add(Machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo);
1401      guninfo->device = input_device_add(machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo);
13971402      guninfo->poll = win32_lightgun_poll;
13981403   }
13991404
r3957r3958
14641469{
14651470   DWORD cooperative_level = (HAS_WINDOW_MENU ? DISCL_BACKGROUND : DISCL_FOREGROUND) | DISCL_EXCLUSIVE;
14661471   int axisnum, axiscount, povnum, butnum;
1472   running_machine *machine = ref;
14671473   device_info *devinfo;
14681474   HRESULT result;
14691475
14701476   // allocate and link in a new device
1471   devinfo = dinput_device_create(&joystick_list, instance, &c_dfDIJoystick, NULL, cooperative_level);
1477   devinfo = dinput_device_create(machine, &joystick_list, instance, &c_dfDIJoystick, NULL, cooperative_level);
14721478   if (devinfo == NULL)
14731479      goto exit;
14741480
r3957r3958
14931499   devinfo->dinput.caps.dwButtons = MIN(devinfo->dinput.caps.dwButtons, 128);
14941500
14951501   // add the device
1496   devinfo->device = input_device_add(Machine, DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo);
1502   devinfo->device = input_device_add(machine, DEVICE_CLASS_JOYSTICK, devinfo->name, devinfo);
14971503   devinfo->poll = dinput_joystick_poll;
14981504
14991505   // populate the axes
r3957r3958
15931599   DWORD pov;
15941600
15951601   // get the current state
1596   poll_if_necessary(Machine);
1602   poll_if_necessary(devinfo->machine);
15971603   pov = devinfo->joystick.state.rgdwPOV[povnum];
15981604
15991605   // if invalid, return 0
r3957r3958
16561662
16571663      // handle keyboards
16581664      if (device->dwType == RIM_TYPEKEYBOARD && !FORCE_DIRECTINPUT)
1659         rawinput_keyboard_enum(device);
1665         rawinput_keyboard_enum(machine, device);
16601666
16611667      // handle mice
16621668      else if (device->dwType == RIM_TYPEMOUSE && !FORCE_DIRECTINPUT)
1663         rawinput_mouse_enum(device);
1669         rawinput_mouse_enum(machine, device);
16641670   }
16651671
16661672   // finally, register to recieve raw input WM_INPUT messages
r3957r3958
17161722//  rawinput_device_create
17171723//============================================================
17181724
1719static device_info *rawinput_device_create(device_info **devlist_head_ptr, PRAWINPUTDEVICELIST device)
1725static device_info *rawinput_device_create(running_machine *machine, device_info **devlist_head_ptr, PRAWINPUTDEVICELIST device)
17201726{
17211727   device_info *devinfo = NULL;
17221728   TCHAR *tname = NULL;
r3957r3958
17351741
17361742   // improve the name and then allocate a device
17371743   tname = rawinput_device_improve_name(tname);
1738   devinfo = generic_device_alloc(devlist_head_ptr, tname);
1744   devinfo = generic_device_alloc(machine, devlist_head_ptr, tname);
17391745   free(tname);
17401746
17411747   // copy the handle
r3957r3958
19151921//  rawinput_keyboard_enum
19161922//============================================================
19171923
1918static void rawinput_keyboard_enum(PRAWINPUTDEVICELIST device)
1924static void rawinput_keyboard_enum(running_machine *machine, PRAWINPUTDEVICELIST device)
19191925{
19201926   device_info *devinfo;
19211927   int keynum;
19221928
19231929   // allocate and link in a new device
1924   devinfo = rawinput_device_create(&keyboard_list, device);
1930   devinfo = rawinput_device_create(machine, &keyboard_list, device);
19251931   if (devinfo == NULL)
19261932      return;
19271933
19281934   // add the device
1929   devinfo->device = input_device_add(Machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo);
1935   devinfo->device = input_device_add(machine, DEVICE_CLASS_KEYBOARD, devinfo->name, devinfo);
19301936
19311937   // populate it
19321938   for (keynum = 0; keynum < MAX_KEYS; keynum++)
r3957r3958
19801986//  rawinput_mouse_enum
19811987//============================================================
19821988
1983static void rawinput_mouse_enum(PRAWINPUTDEVICELIST device)
1989static void rawinput_mouse_enum(running_machine *machine, PRAWINPUTDEVICELIST device)
19841990{
19851991   device_info *devinfo, *guninfo = NULL;
19861992   int axisnum, butnum;
19871993
19881994   // allocate and link in a new mouse device
1989   devinfo = rawinput_device_create(&mouse_list, device);
1995   devinfo = rawinput_device_create(machine, &mouse_list, device);
19901996   if (devinfo == NULL)
19911997      return;
19921998   devinfo->poll = rawinput_mouse_poll;
r3957r3958
19942000   // allocate a second device for the gun (unless we are using the shared axis mode)
19952001   if (!lightgun_shared_axis_mode)
19962002   {
1997      guninfo = rawinput_device_create(&lightgun_list, device);
2003      guninfo = rawinput_device_create(machine, &lightgun_list, device);
19982004      assert(guninfo != NULL);
19992005   }
20002006
20012007   // add the device
2002   devinfo->device = input_device_add(Machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo);
2008   devinfo->device = input_device_add(machine, DEVICE_CLASS_MOUSE, devinfo->name, devinfo);
20032009   if (guninfo != NULL)
20042010   {
2005      guninfo->device = input_device_add(Machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo);
2011      guninfo->device = input_device_add(machine, DEVICE_CLASS_LIGHTGUN, guninfo->name, guninfo);
20062012      guninfo->poll = (guninfo == lightgun_list) ? win32_lightgun_poll : NULL;
20072013      guninfo->mouse.partner = &devinfo->mouse;
20082014   }
r3957r3958
20942100
20952101static void rawinput_mouse_poll(device_info *devinfo)
20962102{
2097   poll_if_necessary(Machine);
2103   poll_if_necessary(devinfo->machine);
20982104
20992105   // copy the accumulated raw state to the actual state
21002106   osd_lock_acquire(input_lock);
src/osd/windows/winmain.c
r3957r3958
3434#include "strconv.h"
3535#include "winutf8.h"
3636#include "winutil.h"
37#include "debug/debugcpu.h"
37#include "debugger.h"
3838
3939#define ENABLE_PROFILER      0
4040#define DEBUG_SLOW_LOCKS   0
r3957r3958
455455   already_hit = 1;
456456
457457   // flush any debugging traces that were live
458   {
459      extern running_machine *Machine;
460      if (Machine != NULL)
461         debug_cpu_flush_traces(Machine);
462   }
458   debugger_flush_all_traces_on_abnormal_exit();
463459
464460   // find our man
465461   for (i = 0; exception_table[i].code != 0; i++)
src/osd/windows/debugwin.c
r3957r3958
22012201                  const address_space *space = disasm_view_get_current_subview(info->view[0].view)->space;
22022202                  if (debug_cpu_get_visible_cpu(info->machine) == space->cpu)
22032203                  {
2204                     offs_t address = memory_byte_to_address(space, disasm_view_get_selected_address(info->view[0].view));
2204                     offs_t address = disasm_view_get_selected_address(info->view[0].view);
22052205                     sprintf(command, "go %X", address);
22062206                     debug_console_execute_command(info->machine, command, 1);
22072207                  }
r3957r3958
22142214                  const address_space *space = disasm_view_get_current_subview(info->view[0].view)->space;
22152215                  if (debug_cpu_get_visible_cpu(info->machine) == space->cpu)
22162216                  {
2217                     offs_t address = memory_byte_to_address(space, disasm_view_get_selected_address(info->view[0].view));
2217                     offs_t address = disasm_view_get_selected_address(info->view[0].view);
22182218                     cpu_debug_data *cpuinfo = cpu_get_debug_data(space->cpu);
22192219                     debug_cpu_breakpoint *bp;
22202220                     INT32 bpindex = -1;
src/osd/winui/treeview.c
r3957r3958
872872
873873void CreateCPUFolders(int parent_index)
874874{
875// FIXME 0.128u7
876#if 0
875877   int i,jj;
876878   int nGames = driver_list_get_count(drivers);
877879   int nFolder = numFolders;
r3957r3958
928930      }
929931      machine_config_free(config);
930932   }
933#endif
931934}
932935
933936void CreateSoundFolders(int parent_index)
src/osd/winui/properties.c
r3957r3958
602602/* Build CPU info string */
603603static char *GameInfoCPU(UINT nIndex)
604604{
605   int chipnum;
605   //int chipnum;
606606   static char buf[1024] = "";
607607   machine_config *config = machine_config_alloc(drivers[nIndex]->machine_config);
608608
609609   ZeroMemory(buf, sizeof(buf));
610610
611   cpuintrf_init(NULL);
612
611// FIXME 0.128u7
612#if 0
613613   for (chipnum = 0; chipnum < ARRAY_LENGTH(config->cpu); chipnum++)
614614   {
615615      if (config->cpu[chipnum].type != CPU_DUMMY)
r3957r3958
630630         strcat(buf, "\n");
631631      }
632632    }
633#endif
633634   /* Free the structure */
634635   machine_config_free(config);
635
636636   return buf;
637637}
638638
src/emu/debug/debugcpu.c
r3957r3958
7979
8080
8181/***************************************************************************
82    LOCAL VARIABLES
83***************************************************************************/
84
85
86
87/***************************************************************************
8882    FUNCTION PROTOTYPES
8983***************************************************************************/
9084
r3957r3958
160154{
161155   const device_config *first_screen = video_screen_first(machine->config);
162156   debugcpu_private *global;
163   int cpunum, regnum;
157   const device_config *cpu;
158   int regnum;
164159
165160   /* allocate and reset globals */
166161   machine->debugcpu_data = global = auto_malloc(sizeof(*global));
r3957r3958
189184   }
190185
191186   /* loop over CPUs and build up their info */
192   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
193      if (machine->cpu[cpunum] != NULL)
194      {
195         const device_config *cpu = machine->cpu[cpunum];
196         cpu_class_header *classheader = cpu->classtoken;
197         cpu_debug_data *info;
187   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
188   {
189      cpu_class_header *classheader = cpu_get_class_header(cpu);
190      cpu_debug_data *info;
198191
199         /* allocate some information */
200         info = auto_malloc(sizeof(*info));
201         memset(info, 0, sizeof(*info));
202         classheader->debug = info;
192      /* allocate some information */
193      info = auto_malloc(sizeof(*info));
194      memset(info, 0, sizeof(*info));
195      classheader->debug = info;
203196
204         /* reset the PC data */
205         info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
206         info->device = machine->cpu[cpunum];
207         info->opwidth = cpu_get_min_opcode_bytes(info->device);
197      /* reset the PC data */
198      info->flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
199      info->device = cpu;
200      info->opwidth = cpu_get_min_opcode_bytes(info->device);
208201
209         /* fetch the memory accessors */
210         info->read = (cpu_read_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READ);
211         info->write = (cpu_write_func)cpu_get_info_fct(info->device, CPUINFO_PTR_WRITE);
212         info->readop = (cpu_readop_func)cpu_get_info_fct(info->device, CPUINFO_PTR_READOP);
202      /* fetch the memory accessors */
203      info->read = (cpu_read_func)device_get_info_fct(info->device, CPUINFO_FCT_READ);
204      info->write = (cpu_write_func)device_get_info_fct(info->device, CPUINFO_FCT_WRITE);
205      info->readop = (cpu_readop_func)device_get_info_fct(info->device, CPUINFO_FCT_READOP);
213206
214         /* allocate a symbol table */
215         info->symtable = symtable_alloc(global->symtable, (void *)cpu);
207      /* allocate a symbol table */
208      info->symtable = symtable_alloc(global->symtable, (void *)cpu);
216209
217         /* add a global symbol for the current instruction pointer */
218         symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
219         symtable_add_register(info->symtable, "cycles", NULL, get_cycles, NULL);
220         if (classheader->space[ADDRESS_SPACE_PROGRAM] != NULL)
221            symtable_add_register(info->symtable, "logunmap", (void *)classheader->space[ADDRESS_SPACE_PROGRAM], get_logunmap, set_logunmap);
222         if (classheader->space[ADDRESS_SPACE_DATA] != NULL)
223            symtable_add_register(info->symtable, "logunmapd", (void *)classheader->space[ADDRESS_SPACE_DATA], get_logunmap, set_logunmap);
224         if (classheader->space[ADDRESS_SPACE_IO] != NULL)
225            symtable_add_register(info->symtable, "logunmapi", (void *)classheader->space[ADDRESS_SPACE_IO], get_logunmap, set_logunmap);
210      /* add a global symbol for the current instruction pointer */
211      symtable_add_register(info->symtable, "cycles", NULL, get_cycles, NULL);
212      if (classheader->space[ADDRESS_SPACE_PROGRAM] != NULL)
213         symtable_add_register(info->symtable, "logunmap", (void *)classheader->space[ADDRESS_SPACE_PROGRAM], get_logunmap, set_logunmap);
214      if (classheader->space[ADDRESS_SPACE_DATA] != NULL)
215         symtable_add_register(info->symtable, "logunmapd", (void *)classheader->space[ADDRESS_SPACE_DATA], get_logunmap, set_logunmap);
216      if (classheader->space[ADDRESS_SPACE_IO] != NULL)
217         symtable_add_register(info->symtable, "logunmapi", (void *)classheader->space[ADDRESS_SPACE_IO], get_logunmap, set_logunmap);
226218
227         /* add all registers into it */
228         for (regnum = 0; regnum < MAX_REGS; regnum++)
229         {
230            const char *str = cpu_get_reg_string(info->device, regnum);
231            const char *colon;
232            char symname[256];
233            int charnum;
219      /* add all registers into it */
220      for (regnum = 0; regnum < MAX_REGS; regnum++)
221      {
222         const char *str = cpu_get_reg_string(info->device, regnum);
223         const char *colon;
224         char symname[256];
225         int charnum;
234226
235            /* skip if we don't get a valid string, or one without a colon */
236            if (str == NULL)
237               continue;
238            if (str[0] == '~')
239               str++;
240            colon = strchr(str, ':');
241            if (colon == NULL)
242               continue;
227         /* skip if we don't get a valid string, or one without a colon */
228         if (str == NULL)
229            continue;
230         if (str[0] == '~')
231            str++;
232         colon = strchr(str, ':');
233         if (colon == NULL)
234            continue;
243235
244            /* strip all spaces from the name and convert to lowercase */
245            for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
246               if (!isspace(*str))
247                  symname[charnum++] = tolower(*str);
248            symname[charnum] = 0;
236         /* strip all spaces from the name and convert to lowercase */
237         for (charnum = 0; charnum < sizeof(symname) - 1 && str < colon; str++)
238            if (!isspace(*str))
239               symname[charnum++] = tolower(*str);
240         symname[charnum] = 0;
249241
250            /* add the symbol to the table */
251            symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
252         }
242         /* add the symbol to the table */
243         symtable_add_register(info->symtable, symname, (void *)(FPTR)regnum, get_cpu_reg, set_cpu_reg);
253244      }
254245
246      /* if no curpc, add one */
247      if (symtable_find(info->symtable, "curpc") == NULL)
248         symtable_add_register(info->symtable, "curpc", NULL, get_current_pc, 0);
249   }
250
255251   /* first CPU is visible by default */
256252   global->visiblecpu = machine->cpu[0];
257253
r3957r3958
271267
272268void debug_cpu_flush_traces(running_machine *machine)
273269{
274   int cpunum;
270   const device_config *cpu;
275271
276   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
277      if (machine->cpu[cpunum] != NULL)
278      {
279         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
272   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
273   {
274      cpu_debug_data *info = cpu_get_debug_data(cpu);
280275
281         /* this can be called on exit even when no debugging is enabled, so
282               make sure the info is valid before proceeding */
283         if (info != NULL && info->trace.file != NULL)
284            fflush(info->trace.file);
285      }
276      /* this can be called on exit even when no debugging is enabled, so
277          make sure the info is valid before proceeding */
278      if (info != NULL && info->trace.file != NULL)
279         fflush(info->trace.file);
280   }
286281}
287282
288283
r3957r3958
321316int debug_cpu_is_stopped(running_machine *machine)
322317{
323318   debugcpu_private *global = machine->debugcpu_data;
324   return global->execution_state == EXECUTION_STATE_STOPPED;
319   return (global != NULL) ? (global->execution_state == EXECUTION_STATE_STOPPED) : FALSE;
325320}
326321
327322
r3957r3958
923918int debug_cpu_breakpoint_clear(running_machine *machine, int bpnum)
924919{
925920   debug_cpu_breakpoint *bp, *pbp;
926   int cpunum;
921   const device_config *cpu;
927922
928923   /* loop over CPUs and find the requested breakpoint */
929   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
930      if (machine->cpu[cpunum] != NULL)
931      {
932         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
933         for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
934            if (bp->index == bpnum)
935            {
936               /* unlink us from the list */
937               if (pbp == NULL)
938                  info->bplist = bp->next;
939               else
940                  pbp->next = bp->next;
924   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
925   {
926      cpu_debug_data *info = cpu_get_debug_data(cpu);
927      for (pbp = NULL, bp = info->bplist; bp != NULL; pbp = bp, bp = bp->next)
928         if (bp->index == bpnum)
929         {
930            /* unlink us from the list */
931            if (pbp == NULL)
932               info->bplist = bp->next;
933            else
934               pbp->next = bp->next;
941935
942               /* free the memory */
943               if (bp->condition != NULL)
944                  expression_free(bp->condition);
945               if (bp->action != NULL)
946                  free(bp->action);
947               free(bp);
936            /* free the memory */
937            if (bp->condition != NULL)
938               expression_free(bp->condition);
939            if (bp->action != NULL)
940               free(bp->action);
941            free(bp);
948942
949               /* update the flags */
950               breakpoint_update_flags(info);
951               return TRUE;
952            }
953      }
943            /* update the flags */
944            breakpoint_update_flags(info);
945            return TRUE;
946         }
947   }
954948
955949   /* we didn't find it; return an error */
956950   return FALSE;
r3957r3958
965959int debug_cpu_breakpoint_enable(running_machine *machine, int bpnum, int enable)
966960{
967961   debug_cpu_breakpoint *bp;
968   int cpunum;
962   const device_config *cpu;
969963
970964   /* loop over CPUs and find the requested breakpoint */
971   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
972      if (machine->cpu[cpunum] != NULL)
973      {
974         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
975         for (bp = info->bplist; bp != NULL; bp = bp->next)
976            if (bp->index == bpnum)
977            {
978               bp->enabled = (enable != 0);
979               breakpoint_update_flags(info);
980               return TRUE;
981            }
982      }
965   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
966   {
967      cpu_debug_data *info = cpu_get_debug_data(cpu);
968      for (bp = info->bplist; bp != NULL; bp = bp->next)
969         if (bp->index == bpnum)
970         {
971            bp->enabled = (enable != 0);
972            breakpoint_update_flags(info);
973            return TRUE;
974         }
975   }
983976
984977   return FALSE;
985978}
r3957r3958
10331026int debug_cpu_watchpoint_clear(running_machine *machine, int wpnum)
10341027{
10351028   debug_cpu_watchpoint *wp, *pwp;
1036   int cpunum, spacenum;
1029   const device_config *cpu;
1030   int spacenum;
10371031
10381032   /* loop over CPUs and find the requested watchpoint */
1039   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1040      if (machine->cpu[cpunum] != NULL)
1041      {
1042         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
1033   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1034   {
1035      cpu_debug_data *info = cpu_get_debug_data(cpu);
10431036
1044         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1045            for (pwp = NULL, wp = info->wplist[spacenum]; wp != NULL; pwp = wp, wp = wp->next)
1046               if (wp->index == wpnum)
1047               {
1048                  /* unlink us from the list */
1049                  if (pwp == NULL)
1050                     info->wplist[spacenum] = wp->next;
1051                  else
1052                     pwp->next = wp->next;
1037      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1038         for (pwp = NULL, wp = info->wplist[spacenum]; wp != NULL; pwp = wp, wp = wp->next)
1039            if (wp->index == wpnum)
1040            {
1041               /* unlink us from the list */
1042               if (pwp == NULL)
1043                  info->wplist[spacenum] = wp->next;
1044               else
1045                  pwp->next = wp->next;
10531046
1054                  /* free the memory */
1055                  if (wp->condition != NULL)
1056                     expression_free(wp->condition);
1057                  if (wp->action != NULL)
1058                     free(wp->action);
1059                  free(wp);
1047               /* free the memory */
1048               if (wp->condition != NULL)
1049                  expression_free(wp->condition);
1050               if (wp->action != NULL)
1051                  free(wp->action);
1052               free(wp);
10601053
1061                  watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
1062                  return TRUE;
1063               }
1054               watchpoint_update_flags(cpu_get_address_space(cpu, spacenum));
1055               return TRUE;
1056            }
10641057   }
10651058
10661059   /* we didn't find it; return an error */
r3957r3958
10761069int debug_cpu_watchpoint_enable(running_machine *machine, int wpnum, int enable)
10771070{
10781071   debug_cpu_watchpoint *wp;
1079   int cpunum, spacenum;
1072   const device_config *cpu;
1073   int spacenum;
10801074
10811075   /* loop over CPUs and address spaces and find the requested watchpoint */
1082   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1083      if (machine->cpu[cpunum] != NULL)
1084      {
1085         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
1076   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1077   {
1078      cpu_debug_data *info = cpu_get_debug_data(cpu);
10861079
1087         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1088            for (wp = info->wplist[spacenum]; wp != NULL; wp = wp->next)
1089               if (wp->index == wpnum)
1090               {
1091                  wp->enabled = (enable != 0);
1092                  watchpoint_update_flags(cpu_get_address_space(machine->cpu[cpunum], spacenum));
1093                  return TRUE;
1094               }
1095      }
1080      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1081         for (wp = info->wplist[spacenum]; wp != NULL; wp = wp->next)
1082            if (wp->index == wpnum)
1083            {
1084               wp->enabled = (enable != 0);
1085               watchpoint_update_flags(cpu_get_address_space(cpu, spacenum));
1086               return TRUE;
1087            }
1088   }
10961089   return FALSE;
10971090}
10981091
r3957r3958
17701763static void debug_cpu_exit(running_machine *machine)
17711764{
17721765   debugcpu_private *global = machine->debugcpu_data;
1773   int cpunum, spacenum;
1766   const device_config *cpu;
1767   int spacenum;
17741768
17751769   /* loop over all watchpoints and breakpoints to free their memory */
1776   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1777      if (machine->cpu[cpunum] != NULL)
1778      {
1779         cpu_debug_data *info = cpu_get_debug_data(machine->cpu[cpunum]);
1770   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1771   {
1772      cpu_debug_data *info = cpu_get_debug_data(cpu);
17801773
1781         /* close any tracefiles */
1782         if (info->trace.file != NULL)
1783            fclose(info->trace.file);
1784         if (info->trace.action != NULL)
1785            free(info->trace.action);
1774      /* close any tracefiles */
1775      if (info->trace.file != NULL)
1776         fclose(info->trace.file);
1777      if (info->trace.action != NULL)
1778         free(info->trace.action);
17861779
1787         /* free the symbol table */
1788         if (info->symtable != NULL)
1789            symtable_free(info->symtable);
1780      /* free the symbol table */
1781      if (info->symtable != NULL)
1782         symtable_free(info->symtable);
17901783
1791         /* free all breakpoints */
1792         while (info->bplist != NULL)
1793            debug_cpu_breakpoint_clear(machine, info->bplist->index);
1784      /* free all breakpoints */
1785      while (info->bplist != NULL)
1786         debug_cpu_breakpoint_clear(machine, info->bplist->index);
17941787
1795         /* loop over all address spaces */
1796         for (spacenum = 0; spacenum < ARRAY_LENGTH(info->wplist); spacenum++)
1797         {
1798            /* free all watchpoints */
1799            while (info->wplist[spacenum] != NULL)
1800               debug_cpu_watchpoint_clear(machine, info->wplist[spacenum]->index);
1801         }
1788      /* loop over all address spaces */
1789      for (spacenum = 0; spacenum < ARRAY_LENGTH(info->wplist); spacenum++)
1790      {
1791         /* free all watchpoints */
1792         while (info->wplist[spacenum] != NULL)
1793            debug_cpu_watchpoint_clear(machine, info->wplist[spacenum]->index);
18021794      }
1795   }
18031796
18041797   /* free the global symbol table */
18051798   if (global != NULL && global->symtable != NULL)
r3957r3958
18261819
18271820static void reset_transient_flags(running_machine *machine)
18281821{
1829   int cpunum;
1822   const device_config *cpu;
18301823
18311824   /* loop over CPUs and reset the transient flags */
1832   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1833      if (machine->cpu[cpunum] != NULL)
1834         cpu_get_debug_data(machine->cpu[cpunum])->flags &= ~DEBUG_FLAG_TRANSIENT;
1825   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1826      cpu_get_debug_data(cpu)->flags &= ~DEBUG_FLAG_TRANSIENT;
18351827}
18361828
18371829
src/emu/debug/debugvw.c
r3957r3958
10431043   astring *tempstring = astring_alloc();
10441044   registers_subview_item *head = NULL;
10451045   registers_subview_item **tailptr = &head;
1046   const device_config *cpu;
10461047   int curindex = 0;
1047   int cpunum;
10481048
10491049   /* iterate over CPUs with program address spaces */
1050   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1051      if (machine->cpu[cpunum] != NULL)
1052      {
1053         const device_config *device = machine->cpu[cpunum];
1054         registers_subview_item *subview;
1050   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1051   {
1052      registers_subview_item *subview;
10551053
1056         /* determine the string and allocate a subview large enough */
1057         astring_printf(tempstring, "CPU '%s' (%s)", device->tag, cpu_get_name(device));
1058         subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
1059         memset(subview, 0, sizeof(*subview));
1054      /* determine the string and allocate a subview large enough */
1055      astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu));
1056      subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
1057      memset(subview, 0, sizeof(*subview));
10601058
1061         /* populate the subview */
1062         subview->next = NULL;
1063         subview->index = curindex++;
1064         subview->device = device;
1065         strcpy(subview->name, astring_c(tempstring));
1059      /* populate the subview */
1060      subview->next = NULL;
1061      subview->index = curindex++;
1062      subview->device = cpu;
1063      strcpy(subview->name, astring_c(tempstring));
10661064
1067         /* add to the list */
1068         *tailptr = subview;
1069         tailptr = &subview->next;
1070      }
1065      /* add to the list */
1066      *tailptr = subview;
1067      tailptr = &subview->next;
1068   }
10711069
10721070   /* free the temporary string */
10731071   astring_free(tempstring);
r3957r3958
11871185{
11881186   debug_view_registers *regdata = view->extra_data;
11891187   int regnum, maxtaglen, maxvallen;
1190   const int *list;
1188   const cpu_state_table *table;
11911189
11921190   /* if no CPU, reset to the first one */
11931191   if (regdata->device == NULL)
11941192      regdata->device = view->machine->cpu[0];
1195   list = cpu_get_debug_register_list(regdata->device);
1193   table = cpu_get_state_table(regdata->device);
11961194
11971195   /* reset the view parameters */
11981196   view->topleft.y = 0;
r3957r3958
12661264      int regid;
12671265
12681266      /* identify the register id */
1269      regid = list ? list[regnum] : regnum;
1270      if (regid < 0)
1271         break;
1267      if (table != NULL)
1268      {
1269         if (regnum >= table->entrycount)
1270            break;
1271         if ((table->entrylist[regnum].validmask & table->subtypemask) == 0)
1272            continue;
1273         regid = table->entrylist[regnum].index;
1274      }
1275      else
1276         regid = regnum;
12721277
12731278      /* retrieve the string for this register */
12741279      str = cpu_get_reg_string(regdata->device, regid);
12751280
12761281      /* did we get a string? */
1277      if (str && str[0] != '\0' && str[0] != '~')
1282      if (str != NULL && str[0] != 0 && str[0] != '~')
12781283         registers_view_add_register(view, regid, str);
12791284   }
12801285
r3957r3958
14881493   astring *tempstring = astring_alloc();
14891494   disasm_subview_item *head = NULL;
14901495   disasm_subview_item **tailptr = &head;
1496   const device_config *cpu;
14911497   int curindex = 0;
1492   int cpunum;
14931498
14941499   /* iterate over CPUs with program address spaces */
1495   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1496      if (machine->cpu[cpunum] != NULL)
1500   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1501   {
1502      const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM);
1503      if (space != NULL)
14971504      {
1498         const address_space *space = cpu_get_address_space(machine->cpu[cpunum], ADDRESS_SPACE_PROGRAM);
1499         if (space != NULL)
1500         {
1501            disasm_subview_item *subview;
1505         disasm_subview_item *subview;
15021506
1503            /* determine the string and allocate a subview large enough */
1504            astring_printf(tempstring, "CPU '%s' (%s)", space->cpu->tag, cpu_get_name(space->cpu));
1505            subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
1506            memset(subview, 0, sizeof(*subview));
1507         /* determine the string and allocate a subview large enough */
1508         astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu));
1509         subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
1510         memset(subview, 0, sizeof(*subview));
15071511
1508            /* populate the subview */
1509            subview->next = NULL;
1510            subview->index = curindex++;
1511            subview->space = space;
1512            strcpy(subview->name, astring_c(tempstring));
1512         /* populate the subview */
1513         subview->next = NULL;
1514         subview->index = curindex++;
1515         subview->space = space;
1516         strcpy(subview->name, astring_c(tempstring));
15131517
1514            /* add to the list */
1515            *tailptr = subview;
1516            tailptr = &subview->next;
1517         }
1518         /* add to the list */
1519         *tailptr = subview;
1520         tailptr = &subview->next;
15181521      }
1522   }
15191523
15201524   /* free the temporary string */
15211525   astring_free(tempstring);
r3957r3958
15321536{
15331537   debug_view_disasm *dasmdata;
15341538   int total_comments = 0;
1535   int cpunum;
1539   const device_config *cpu;
15361540
15371541   /* fail if no available subviews */
15381542   if (view->machine->debugvw_data->disasm_subviews == NULL)
r3957r3958
15511555   debug_view_expression_alloc(&dasmdata->expression);
15521556
15531557   /* count the number of comments */
1554   for (cpunum = 0; cpunum < ARRAY_LENGTH(view->machine->cpu); cpunum++)
1555      if (view->machine->cpu[cpunum] != NULL)
1556         total_comments += debug_comment_get_count(view->machine->cpu[cpunum]);
1558   for (cpu = view->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1559      total_comments += debug_comment_get_count(cpu);
15571560
15581561   /* initialize */
15591562   dasmdata->right_column = (total_comments > 0) ? DASM_RIGHTCOL_COMMENTS : DASM_RIGHTCOL_RAW;
r3957r3958
24062409   astring *tempstring = astring_alloc();
24072410   memory_subview_item *head = NULL;
24082411   memory_subview_item **tailptr = &head;
2409   int cpunum, spacenum;
2412   const device_config *cpu;
2413   int spacenum;
24102414   const char *rgntag;
24112415   int curindex = 0;
24122416   int itemnum;
24132417
24142418   /* first add all the CPUs' address spaces */
2415   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
2416      if (machine->cpu[cpunum] != NULL)
2417         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
2419   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
2420      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
2421      {
2422         const address_space *space = cpu_get_address_space(cpu, spacenum);
2423         if (space != NULL)
24182424         {
2419            const address_space *space = cpu_get_address_space(machine->cpu[cpunum], spacenum);
2420            if (space != NULL)
2421            {
2422               memory_subview_item *subview;
2425            memory_subview_item *subview;
24232426
2424               /* determine the string and allocate a subview large enough */
2425               astring_printf(tempstring, "CPU '%s' (%s) %s memory", space->cpu->tag, cpu_get_name(space->cpu), space->name);
2426               subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
2427               memset(subview, 0, sizeof(*subview));
2427            /* determine the string and allocate a subview large enough */
2428            astring_printf(tempstring, "CPU '%s' (%s) %s memory", cpu->tag, cpu_get_name(cpu), space->name);
2429            subview = auto_malloc(sizeof(*subview) + astring_len(tempstring));
2430            memset(subview, 0, sizeof(*subview));
24282431
2429               /* populate the subview */
2430               subview->next = NULL;
2431               subview->index = curindex++;
2432               subview->space = space;
2433               subview->endianness = space->endianness;
2434               subview->prefsize = space->dbits / 8;
2435               strcpy(subview->name, astring_c(tempstring));
2432            /* populate the subview */
2433            subview->next = NULL;
2434            subview->index = curindex++;
2435            subview->space = space;
2436            subview->endianness = space->endianness;
2437            subview->prefsize = space->dbits / 8;
2438            strcpy(subview->name, astring_c(tempstring));
24362439
2437               /* add to the list */
2438               *tailptr = subview;
2439               tailptr = &subview->next;
2440            }
2441      }
2440            /* add to the list */
2441            *tailptr = subview;
2442            tailptr = &subview->next;
2443         }
2444   }
24422445
24432446   /* then add all the memory regions */
24442447   for (rgntag = memory_region_next(machine, NULL); rgntag != NULL; rgntag = memory_region_next(machine, rgntag))
24452448   {
24462449      UINT32 length = memory_region_length(machine, rgntag);
24472450      UINT32 flags = memory_region_flags(machine, rgntag);
2448
24492451      if (length > 0 && (flags & ROMREGION_DATATYPEMASK) == ROMREGION_DATATYPEROM)
24502452      {
2451              UINT8 little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
2452              UINT8 width = 1 << ((flags & ROMREGION_WIDTHMASK) >> 8);
2453              memory_subview_item *subview;
2453         UINT8 little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
2454         UINT8 width = 1 << ((flags & ROMREGION_WIDTHMASK) >> 8);
2455         memory_subview_item *subview;
24542456
24552457         /* determine the string and allocate a subview large enough */
24562458         astring_printf(tempstring, "Region '%s'", rgntag);
r3957r3958
26662668         for (chunknum = 0; chunknum < memdata->chunks_per_row; chunknum++)
26672669         {
26682670            int chunkindex = memdata->reverse_view ? (memdata->chunks_per_row - 1 - chunknum) : chunknum;
2669                      UINT64 chunkdata;
2670                      int ismapped;
2671            UINT64 chunkdata;
2672            int ismapped;
26712673
2672                      ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, addrbyte + chunknum * memdata->bytes_per_chunk, &chunkdata);
2674            ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, addrbyte + chunknum * memdata->bytes_per_chunk, &chunkdata);
26732675            dest = destrow + memdata->section[1].pos + 1 + chunkindex * posdata->spacing;
26742676            for (ch = 0; ch < posdata->spacing; ch++, dest++)
26752677               if (dest >= destmin && dest < destmax)
26762678               {
26772679                  UINT8 shift = posdata->shift[ch];
26782680                  if (shift < 64)
2679                     dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*';             
2681                     dest->byte = ismapped ? "0123456789ABCDEF"[(chunkdata >> shift) & 0x0f] : '*';
26802682               }
26812683         }
26822684
r3957r3958
27832785         hexchar = strchr(hexvals, tolower(chval));
27842786         if (hexchar == NULL)
27852787            break;
2786
27872788         ismapped = memory_view_read(memdata, memdata->bytes_per_chunk, address, &data);
27882789         if (!ismapped)
27892790            break;
r3957r3958
30213022      int ismapped;
30223023
30233024      ismapped = memdata->no_translation ? TRUE : memory_address_physical(space, TRANSLATE_READ_DEBUG, &dummyaddr);
3025      *data = ~(UINT64)0;
30243026      if (ismapped)
30253027      {
30263028         switch (size)
r3957r3958
30313033            case 8:   *data = debug_read_qword(space, offs, !memdata->no_translation); break;
30323034         }
30333035      }
3034
30353036      return ismapped;
30363037   }
30373038
r3957r3958
30443045      size /= 2;
30453046      ismapped  = memory_view_read(memdata, size, offs + 0 * size, &data0);
30463047      ismapped |= memory_view_read(memdata, size, offs + 1 * size, &data1);
3047
30483048      if (memdata->desc->endianness == ENDIANNESS_LITTLE)
30493049         *data = data0 | (data1 << (size * 8));
30503050      else
30513051         *data = data1 | (data0 << (size * 8));
3052
30533052      return ismapped;
30543053   }
30553054
30563055   /* all 0xff if out of bounds */
30573056   offs ^= memdata->desc->offsetxor;
30583057   if (offs >= memdata->desc->length)
3059           return FALSE;
3060
3061    *data = *((UINT8 *)memdata->desc->base + offs);
3062    return TRUE;
3058      return FALSE;
3059   *data = *((UINT8 *)memdata->desc->base + offs);
3060   return TRUE;
30633061}
30643062
30653063
r3957r3958
31123110#ifdef FD1094_HACK
31133111   if (memdata->desc->base == memory_region(view->machine, "user2"))
31143112   {
3115      extern void fd1094_regenerate_key(void);
3116      fd1094_regenerate_key();
3113      extern void fd1094_regenerate_key(running_machine *machine);
3114      fd1094_regenerate_key(view->machine);
31173115   }
31183116#endif
31193117}
src/emu/debug/debugcmd.c
r3957r3958
124124void debug_command_init(running_machine *machine)
125125{
126126   symbol_table *symtable = debug_cpu_get_global_symtable(machine);
127   int cpunum, itemnum;
127   const device_config *cpu;
128128   const char *name;
129   int itemnum;
129130
130131   /* add a few simple global functions */
131132   symtable_add_function(symtable, "min", NULL, 2, 2, execute_min);
r3957r3958
244245   debug_console_register_command(machine, "hardreset",   CMDFLAG_NONE, 0, 0, 1, execute_hardreset);
245246
246247   /* ask all the CPUs if they would like to register functions or symbols */
247   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
248      if (machine->cpu[cpunum] != NULL)
249      {
250         cpu_debug_init_func debug_init;
251         debug_init = (cpu_debug_init_func)cpu_get_info_fct(machine->cpu[cpunum], CPUINFO_PTR_DEBUG_INIT);
252         if (debug_init != NULL)
253            (*debug_init)(machine->cpu[cpunum]);
254      }
248   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
249   {
250      cpu_debug_init_func debug_init;
251      debug_init = (cpu_debug_init_func)device_get_info_fct(cpu, CPUINFO_FCT_DEBUG_INIT);
252      if (debug_init != NULL)
253         (*debug_init)(cpu);
254   }
255255
256256   add_exit_callback(machine, debug_command_exit);
257257
r3957r3958
268268
269269static void debug_command_exit(running_machine *machine)
270270{
271   int cpunum;
271   const device_config *cpu;
272272
273273   /* turn off all traces */
274   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
275      if (machine->cpu[cpunum] != NULL)
276         debug_cpu_trace(machine->cpu[cpunum], NULL, 0, NULL);
274   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
275      debug_cpu_trace(cpu, NULL, 0, NULL);
277276}
278277
279278
r3957r3958
854853
855854static void execute_focus(running_machine *machine, int ref, int params, const char *param[])
856855{
856   const device_config *scancpu;
857857   const device_config *cpu;
858   int cpunum;
859858
860859   /* validate params */
861860   if (!debug_command_parameter_cpu(machine, param[0], &cpu))
r3957r3958
865864   debug_cpu_ignore_cpu(cpu, 0);
866865
867866   /* then loop over CPUs and set the ignore flags on all other CPUs */
868   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
869      if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum] != cpu)
870         debug_cpu_ignore_cpu(machine->cpu[cpunum], 1);
867   for (scancpu = machine->cpu[0]; scancpu != NULL; scancpu = scancpu->typenext)
868      if (scancpu != cpu)
869         debug_cpu_ignore_cpu(scancpu, 1);
871870   debug_console_printf(machine, "Now focused on CPU '%s'\n", cpu->tag);
872871}
873872
r3957r3958
879878static void execute_ignore(running_machine *machine, int ref, int params, const char *param[])
880879{
881880   const device_config *cpuwhich[MAX_COMMAND_PARAMS];
882   int cpunum, paramnum;
881   const device_config *cpu;
882   int paramnum;
883883   char buffer[100];
884884   int buflen = 0;
885885
r3957r3958
887887   if (params == 0)
888888   {
889889      /* loop over all CPUs */
890      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
891         if (machine->cpu[cpunum] != NULL)
892         {
893            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
890      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
891      {
892         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
894893
895            /* build up a comma-separated list */
896            if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) == 0)
897            {
898               if (buflen == 0)
899                  buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", machine->cpu[cpunum]->tag);
900               else
901                  buflen += sprintf(&buffer[buflen], ", '%s'", machine->cpu[cpunum]->tag);
902            }
894         /* build up a comma-separated list */
895         if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) == 0)
896         {
897            if (buflen == 0)
898               buflen += sprintf(&buffer[buflen], "Currently ignoring CPU '%s'", cpu->tag);
899            else
900               buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag);
903901         }
902      }
904903
905904      /* special message for none */
906905      if (buflen == 0)
r3957r3958
920919      for (paramnum = 0; paramnum < params; paramnum++)
921920      {
922921         /* make sure this isn't the last live CPU */
923         for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
924            if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum] != cpuwhich[paramnum])
925               if ((cpu_get_debug_data(machine->cpu[cpunum])->flags & DEBUG_FLAG_OBSERVING) != 0)
926                  break;
927         if (cpunum == ARRAY_LENGTH(machine->cpu))
922         for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
923            if (cpu != cpuwhich[paramnum] && (cpu_get_debug_data(cpu)->flags & DEBUG_FLAG_OBSERVING) != 0)
924               break;
925         if (cpu == NULL)
928926         {
929927            debug_console_printf(machine, "Can't ignore all CPUs!\n");
930928            return;
r3957r3958
944942static void execute_observe(running_machine *machine, int ref, int params, const char *param[])
945943{
946944   const device_config *cpuwhich[MAX_COMMAND_PARAMS];
947   int cpunum, paramnum;
945   const device_config *cpu;
946   int paramnum;
948947   char buffer[100];
949948   int buflen = 0;
950949
r3957r3958
952951   if (params == 0)
953952   {
954953      /* loop over all CPUs */
955      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
956         if (machine->cpu[cpunum] != NULL)
957         {
958            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
954      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
955      {
956         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
959957
960            /* build up a comma-separated list */
961            if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) != 0)
962            {
963               if (buflen == 0)
964                  buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", machine->cpu[cpunum]->tag);
965               else
966                  buflen += sprintf(&buffer[buflen], ", '%s'", machine->cpu[cpunum]->tag);
967            }
958         /* build up a comma-separated list */
959         if ((cpuinfo->flags & DEBUG_FLAG_OBSERVING) != 0)
960         {
961            if (buflen == 0)
962               buflen += sprintf(&buffer[buflen], "Currently observing CPU '%s'", cpu->tag);
963            else
964               buflen += sprintf(&buffer[buflen], ", '%s'", cpu->tag);
968965         }
966      }
969967
970968      /* special message for none */
971969      if (buflen == 0)
r3957r3958
11031101   /* if 0 parameters, clear all */
11041102   if (params == 0)
11051103   {
1106      int cpunum;
1104      const device_config *cpu;
11071105
1108      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1109         if (machine->cpu[cpunum] != NULL)
1110         {
1111            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1112            debug_cpu_breakpoint *bp;
1113            while ((bp = cpuinfo->bplist) != NULL)
1114               debug_cpu_breakpoint_clear(machine, bp->index);
1115         }
1106      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1107      {
1108         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1109         debug_cpu_breakpoint *bp;
1110         while ((bp = cpuinfo->bplist) != NULL)
1111            debug_cpu_breakpoint_clear(machine, bp->index);
1112      }
11161113      debug_console_printf(machine, "Cleared all breakpoints\n");
11171114   }
11181115
r3957r3958
11421139   /* if 0 parameters, clear all */
11431140   if (params == 0)
11441141   {
1145      int cpunum;
1142      const device_config *cpu;
11461143
1147      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1148         if (machine->cpu[cpunum] != NULL)
1149         {
1150            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1151            debug_cpu_breakpoint *bp;
1152            for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
1153               debug_cpu_breakpoint_enable(machine, bp->index, ref);
1154         }
1144      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1145      {
1146         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1147         debug_cpu_breakpoint *bp;
1148         for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
1149            debug_cpu_breakpoint_enable(machine, bp->index, ref);
1150      }
11551151      if (ref == 0)
11561152         debug_console_printf(machine, "Disabled all breakpoints\n");
11571153      else
r3957r3958
11791175
11801176static void execute_bplist(running_machine *machine, int ref, int params, const char *param[])
11811177{
1182   int cpunum, printed = 0;
1178   const device_config *cpu;
1179   int printed = 0;
11831180   char buffer[256];
11841181
11851182   /* loop over all CPUs */
1186   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1187      if (machine->cpu[cpunum] != NULL)
1183   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1184   {
1185      const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1186
1187      if (cpuinfo->bplist != NULL)
11881188      {
1189         const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1189         debug_cpu_breakpoint *bp;
11901190
1191         if (cpuinfo->bplist != NULL)
1192         {
1193            debug_cpu_breakpoint *bp;
1191         debug_console_printf(machine, "CPU '%s' breakpoints:\n", cpu->tag);
11941192
1195            debug_console_printf(machine, "CPU %d breakpoints:\n", cpunum);
1196
1197            /* loop over the breakpoints */
1198            for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
1199            {
1200               int buflen;
1201               buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
1202               if (bp->condition)
1203                  buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
1204               if (bp->action)
1205                  buflen += sprintf(&buffer[buflen], " do %s", bp->action);
1206               debug_console_printf(machine, "%s\n", buffer);
1207               printed++;
1208            }
1193         /* loop over the breakpoints */
1194         for (bp = cpuinfo->bplist; bp != NULL; bp = bp->next)
1195         {
1196            int buflen;
1197            buflen = sprintf(buffer, "%c%4X @ %08X", bp->enabled ? ' ' : 'D', bp->index, bp->address);
1198            if (bp->condition)
1199               buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(bp->condition));
1200            if (bp->action)
1201               buflen += sprintf(&buffer[buflen], " do %s", bp->action);
1202            debug_console_printf(machine, "%s\n", buffer);
1203            printed++;
12091204         }
12101205      }
1206   }
12111207
12121208   if (!printed)
12131209      debug_console_printf(machine, "No breakpoints currently installed\n");
r3957r3958
12791275   /* if 0 parameters, clear all */
12801276   if (params == 0)
12811277   {
1282      int cpunum;
1278      const device_config *cpu;
12831279
1284      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1285         if (machine->cpu[cpunum] != NULL)
1286         {
1287            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1288            int spacenum;
1280      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1281      {
1282         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1283         int spacenum;
12891284
1290            for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1291            {
1292               debug_cpu_watchpoint *wp;
1293               while ((wp = cpuinfo->wplist[spacenum]) != NULL)
1294                  debug_cpu_watchpoint_clear(machine, wp->index);
1295            }
1285         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1286         {
1287            debug_cpu_watchpoint *wp;
1288            while ((wp = cpuinfo->wplist[spacenum]) != NULL)
1289               debug_cpu_watchpoint_clear(machine, wp->index);
12961290         }
1291      }
12971292      debug_console_printf(machine, "Cleared all watchpoints\n");
12981293   }
12991294
r3957r3958
13231318   /* if 0 parameters, clear all */
13241319   if (params == 0)
13251320   {
1326      int cpunum;
1321      const device_config *cpu;
13271322
1328      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1329         if (machine->cpu[cpunum] != NULL)
1330         {
1331            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1332            int spacenum;
1323      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1324      {
1325         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1326         int spacenum;
13331327
1334            for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1335            {
1336               debug_cpu_watchpoint *wp;
1337               for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
1338                  debug_cpu_watchpoint_enable(machine, wp->index, ref);
1339            }
1328         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1329         {
1330            debug_cpu_watchpoint *wp;
1331            for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
1332               debug_cpu_watchpoint_enable(machine, wp->index, ref);
13401333         }
1334      }
13411335      if (ref == 0)
13421336         debug_console_printf(machine, "Disabled all watchpoints\n");
13431337      else
r3957r3958
13651359
13661360static void execute_wplist(running_machine *machine, int ref, int params, const char *param[])
13671361{
1368   int cpunum, printed = 0;
1362   const device_config *cpu;
1363   int printed = 0;
13691364   char buffer[256];
13701365
13711366   /* loop over all CPUs */
1372   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1373      if (machine->cpu[cpunum] != NULL)
1374      {
1375         const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1376         int spacenum;
1367   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1368   {
1369      const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
1370      int spacenum;
13771371
1378         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1379            if (cpuinfo->wplist[spacenum] != NULL)
1380            {
1381               static const char *const types[] = { "unkn ", "read ", "write", "r/w  " };
1382               const address_space *space = cpu_get_address_space(machine->cpu[cpunum], spacenum);
1383               debug_cpu_watchpoint *wp;
1372      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1373         if (cpuinfo->wplist[spacenum] != NULL)
1374         {
1375            static const char *const types[] = { "unkn ", "read ", "write", "r/w  " };
1376            const address_space *space = cpu_get_address_space(cpu, spacenum);
1377            debug_cpu_watchpoint *wp;
13841378
1385               debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", space->cpu->tag, address_space_names[spacenum]);
1379            debug_console_printf(machine, "CPU '%s' %s space watchpoints:\n", cpu->tag, address_space_names[spacenum]);
13861380
1387               /* loop over the watchpoints */
1388               for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
1389               {
1390                  int buflen;
1391                  buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
1392                        wp->index, memory_byte_to_address(space, wp->address), memory_byte_to_address_end(space, wp->address + wp->length) - 1, types[wp->type & 3]);
1393                  if (wp->condition)
1394                     buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
1395                  if (wp->action)
1396                     buflen += sprintf(&buffer[buflen], " do %s", wp->action);
1397                  debug_console_printf(machine, "%s\n", buffer);
1398                  printed++;
1399               }
1381            /* loop over the watchpoints */
1382            for (wp = cpuinfo->wplist[spacenum]; wp != NULL; wp = wp->next)
1383            {
1384               int buflen;
1385               buflen = sprintf(buffer, "%c%4X @ %08X-%08X %s", wp->enabled ? ' ' : 'D',
1386                     wp->index, memory_byte_to_address(space, wp->address), memory_byte_to_address_end(space, wp->address + wp->length) - 1, types[wp->type & 3]);
1387               if (wp->condition)
1388                  buflen += sprintf(&buffer[buflen], " if %s", expression_original_string(wp->condition));
1389               if (wp->action)
1390                  buflen += sprintf(&buffer[buflen], " do %s", wp->action);
1391               debug_console_printf(machine, "%s\n", buffer);
1392               printed++;
14001393            }
1401      }
1394         }
1395   }
14021396
14031397   if (!printed)
14041398      debug_console_printf(machine, "No watchpoints currently installed\n");
r3957r3958
14201414   if (params == 0)
14211415   {
14221416      int cleared = FALSE;
1423      int cpunum;
14241417
14251418      /* loop over CPUs and find live spots */
1426      for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1427         if (machine->cpu[cpunum] != NULL)
1428         {
1429            const cpu_debug_data *cpuinfo = cpu_get_debug_data(machine->cpu[cpunum]);
1419      for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1420      {
1421         const cpu_debug_data *cpuinfo = cpu_get_debug_data(cpu);
14301422
1431            if (cpuinfo->hotspots != NULL)
1432            {
1433               debug_cpu_hotspot_track(cpuinfo->device, 0, 0);
1434               debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", machine->cpu[cpunum]->tag);
1435               cleared = TRUE;
1436            }
1423         if (cpuinfo->hotspots != NULL)
1424         {
1425            debug_cpu_hotspot_track(cpuinfo->device, 0, 0);
1426            debug_console_printf(machine, "Cleared hotspot tracking on CPU '%s'\n", cpu->tag);
1427            cleared = TRUE;
14371428         }
1429      }
14381430
14391431      /* if we cleared, we're done */
14401432      if (cleared)
src/emu/debug/express.c
r3957r3958
19531953   int strindex;
19541954   int all_digits, i;
19551955
1956   assert_always(entry->table == table, "Mismatched symbol tables");
1957
19561958   /* we cannot add numeric symbols */
19571959   all_digits = TRUE;
19581960   for (i = 0; name[i]; i++)
r3957r3958
20182020   symbol.type = SMT_REGISTER;
20192021   symbol.info.reg.getter = getter;
20202022   symbol.info.reg.setter = setter;
2023   symbol.table = table;
20212024   return symtable_add(table, name, &symbol);
20222025}
20232026
r3957r3958
20362039   symbol.info.func.minparams = minparams;
20372040   symbol.info.func.maxparams = maxparams;
20382041   symbol.info.func.execute = execute;
2042   symbol.table = table;
20392043   return symtable_add(table, name, &symbol);
20402044}
20412045
r3957r3958
20522056   symbol.ref = NULL;
20532057   symbol.type = SMT_VALUE;
20542058   symbol.info.gen.value = value;
2059   symbol.table = table;
20552060   return symtable_add(table, name, &symbol);
20562061}
20572062
src/emu/debug/debughlp.c
r3957r3958
7878      "\n"
7979      "  help [<topic>] -- get help on a particular topic\n"
8080      "  do <expression> -- evaluates the given expression\n"
81      "  symlist [<cpunum>] -- lists registered symbols\n"
81      "  symlist [<cpu>] -- lists registered symbols\n"
8282      "  softreset -- executes a soft reset\n"
8383      "  hardreset -- executes a hard reset\n"
8484      "  print <item>[,...] -- prints one or more <item>s to the console\n"
r3957r3958
9595      "Memory Commands\n"
9696      "Type help <command> for further details on each command\n"
9797      "\n"
98      "  dasm <filename>,<address>,<length>[,<opcodes>[,<cpunum>]] -- disassemble to the given file\n"
98      "  dasm <filename>,<address>,<length>[,<opcodes>[,<cpu>]] -- disassemble to the given file\n"
9999      "  f[ind] <address>,<length>[,<data>[,...]] -- search program memory for data\n"
100100      "  f[ind]d <address>,<length>[,<data>[,...]] -- search data memory for data\n"
101101      "  f[ind]i <address>,<length>[,<data>[,...]] -- search I/O memory for data\n"
102      "  dump <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump program memory as text\n"
103      "  dumpd <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump data memory as text\n"
104      "  dumpi <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]] -- dump I/O memory as text\n"
105      "  save <filename>,<address>,<length>[,<cpunum>] -- save binary program memory to the given file\n"
106      "  saved <filename>,<address>,<length>[,<cpunum>] -- save binary data memory to the given file\n"
107      "  savei <filename>,<address>,<length>[,<cpunum>] -- save binary I/O memory to the given file\n"
102      "  dump <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump program memory as text\n"
103      "  dumpd <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump data memory as text\n"
104      "  dumpi <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]] -- dump I/O memory as text\n"
105      "  save <filename>,<address>,<length>[,<cpu>] -- save binary program memory to the given file\n"
106      "  saved <filename>,<address>,<length>[,<cpu>] -- save binary data memory to the given file\n"
107      "  savei <filename>,<address>,<length>[,<cpu>] -- save binary I/O memory to the given file\n"
108108      "  map <address> -- map logical program address to physical address and bank\n"
109109      "  mapd <address> -- map logical data address to physical address and bank\n"
110110      "  mapi <address> -- map logical I/O address to physical address and bank\n"
r3957r3958
124124      "  gt[ime] <milliseconds> -- resumes execution until the given delay has elapsed\n"
125125      "  gv[blank] -- resumes execution, setting temp breakpoint on the next VBLANK (F8)\n"
126126      "  n[ext] -- executes until the next CPU switch (F6)\n"
127      "  focus <cpunum> -- focuses debugger only on <cpunum>\n"
128      "  ignore [<cpunum>[,<cpunum>[,...]]] -- stops debugging on <cpunum>\n"
129      "  observe [<cpunum>[,<cpunum>[,...]]] -- resumes debugging on <cpunum>\n"
130      "  trace {<filename>|OFF}[,<cpunum>[,<action>]] -- trace the given CPU to a file (defaults to active CPU)\n"
131      "  traceover {<filename>|OFF}[,<cpunum>[,<action>]] -- trace the given CPU to a file, but skip subroutines (defaults to active CPU)\n"
127      "  focus <cpu> -- focuses debugger only on <cpu>\n"
128      "  ignore [<cpu>[,<cpu>[,...]]] -- stops debugging on <cpu>\n"
129      "  observe [<cpu>[,<cpu>[,...]]] -- resumes debugging on <cpu>\n"
130      "  trace {<filename>|OFF}[,<cpu>[,<action>]] -- trace the given CPU to a file (defaults to active CPU)\n"
131      "  traceover {<filename>|OFF}[,<cpu>[,<action>]] -- trace the given CPU to a file, but skip subroutines (defaults to active CPU)\n"
132132      "  traceflush -- flushes all open trace files\n"
133133   },
134134   {
r3957r3958
156156      "  wpdisable [<wpnum>] -- disables a given watchpoint or all if no <wpnum> specified\n"
157157      "  wpenable [<wpnum>] -- enables a given watchpoint or all if no <wpnum> specified\n"
158158      "  wplist -- lists all the watchpoints\n"
159      "  hotspot [<cpunum>,[<depth>[,<hits>]]] -- attempt to find hotspots\n"
159      "  hotspot [<cpu>,[<depth>[,<hits>]]] -- attempt to find hotspots\n"
160160   },
161161   {
162162      "expressions",
r3957r3958
219219   {
220220      "symlist",
221221      "\n"
222      "  symlist [<cpunum>]\n"
222      "  symlist [<cpu>]\n"
223223      "\n"
224      "Lists registered symbols. If <cpunum> is not specified, then symbols in the global symbol table are "
225      "displayed; otherwise, the symbols for <cpunum>'s specific CPU are displayed. Symbols are listed "
224      "Lists registered symbols. If <cpu> is not specified, then symbols in the global symbol table are "
225      "displayed; otherwise, the symbols for <cpu>'s specific CPU are displayed. Symbols are listed "
226226      "alphabetically. Read-only symbols are flagged with an asterisk.\n"
227227      "\n"
228228      "Examples:\n"
r3957r3958
377377   {
378378      "dasm",
379379      "\n"
380      "  dasm <filename>,<address>,<length>[,<opcodes>[,<cpunum>]]\n"
380      "  dasm <filename>,<address>,<length>[,<opcodes>[,<cpu>]]\n"
381381      "\n"
382382      "The dasm command disassembles program memory to the file specified in the <filename> parameter. "
383383      "<address> indicates the address of the start of disassembly, and <length> indicates how much "
384384      "memory to disassemble. The range <address> through <address>+<length>-1 inclusive will be "
385385      "output to the file. By default, the raw opcode data is output with each line. The optional "
386386      "<opcodes> parameter can be used to enable (1) or disable(0) this feature. Finally, you can "
387      "disassemble code from another CPU by specifying the <cpunum> parameter.\n"
387      "disassemble code from another CPU by specifying the <cpu> parameter.\n"
388388      "\n"
389389      "Examples:\n"
390390      "\n"
r3957r3958
431431   {
432432      "dump",
433433      "\n"
434      "  dump[{d|i}] <filename>,<address>,<length>[,<size>[,<ascii>[,<cpunum>]]]\n"
434      "  dump[{d|i}] <filename>,<address>,<length>[,<size>[,<ascii>[,<cpu>]]]\n"
435435      "\n"
436436      "The dump/dumpd/dumpi commands dump memory to the text file specified in the <filename> "
437437      "parameter. 'dump' will dump program space memory, while 'dumpd' will dump data space memory "
r3957r3958
442442      "<size> parameter, which can be used to group the data in 1, 2, 4 or 8-byte chunks. The optional "
443443      "<ascii> parameter can be used to enable (1) or disable (0) the output of ASCII characters to the "
444444      "right of each line; by default, this is enabled. Finally, you can dump memory from another CPU "
445      "by specifying the <cpunum> parameter.\n"
445      "by specifying the <cpu> parameter.\n"
446446      "\n"
447447      "Examples:\n"
448448      "\n"
r3957r3958
457457   {
458458      "save",
459459      "\n"
460      "  save[{d|i}] <filename>,<address>,<length>[,<cpunum>]\n"
460      "  save[{d|i}] <filename>,<address>,<length>[,<cpu>]\n"
461461      "\n"
462462      "The save/saved/savei commands save raw memory to the binary file specified in the <filename> "
463463      "parameter. 'save' will save program space memory, while 'saved' will save data space memory "
464464      "and 'savei' will save I/O space memory. <address> indicates the address of the start of saving, "
465465      "and <length> indicates how much memory to save. The range <address> through <address>+<length>-1 "
466466      "inclusive will be output to the file. You can also save memory from another CPU by specifying the "
467      "<cpunum> parameter.\n"
467      "<cpu> parameter.\n"
468468      "\n"
469469      "Examples:\n"
470470      "\n"
r3957r3958
610610   {
611611      "focus",
612612      "\n"
613      "  focus <cpunum>\n"
613      "  focus <cpu>\n"
614614      "\n"
615      "Sets the debugger focus exclusively to the given <cpunum>. This is equivalent to specifying "
615      "Sets the debugger focus exclusively to the given <cpu>. This is equivalent to specifying "
616616      "'ignore' on all other CPUs.\n"
617617      "\n"
618618      "Examples:\n"
r3957r3958
623623   {
624624      "ignore",
625625      "\n"
626      "  ignore [<cpunum>[,<cpunum>[,...]]]\n"
626      "  ignore [<cpu>[,<cpu>[,...]]]\n"
627627      "\n"
628      "Ignores the specified <cpunum> in the debugger. This means that you won't ever see execution "
628      "Ignores the specified <cpu> in the debugger. This means that you won't ever see execution "
629629      "on that CPU, nor will you be able to set breakpoints on that CPU. To undo this change use "
630      "the 'observe' command. You can specify multiple <cpunum>s in a single command. Note also that "
630      "the 'observe' command. You can specify multiple <cpu>s in a single command. Note also that "
631631      "you are not permitted to ignore all CPUs; at least one must be active at all times.\n"
632632      "\n"
633633      "Examples:\n"
r3957r3958
644644   {
645645      "observe",
646646      "\n"
647      "  observe [<cpunum>[,<cpunum>[,...]]]\n"
647      "  observe [<cpu>[,<cpu>[,...]]]\n"
648648      "\n"
649      "Re-enables interaction with the specified <cpunum> in the debugger. This command undoes the "
650      "effects of the 'ignore' command. You can specify multiple <cpunum>s in a single command.\n"
649      "Re-enables interaction with the specified <cpu> in the debugger. This command undoes the "
650      "effects of the 'ignore' command. You can specify multiple <cpu>s in a single command.\n"
651651      "\n"
652652      "Examples:\n"
653653      "\n"
r3957r3958
663663   {
664664      "trace",
665665      "\n"
666      "  trace {<filename>|OFF}[,<cpunum>[,<action>]]\n"
666      "  trace {<filename>|OFF}[,<cpu>[,<action>]]\n"
667667      "\n"
668      "Starts or stops tracing of the execution of the specified <cpunum>. If <cpunum> is omitted, "
668      "Starts or stops tracing of the execution of the specified <cpu>. If <cpu> is omitted, "
669669      "the currently active CPU is specified. When enabling tracing, specify the filename in the "
670670      "<filename> parameter. To disable tracing, substitute the keyword 'off' for <filename>. If you "
671671      "wish to log additional information on each trace, you can append an <action> parameter which "
r3957r3958
695695   {
696696      "traceover",
697697      "\n"
698      "  traceover {<filename>|OFF}[,<cpunum>[,<action>]]\n"
698      "  traceover {<filename>|OFF}[,<cpu>[,<action>]]\n"
699699      "\n"
700      "Starts or stops tracing of the execution of the specified <cpunum>. When tracing reaches "
700      "Starts or stops tracing of the execution of the specified <cpu>. When tracing reaches "
701701      "a subroutine or call, tracing will skip over the subroutine. The same algorithm is used as is "
702702      "used in the step over command. This means that traceover will not work properly when calls "
703703      "are recusive or the return address is not immediately following the call instruction. If "
704      "<cpunum> is omitted, the currently active CPU is specified. When enabling tracing, specify the "
704      "<cpu> is omitted, the currently active CPU is specified. When enabling tracing, specify the "
705705      "filename in the <filename> parameter. To disable tracing, substitute the keyword 'off' for "
706706      "<filename>. If you wish to log additional information on each trace, you can append an <action> "
707707      "parameter which is a command that is executed before each trace is logged. Generally, this is "
r3957r3958
929929   {
930930      "hotspot",
931931      "\n"
932      "  hotspot [<cpunum>,[<depth>[,<hits>]]]\n"
932      "  hotspot [<cpu>,[<depth>[,<hits>]]]\n"
933933      "\n"
934934      "The hotspot command attempts to help locate hotspots in the code where speedup opportunities "
935      "might be present. <cpunum>, which defaults to the currently active CPU, specified which "
935      "might be present. <cpu>, which defaults to the currently active CPU, specified which "
936936      "processor's memory to track. <depth>, which defaults to 64, controls the depth of the search "
937937      "buffer. The search buffer tracks the last <depth> memory reads from unique PCs. The <hits> "
938938      "parameter, which defaults to 250, specifies the minimum number of hits to report.\n"
src/emu/cpu/m6805/m6805.c
r3957r3958
6666   int      nmi_state;
6767} m6805_Regs;
6868
69/****************************************************************************/
70/* Read a byte from given memory location                                   */
71/****************************************************************************/
72#define M6805_RDMEM(Addr) ((unsigned)memory_read_byte_8be(cpustate->program, Addr))
73
74/****************************************************************************/
75/* Write a byte to given memory location                                    */
76/****************************************************************************/
77#define M6805_WRMEM(Addr,Value) (memory_write_byte_8be(cpustate->program, Addr,Value))
78
79/****************************************************************************/
80/* M6805_RDOP() is identical to M6805_RDMEM() except it is used for reading */
81/* opcodes. In case of system with memory mapped I/O, this function can be  */
82/* used to greatly speed up emulation                                       */
83/****************************************************************************/
84#define M6805_RDOP(Addr) ((unsigned)memory_decrypted_read_byte(cpustate->program, Addr))
85
86/****************************************************************************/
87/* M6805_RDOP_ARG() is identical to M6805_RDOP() but it's used for reading  */
88/* opcode arguments. This difference can be used to support systems that    */
89/* use different encoding mechanisms for opcodes and opcode arguments       */
90/****************************************************************************/
91#define M6805_RDOP_ARG(Addr) ((unsigned)memory_raw_read_byte(cpustate->program, Addr))
92
6993#define SUBTYPE   cpustate->subtype   /* CPU Type */
7094#define SP_MASK cpustate->sp_mask   /* stack pointer mask */
7195#define SP_LOW   cpustate->sp_low   /* stack pointer low water mark */
r3957r3958
903927      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
904928      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
905929
906      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
907      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 12;               break;
908      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
909      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
910      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
911      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
912      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
913      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
914      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
930      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
931      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 12;               break;
932      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
933      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
934      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
935      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
936      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
937      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
938      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
915939
916940      case CPUINFO_INT_INPUT_STATE + M6805_IRQ_LINE:   info->i = cpustate->irq_state[M6805_IRQ_LINE]; break;
917941
r3957r3958
926950      case CPUINFO_INT_REGISTER + M6805_CC:         info->i = CC;                     break;
927951
928952      /* --- the following bits of info are returned as pointers to data or functions --- */
929      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6805);      break;
930      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6805);            break;
931      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6805);         break;
932      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m6805);            break;
933      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6805);      break;
934      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
935      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6805);break;
953      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6805);      break;
954      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6805);            break;
955      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6805);         break;
956      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m6805);            break;
957      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6805);      break;
958      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
959      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6805);break;
936960      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->iCount;            break;
937961
938962      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
9901014      case CPUINFO_INT_INPUT_STATE + M68705_INT_TIMER:   info->i = cpustate->irq_state[M68705_INT_TIMER]; break;
9911015
9921016      /* --- the following bits of info are returned as pointers to data or functions --- */
993      case CPUINFO_PTR_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(m68705);   break;
994      case CPUINFO_PTR_INIT:                        info->init = CPU_INIT_NAME(m68705);         break;
995      case CPUINFO_PTR_RESET:                        info->reset = CPU_RESET_NAME(m68705);      break;
1017      case CPUINFO_FCT_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(m68705);   break;
1018      case CPUINFO_FCT_INIT:                        info->init = CPU_INIT_NAME(m68705);         break;
1019      case CPUINFO_FCT_RESET:                        info->reset = CPU_RESET_NAME(m68705);      break;
9961020
9971021      /* --- the following bits of info are returned as NULL-terminated strings --- */
9981022      case CPUINFO_STR_NAME:                        strcpy(info->s, "M68705");   break;
r3957r3958
10461070      case CPUINFO_INT_INPUT_STATE + HD63705_INT_ADCONV:   info->i = cpustate->irq_state[HD63705_INT_ADCONV];   break;
10471071      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:      info->i = cpustate->irq_state[HD63705_INT_NMI];      break;
10481072
1049      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16; break;
1073      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16; break;
10501074
10511075      /* --- the following bits of info are returned as pointers to data or functions --- */
1052      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hd63705);   break;
1053      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(hd63705);      break;
1054      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(hd63705);      break;
1076      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hd63705);   break;
1077      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(hd63705);      break;
1078      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(hd63705);      break;
10551079
10561080      /* --- the following bits of info are returned as NULL-terminated strings --- */
10571081      case CPUINFO_STR_NAME:                     strcpy(info->s, "HD63705");   break;
src/emu/cpu/m6805/m6805.h
r3957r3958
1212#define M6805_IRQ_LINE      0
1313
1414extern CPU_GET_INFO( m6805 );
15#define CPU_M6805 CPU_GET_INFO_NAME( m6805 )
1516
1617/****************************************************************************
1718 * 68705 section
r3957r3958
2930#define M68705_INT_TIMER         0x01
3031
3132extern CPU_GET_INFO( m68705 );
33#define CPU_M68705 CPU_GET_INFO_NAME( m68705 )
3234#endif
3335
3436/****************************************************************************
r3957r3958
5860#define HD63705_INT_NMI            0x08
5961
6062extern CPU_GET_INFO( hd63705 );
63#define CPU_HD63705 CPU_GET_INFO_NAME( hd63705 )
6164#endif
6265
63/****************************************************************************/
64/* Read a byte from given memory location                                   */
65/****************************************************************************/
66#define M6805_RDMEM(Addr) ((unsigned)memory_read_byte_8be(cpustate->program, Addr))
67
68/****************************************************************************/
69/* Write a byte to given memory location                                    */
70/****************************************************************************/
71#define M6805_WRMEM(Addr,Value) (memory_write_byte_8be(cpustate->program, Addr,Value))
72
73/****************************************************************************/
74/* M6805_RDOP() is identical to M6805_RDMEM() except it is used for reading */
75/* opcodes. In case of system with memory mapped I/O, this function can be  */
76/* used to greatly speed up emulation                                       */
77/****************************************************************************/
78#define M6805_RDOP(Addr) ((unsigned)memory_decrypted_read_byte(cpustate->program, Addr))
79
80/****************************************************************************/
81/* M6805_RDOP_ARG() is identical to M6805_RDOP() but it's used for reading  */
82/* opcode arguments. This difference can be used to support systems that    */
83/* use different encoding mechanisms for opcodes and opcode arguments       */
84/****************************************************************************/
85#define M6805_RDOP_ARG(Addr) ((unsigned)memory_raw_read_byte(cpustate->program, Addr))
86
8766CPU_DISASSEMBLE( m6805 );
8867
8968#endif /* __M6805_H__ */
src/emu/cpu/v30mz/v30mz.c
r3957r3958
5050typedef UINT32 DWORD;
5151
5252#include "v30mz.h"
53#include "necintrf.h"
53#include "nec.h"
5454
5555extern int necv_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom);
5656
r3957r3958
913913   return necv_dasm_one(buffer, pc, oprom);
914914}
915915
916static void nec_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, int type)
916static void nec_init(const device_config *device, cpu_irq_callback irqcallback, int type)
917917{
918918   v30mz_state *cpustate = device->token;
919919
r3957r3958
942942   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
943943}
944944
945static CPU_INIT( v30mz ) { nec_init(device, index, clock, irqcallback, 3); }
945static CPU_INIT( v30mz ) { nec_init(device, irqcallback, 3); }
946946static CPU_EXECUTE( v30mz )
947947{
948948   v30mz_state *cpustate = device->token;
r3957r3958
10501050      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
10511051      case CPUINFO_INT_MAX_CYCLES:               info->i = 80;                     break;
10521052
1053      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1054      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
1055      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1056      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1057      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1058      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1059      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1060      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
1061      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1053      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1054      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
1055      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1056      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1057      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1058      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1059      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1060      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
1061      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
10621062
10631063      case CPUINFO_INT_INPUT_STATE + 0:            info->i = (cpustate->pending_irq & INT_IRQ) ? ASSERT_LINE : CLEAR_LINE; break;
10641064      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;               break;
r3957r3958
10861086      case CPUINFO_INT_REGISTER + NEC_PENDING:      info->i = cpustate->pending_irq;            break;
10871087
10881088      /* --- the following bits of info are returned as pointers to data or functions --- */
1089      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(nec);         break;
1090      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(nec);            break;
1091      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(nec);               break;
1092      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1093      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nec);         break;
1089      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(nec);         break;
1090      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(nec);            break;
1091      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(nec);               break;
1092      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1093      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nec);         break;
10941094      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
10951095
10961096      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
11381138        case CPUINFO_STR_REGISTER + NEC_VECTOR:         sprintf(info->s, "V:%02X", cpustate->int_vector); break;
11391139
11401140   /* --- the following bits of info are returned as pointers to data or functions --- */
1141   case CPUINFO_PTR_INIT:      info->init = CPU_INIT_NAME(v30mz);
1141   case CPUINFO_FCT_INIT:      info->init = CPU_INIT_NAME(v30mz);
11421142               break;
1143   case CPUINFO_PTR_EXECUTE:   info->execute = CPU_EXECUTE_NAME(v30mz);
1143   case CPUINFO_FCT_EXECUTE:   info->execute = CPU_EXECUTE_NAME(v30mz);
11441144               break;
11451145
11461146   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/v30mz/nec.h
r0r3958
1/* ASG 971222 -- rewrote this interface */
2#ifndef __NECINTRF_H__
3#define __NECINTRF_H__
4
5#include "cpuintrf.h"
6
7enum
8{
9   NEC_PC=0,
10   NEC_IP, NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
11   NEC_FLAGS, NEC_ES, NEC_CS, NEC_SS, NEC_DS,
12   NEC_VECTOR, NEC_PENDING
13};
14
15/* Public functions */
16extern CPU_GET_INFO( v30mz );
17#define CPU_V30MZ CPU_GET_INFO_NAME( v30mz )
18
19#endif /* __NECINTRF_H__ */
src/emu/cpu/lh5801/lh5801.c
r3957r3958
190190      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
191191      case CPUINFO_INT_MAX_CYCLES:               info->i = 19;                     break;
192192
193      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
194      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
195      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
196      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
197      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
198      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
199      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
200      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
201      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
193      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
194      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
195      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
196      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
197      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
198      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
199      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
200      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
201      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
202202
203203      case CPUINFO_INT_INPUT_STATE:               info->i = cpustate->irq_state;            break;
204204
r3957r3958
220220      case CPUINFO_INT_REGISTER + LH5801_DP:         info->i = cpustate->dp;               break;
221221
222222      /* --- the following bits of info are returned as pointers to data or functions --- */
223      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(lh5801);      break;
224      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(lh5801);            break;
225      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(lh5801);            break;
226      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                  break;
227      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(lh5801);         break;
228      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
229      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(lh5801);      break;
223      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(lh5801);      break;
224      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(lh5801);            break;
225      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(lh5801);            break;
226      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                  break;
227      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(lh5801);         break;
228      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
229      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(lh5801);      break;
230230      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
231231
232232      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/lh5801/lh5801.h
r3957r3958
7878#define LH5801_IRQ 1
7979
8080CPU_GET_INFO( lh5801 );
81#define CPU_LH5801 CPU_GET_INFO_NAME( lh5801 )
8182extern CPU_DISASSEMBLE( lh5801 );
8283
8384#endif /* __LH5801_H__ */
src/emu/cpu/m6809/m6809.c
r3957r3958
11071107      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
11081108      case CPUINFO_INT_MAX_CYCLES:               info->i = 19;                     break;
11091109
1110      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1111      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
1112      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1113      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1114      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1115      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1116      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1117      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1118      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1110      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1111      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
1112      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1113      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1114      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1115      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1116      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1117      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1118      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
11191119
11201120      case CPUINFO_INT_INPUT_STATE + M6809_IRQ_LINE:   info->i = m68_state->irq_state[M6809_IRQ_LINE]; break;
11211121      case CPUINFO_INT_INPUT_STATE + M6809_FIRQ_LINE:   info->i = m68_state->irq_state[M6809_FIRQ_LINE]; break;
r3957r3958
11361136      case CPUINFO_INT_REGISTER + M6809_DP:         info->i = DP;                     break;
11371137
11381138      /* --- the following bits of info are returned as pointers to data or functions --- */
1139      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6809);         break;
1140      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6809);            break;
1141      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6809);            break;
1142      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m6809);            break;
1143      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6809);         break;
1144      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1145      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6809);         break;
1139      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6809);         break;
1140      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6809);            break;
1141      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6809);            break;
1142      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m6809);            break;
1143      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6809);         break;
1144      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1145      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6809);         break;
11461146      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &m68_state->icount;         break;
11471147
11481148      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/m6809/m6809.h
r3957r3958
1717#define M6809_FIRQ_LINE 1   /* FIRQ line number */
1818
1919CPU_GET_INFO( m6809 );
20#define CPU_M6809 CPU_GET_INFO_NAME( m6809 )
2021
2122/* M6809e has LIC line to indicate opcode/data fetch */
2223CPU_GET_INFO( m6809e );
24#define CPU_M6809E CPU_GET_INFO_NAME( m6809e )
2325
2426
2527CPU_DISASSEMBLE( m6809 );
src/emu/cpu/h83002/h8.h
r3957r3958
8686   H8_SERIAL_1,
8787};
8888
89CPU_GET_INFO( h8_300 );
9089CPU_GET_INFO( h8_3002 );
91CPU_GET_INFO( h8_3344 );
90CPU_GET_INFO( h8_3007 );
91CPU_GET_INFO( h8_3044 );
92CPU_GET_INFO( h8_3334 );
9293
94#define CPU_H83002 CPU_GET_INFO_NAME( h8_3002 )
95#define CPU_H83007 CPU_GET_INFO_NAME( h8_3007 )
96#define CPU_H83044 CPU_GET_INFO_NAME( h8_3044 )
97#define CPU_H83334 CPU_GET_INFO_NAME( h8_3334 )
98
99
93100#endif /* __H83002_H__ */
src/emu/cpu/h83002/h8_16.c
r3957r3958
541541
542542   switch(state) {
543543   // Interface functions and variables
544   case CPUINFO_PTR_SET_INFO:               info->setinfo     = CPU_SET_INFO_NAME(h8);      break;
545   case CPUINFO_PTR_INIT:                  info->init        = CPU_INIT_NAME(h8);         break;
546   case CPUINFO_PTR_RESET:                  info->reset       = CPU_RESET_NAME(h8);         break;
547   case CPUINFO_PTR_EXIT:                  info->exit        = 0;                     break;
548   case CPUINFO_PTR_EXECUTE:               info->execute     = CPU_EXECUTE_NAME(h8);      break;
549   case CPUINFO_PTR_BURN:                  info->burn        = 0;                     break;
550   case CPUINFO_PTR_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(h8_32);   break;
544   case CPUINFO_FCT_SET_INFO:               info->setinfo     = CPU_SET_INFO_NAME(h8);      break;
545   case CPUINFO_FCT_INIT:                  info->init        = CPU_INIT_NAME(h8);         break;
546   case CPUINFO_FCT_RESET:                  info->reset       = CPU_RESET_NAME(h8);         break;
547   case CPUINFO_FCT_EXIT:                  info->exit        = 0;                     break;
548   case CPUINFO_FCT_EXECUTE:               info->execute     = CPU_EXECUTE_NAME(h8);      break;
549   case CPUINFO_FCT_BURN:                  info->burn        = 0;                     break;
550   case CPUINFO_FCT_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(h8_32);   break;
551551   case CPUINFO_PTR_INSTRUCTION_COUNTER:      info->icount      = &h8->cyccnt;               break;
552552   case CPUINFO_INT_CONTEXT_SIZE:            info->i           = sizeof(h83xx_state);      break;
553553   case CPUINFO_INT_MIN_INSTRUCTION_BYTES:      info->i           = 2;                     break;
554554   case CPUINFO_INT_MAX_INSTRUCTION_BYTES:      info->i           = 10;                     break;
555555
556556      // Bus sizes
557   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;                  break;
558   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 24;                  break;
559   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;                  break;
560   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
561   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
562   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
563   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;                  break;
564   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;                  break;
565   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;                  break;
557   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;                  break;
558   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 24;                  break;
559   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;                  break;
560   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                  break;
561   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;                  break;
562   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;                  break;
563   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;                  break;
564   case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 16;                  break;
565   case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;                  break;
566566
567567      // Internal maps
568   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3002_internal_map); break;
569   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map16 = NULL;   break;
570   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map16 = NULL;   break;
568   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3002_internal_map); break;
569   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map16 = NULL;   break;
570   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map16 = NULL;   break;
571571
572572      // CPU misc parameters
573573   case CPUINFO_STR_NAME:                  strcpy(info->s, "H8/3002");                  break;
r3957r3958
614614{
615615   switch (state)
616616   {
617      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3044_internal_map);  break;
618      case CPUINFO_PTR_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(h8_24);               break;
617      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(h8_3044_internal_map);  break;
618      case CPUINFO_FCT_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(h8_24);               break;
619619      case CPUINFO_STR_NAME:            strcpy(info->s, "H8/3044");    break;
620620      default:
621621         CPU_GET_INFO_CALL(h8_3002);
r3957r3958
626626{
627627   switch (state)
628628   {
629      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = address_map_h8_3007_internal_map;  break;
630      case CPUINFO_PTR_INIT:            info->init = CPU_INIT_NAME(h8_3007);      break;
629      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = address_map_h8_3007_internal_map;  break;
630      case CPUINFO_FCT_INIT:            info->init = CPU_INIT_NAME(h8_3007);      break;
631631      case CPUINFO_STR_NAME:            strcpy(info->s, "H8/3007");      break;
632632      default:
633633         CPU_GET_INFO_CALL(h8_3002);
src/emu/cpu/h83002/h8_8.c
r3957r3958
517517
518518   switch(state) {
519519   // Interface functions and variables
520   case CPUINFO_PTR_SET_INFO:         info->setinfo     = CPU_SET_INFO_NAME(h8);            break;
521   case CPUINFO_PTR_INIT:            info->init        = CPU_INIT_NAME(h8bit);               break;
522   case CPUINFO_PTR_RESET:            info->reset       = CPU_RESET_NAME(h8bit);               break;
523   case CPUINFO_PTR_EXIT:            info->exit        = 0;                     break;
524   case CPUINFO_PTR_EXECUTE:         info->execute     = CPU_EXECUTE_NAME(h8);               break;
525   case CPUINFO_PTR_BURN:            info->burn        = 0;                     break;
526   case CPUINFO_PTR_DISASSEMBLE:         info->disassemble = CPU_DISASSEMBLE_NAME(h8);               break;
520   case CPUINFO_FCT_SET_INFO:         info->setinfo     = CPU_SET_INFO_NAME(h8);            break;
521   case CPUINFO_FCT_INIT:            info->init        = CPU_INIT_NAME(h8bit);               break;
522   case CPUINFO_FCT_RESET:            info->reset       = CPU_RESET_NAME(h8bit);               break;
523   case CPUINFO_FCT_EXIT:            info->exit        = 0;                     break;
524   case CPUINFO_FCT_EXECUTE:         info->execute     = CPU_EXECUTE_NAME(h8);               break;
525   case CPUINFO_FCT_BURN:            info->burn        = 0;                     break;
526   case CPUINFO_FCT_DISASSEMBLE:         info->disassemble = CPU_DISASSEMBLE_NAME(h8);               break;
527527   case CPUINFO_PTR_INSTRUCTION_COUNTER:      info->icount      = &h8->cyccnt;               break;
528528   case CPUINFO_INT_CONTEXT_SIZE:         info->i           = sizeof(h83xx_state);      break;
529529   case CPUINFO_INT_MIN_INSTRUCTION_BYTES:      info->i           = 2;                     break;
530530   case CPUINFO_INT_MAX_INSTRUCTION_BYTES:      info->i           = 10;                     break;
531531
532532      // Bus sizes
533   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                  break;
534   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;                  break;
535   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;                  break;
536   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
537   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
538   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
539   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 8;                  break;
540   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 16;                  break;
541   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:   info->i = 0;                  break;
533   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;                  break;
534   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 16;                  break;
535   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;                  break;
536   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                  break;
537   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;                  break;
538   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;                  break;
539   case CPUINFO_INT_DATABUS_WIDTH_IO:   info->i = 8;                  break;
540   case CPUINFO_INT_ADDRBUS_WIDTH_IO:   info->i = 16;                  break;
541   case CPUINFO_INT_ADDRBUS_SHIFT_IO:   info->i = 0;                  break;
542542
543543      // Internal maps
544   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = address_map_h8_3334_internal_map; break;
545   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = NULL;   break;
546   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map16 = NULL;   break;
544   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = address_map_h8_3334_internal_map; break;
545   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = NULL;   break;
546   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map16 = NULL;   break;
547547
548548      // CPU misc parameters
549549   case CPUINFO_STR_NAME:               strcpy(info->s, "H8/3334");                  break;
src/emu/cpu/m68000/m68000.h
r3957r3958
5959
6060enum
6161{
62   CPUINFO_PTR_M68K_RESET_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC,
63   CPUINFO_PTR_M68K_CMPILD_CALLBACK,
64   CPUINFO_PTR_M68K_RTE_CALLBACK,
65   CPUINFO_PTR_M68K_TAS_CALLBACK
62   CPUINFO_FCT_M68K_RESET_CALLBACK = CPUINFO_FCT_CPU_SPECIFIC,
63   CPUINFO_FCT_M68K_CMPILD_CALLBACK,
64   CPUINFO_FCT_M68K_RTE_CALLBACK,
65   CPUINFO_FCT_M68K_TAS_CALLBACK
6666};
6767
6868typedef void (*m68k_bkpt_ack_func)(const device_config *device, UINT32 data);
r3957r3958
7979CPU_GET_INFO( m68020 );
8080CPU_GET_INFO( m68040 );
8181
82#define CPU_M68000 CPU_GET_INFO_NAME( m68000 )
83#define CPU_M68008 CPU_GET_INFO_NAME( m68008 )
84#define CPU_M68010 CPU_GET_INFO_NAME( m68010 )
85#define CPU_M68EC020 CPU_GET_INFO_NAME( m68ec020 )
86#define CPU_M68020 CPU_GET_INFO_NAME( m68020 )
87#define CPU_M68040 CPU_GET_INFO_NAME( m68040 )
88
8289void m68k_set_encrypted_opcode_range(const device_config *device, offs_t start, offs_t end);
8390
8491unsigned int m68k_disassemble_raw(char* str_buff, unsigned int pc, const unsigned char* opdata, const unsigned char* argdata, unsigned int cpu_type);
src/emu/cpu/m68000/m68kcpu.c
r3957r3958
597597      case CPUINFO_INT_MIN_CYCLES:            info->i = 4;                           break;
598598      case CPUINFO_INT_MAX_CYCLES:            info->i = 158;                           break;
599599
600      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;                  break;
601      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;                  break;
602      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                  break;
603      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
604      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;                  break;
605      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                  break;
606      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                  break;
607      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;                  break;
608      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;                  break;
600      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;                  break;
601      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;                  break;
602      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                  break;
603      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                  break;
604      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;                  break;
605      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                  break;
606      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                  break;
607      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;                  break;
608      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;                  break;
609609
610610      case CPUINFO_INT_INPUT_STATE + 0:         info->i = 0;  /* there is no level 0 */         break;
611611      case CPUINFO_INT_INPUT_STATE + 1:         info->i = (m68k->virq_state >> 1) & 1;         break;
r3957r3958
645645      case CPUINFO_INT_REGISTER + M68K_PREF_DATA:   info->i = m68k->pref_data;                   break;
646646
647647      /* --- the following bits of info are returned as pointers to data or functions --- */
648      case CPUINFO_PTR_SET_INFO:               /* set per-core */                        break;
649      case CPUINFO_PTR_INIT:                  /* set per-core */                        break;
650      case CPUINFO_PTR_RESET:                  info->reset = CPU_RESET_NAME(m68k);            break;
651      case CPUINFO_PTR_EXECUTE:               info->execute = CPU_EXECUTE_NAME(m68k);         break;
652      case CPUINFO_PTR_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(m68k);   break;
648      case CPUINFO_FCT_SET_INFO:               /* set per-core */                        break;
649      case CPUINFO_FCT_INIT:                  /* set per-core */                        break;
650      case CPUINFO_FCT_RESET:                  info->reset = CPU_RESET_NAME(m68k);            break;
651      case CPUINFO_FCT_EXECUTE:               info->execute = CPU_EXECUTE_NAME(m68k);         break;
652      case CPUINFO_FCT_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(m68k);   break;
653653      case CPUINFO_PTR_INSTRUCTION_COUNTER:      info->icount = &m68k->remaining_cycles;         break;
654654
655655      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
756756      case CPUINFO_INT_REGISTER + M68K_PREF_ADDR:   m68k->pref_addr = info->i;                  break;
757757
758758      /* --- the following bits of info are set as pointers to data or functions --- */
759      case CPUINFO_PTR_M68K_RESET_CALLBACK:      m68k->reset_instr_callback = (m68k_reset_func)info->f; break;
760      case CPUINFO_PTR_M68K_CMPILD_CALLBACK:      m68k->cmpild_instr_callback = (m68k_cmpild_func)info->f; break;
761      case CPUINFO_PTR_M68K_RTE_CALLBACK:         m68k->rte_instr_callback = (m68k_rte_func)info->f; break;
762      case CPUINFO_PTR_M68K_TAS_CALLBACK:         m68k->tas_instr_callback = (m68k_tas_func)info->f; break;
759      case CPUINFO_FCT_M68K_RESET_CALLBACK:      m68k->reset_instr_callback = (m68k_reset_func)info->f; break;
760      case CPUINFO_FCT_M68K_CMPILD_CALLBACK:      m68k->cmpild_instr_callback = (m68k_cmpild_func)info->f; break;
761      case CPUINFO_FCT_M68K_RTE_CALLBACK:         m68k->rte_instr_callback = (m68k_rte_func)info->f; break;
762      case CPUINFO_FCT_M68K_TAS_CALLBACK:         m68k->tas_instr_callback = (m68k_tas_func)info->f; break;
763763   }
764764}
765765
r3957r3958
939939   switch (state)
940940   {
941941      /* --- the following bits of info are returned as pointers to data or functions --- */
942      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68000);      break;
943      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(m68000);            break;
942      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68000);      break;
943      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68000);            break;
944944
945945      /* --- the following bits of info are returned as NULL-terminated strings --- */
946946      case CPUINFO_STR_NAME:                  strcpy(info->s, "68000");                  break;
r3957r3958
987987   switch (state)
988988   {
989989      /* --- the following bits of info are returned as 64-bit signed integers --- */
990      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                  break;
991      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 22;                  break;
990      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;                  break;
991      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 22;                  break;
992992
993993      /* --- the following bits of info are returned as pointers to data or functions --- */
994      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68008);      break;
995      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(m68008);            break;
994      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68008);      break;
995      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68008);            break;
996996
997997      /* --- the following bits of info are returned as NULL-terminated strings --- */
998998      case CPUINFO_STR_NAME:                  strcpy(info->s, "68008");                  break;
r3957r3958
10541054      case CPUINFO_INT_REGISTER + M68K_DFC:        info->i = m68k->dfc;                     break;
10551055
10561056      /* --- the following bits of info are returned as pointers to data or functions --- */
1057      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68010);      break;
1058      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(m68010);            break;
1057      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68010);      break;
1058      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68010);            break;
10591059
10601060      /* --- the following bits of info are returned as NULL-terminated strings --- */
10611061      case CPUINFO_STR_NAME:                  strcpy(info->s, "68010");                  break;
r3957r3958
11291129      case CPUINFO_INT_MIN_CYCLES:            info->i = 2;                           break;
11301130      case CPUINFO_INT_MAX_CYCLES:            info->i = 158;                           break;
11311131
1132      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                  break;
1133      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;                  break;
1132      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;                  break;
1133      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;                  break;
11341134
11351135      case CPUINFO_INT_PC:                  info->i = REG_PC;                        break;
11361136      case CPUINFO_INT_REGISTER + M68K_MSP:      info->i = (m68k->s_flag && m68k->m_flag) ? REG_SP : REG_MSP; break;
r3957r3958
11411141      case CPUINFO_INT_REGISTER + M68K_DFC:        info->i = m68k->dfc;                     break;
11421142
11431143      /* --- the following bits of info are returned as pointers to data or functions --- */
1144      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68020);      break;
1145      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(m68020);            break;
1144      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68020);      break;
1145      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68020);            break;
11461146
11471147      /* --- the following bits of info are returned as NULL-terminated strings --- */
11481148      case CPUINFO_STR_NAME:                  strcpy(info->s, "68020");                  break;
r3957r3958
12251225   switch (state)
12261226   {
12271227      /* --- the following bits of info are returned as 64-bit signed integers --- */
1228      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;                  break;
1228      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;                  break;
12291229      case CPUINFO_INT_PC:                  info->i = REG_PC & 0x00ffffff;                break;
12301230
12311231      /* --- the following bits of info are returned as pointers to data or functions --- */
1232      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68ec020);   break;
1233      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(m68ec020);         break;
1232      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(m68ec020);   break;
1233      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(m68ec020);         break;
12341234
12351235      /* --- the following bits of info are returned as NULL-terminated strings --- */
12361236      case CPUINFO_STR_NAME:                  strcpy(info->s, "68EC020");                  break;
r3957r3958
13001300      case CPUINFO_INT_MIN_CYCLES:            info->i = 2;                        break;
13011301      case CPUINFO_INT_MAX_CYCLES:            info->i = 158;                        break;
13021302
1303      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1304      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1303      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1304      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
13051305
13061306      case CPUINFO_INT_PC:                  info->i = REG_PC;                        break;
13071307      case CPUINFO_INT_REGISTER + M68K_MSP:      info->i = (m68k->s_flag && m68k->m_flag) ? REG_SP : REG_MSP; break;
r3957r3958
13121312      case CPUINFO_INT_REGISTER + M68K_DFC:        info->i = m68k->dfc;                     break;
13131313
13141314      /* --- the following bits of info are returned as pointers to data or functions --- */
1315      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m68040);      break;
1316      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m68040);            break;
1315      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m68040);      break;
1316      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m68040);            break;
13171317
13181318      /* --- the following bits of info are returned as NULL-terminated strings --- */
13191319      case CPUINFO_STR_NAME:                     strcpy(info->s, "68040");            break;
src/emu/cpu/ccpu/ccpu.h
r3957r3958
5757***************************************************************************/
5858
5959CPU_GET_INFO( ccpu );
60#define CPU_CCPU CPU_GET_INFO_NAME( ccpu )
61
6062void ccpu_wdt_timer_trigger(const device_config *device);
6163
6264CPU_DISASSEMBLE( ccpu );
src/emu/cpu/ccpu/ccpu.c
r3957r3958
737737      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                           break;
738738      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                           break;
739739
740      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                     break;
741      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 15;                     break;
742      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                     break;
743      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;                     break;
744      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 8;                     break;
745      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;                     break;
746      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;                     break;
747      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 5;                     break;
748      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;                     break;
740      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;                     break;
741      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 15;                     break;
742      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                     break;
743      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 16;                     break;
744      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 8;                     break;
745      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -1;                     break;
746      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;                     break;
747      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 5;                     break;
748      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;                     break;
749749
750750      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */                     break;
751751
r3957r3958
770770      case CPUINFO_INT_REGISTER + CCPU_T:          info->i = cpustate->T;                     break;
771771
772772      /* --- the following bits of info are returned as pointers to data or functions --- */
773      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ccpu);      break;
774      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ccpu);            break;
775      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ccpu);            break;
776      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                        break;
777      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ccpu);         break;
778      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
779      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ccpu);   break;
773      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ccpu);      break;
774      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ccpu);            break;
775      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ccpu);            break;
776      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                        break;
777      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ccpu);         break;
778      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
779      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ccpu);   break;
780780      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
781781
782782      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/tms34010/tms34010.h
r3957r3958
1919/* register indexes for get_reg and set_reg */
2020enum
2121{
22   TMS34010_PC = 1,
22   TMS34010_PC,
2323   TMS34010_SP,
2424   TMS34010_ST,
2525   TMS34010_A0,
r3957r3958
5151   TMS34010_B11,
5252   TMS34010_B12,
5353   TMS34010_B13,
54   TMS34010_B14
54   TMS34010_B14,
55
56   TMS34010_GENPC = REG_GENPC,
57   TMS34010_GENSP = REG_GENSP,
58   TMS34010_GENPCBASE = REG_GENPCBASE
5559};
5660
5761
r3957r3958
207211void tms34010_get_display_params(const device_config *cpu, tms34010_display_params *params);
208212
209213CPU_GET_INFO( tms34010 );
214#define CPU_TMS34010 CPU_GET_INFO_NAME( tms34010 )
210215
211216/* PUBLIC FUNCTIONS - 34020 */
212217CPU_GET_INFO( tms34020 );
218#define CPU_TMS34020 CPU_GET_INFO_NAME( tms34020 )
213219
214220
215221/* Host control interface */
src/emu/cpu/tms34010/34010ops.c
r3957r3958
8888      return;
8989
9090   PUSH(tms, tms->pc);
91   PUSH(tms, GET_ST(tms));
91   PUSH(tms, tms->st);
9292   RESET_ST(tms);
9393   tms->pc = RLONG(tms, 0xfffffc20);
9494     COUNT_UNKNOWN_CYCLES(tms,16);
r3957r3958
15621562
15631563#define GETST(R)                                    \
15641564{                                                  \
1565   R##REG(tms,DSTREG(op)) = GET_ST(tms);                        \
1565   R##REG(tms,DSTREG(op)) = tms->st;                        \
15661566   COUNT_CYCLES(tms,1);                                 \
15671567}
15681568static void getst_a (tms34010_state *tms, UINT16 op) { GETST(A); }
r3957r3958
18441844
18451845static void pushst(tms34010_state *tms, UINT16 op)
18461846{
1847   PUSH(tms, GET_ST(tms));
1847   PUSH(tms, tms->st);
18481848   COUNT_CYCLES(tms,2);
18491849}
18501850
r3957r3958
18921892   if (t)
18931893   {
18941894      PUSH(tms, tms->pc);
1895      PUSH(tms, GET_ST(tms));
1895      PUSH(tms, tms->st);
18961896   }
18971897   RESET_ST(tms);
18981898   tms->pc = RLONG(tms, 0xffffffe0-(t<<5));
src/emu/cpu/tms34010/tms34010.c
r3957r3958
4545struct _tms34010_state
4646{
4747   UINT32            pc;
48   UINT32            ppc;
4849   UINT32            st;
4950   void (*pixel_write)(tms34010_state *tms, offs_t offset, UINT32 data);
5051   UINT32 (*pixel_read)(tms34010_state *tms, offs_t offset);
r3957r3958
7677      XY xy;
7778   } regs[31];
7879
79   /* for the 34010, we only copy 32 of these into the new state */
8080   UINT16 IOregs[64];
81
82   cpu_state_table      state;
8183};
8284
8385#include "34010ops.h"
8486
8587
88
8689/***************************************************************************
8790    GLOBAL VARIABLES
8891***************************************************************************/
r3957r3958
98101static STATE_POSTLOAD( tms34010_state_postload );
99102
100103
104
101105/***************************************************************************
102106    MACROS
103107***************************************************************************/
r3957r3958
188192
189193
190194/***************************************************************************
191    INLINE SHORTCUTS
195    CPU STATE DESCRIPTION
192196***************************************************************************/
193197
194/* Combine indiviual flags into the Status Register */
195INLINE UINT32 GET_ST(tms34010_state *tms)
198#define TMS340X0_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
199   CPU_STATE_ENTRY(TMS34010_##_name, #_name, _format, tms34010_state, _member, _datamask, ~0, _flags)
200
201static const cpu_state_entry state_array[] =
196202{
197   return tms->st;
198}
203   TMS340X0_STATE_ENTRY(PC,  "%08X", pc, 0xffffffff, 0)
204   TMS340X0_STATE_ENTRY(GENPC, "%08X", pc, 0xffffffff, CPUSTATE_NOSHOW)
205   TMS340X0_STATE_ENTRY(GENPCBASE, "%08X", ppc, 0xffffffff, CPUSTATE_NOSHOW)
199206
207   TMS340X0_STATE_ENTRY(SP,  "%08X", regs[15].reg, 0xffffffff, 0)
208   TMS340X0_STATE_ENTRY(GENSP, "%08X", regs[15].reg, 0xffffffff, CPUSTATE_NOSHOW)
209
210   TMS340X0_STATE_ENTRY(ST,  "%08X", st, 0xffffffff, 0)
211
212   TMS340X0_STATE_ENTRY(A0,  "%08X", regs[0].reg,     0xffffffff, 0)
213   TMS340X0_STATE_ENTRY(A1,  "%08X", regs[1].reg,     0xffffffff, 0)
214   TMS340X0_STATE_ENTRY(A2,  "%08X", regs[2].reg,     0xffffffff, 0)
215   TMS340X0_STATE_ENTRY(A3,  "%08X", regs[3].reg,     0xffffffff, 0)
216   TMS340X0_STATE_ENTRY(A4,  "%08X", regs[4].reg,     0xffffffff, 0)
217   TMS340X0_STATE_ENTRY(A5,  "%08X", regs[5].reg,     0xffffffff, 0)
218   TMS340X0_STATE_ENTRY(A6,  "%08X", regs[6].reg,     0xffffffff, 0)
219   TMS340X0_STATE_ENTRY(A7,  "%08X", regs[7].reg,     0xffffffff, 0)
220   TMS340X0_STATE_ENTRY(A8,  "%08X", regs[8].reg,     0xffffffff, 0)
221   TMS340X0_STATE_ENTRY(A9,  "%08X", regs[9].reg,     0xffffffff, 0)
222   TMS340X0_STATE_ENTRY(A10, "%08X", regs[10].reg,    0xffffffff, 0)
223   TMS340X0_STATE_ENTRY(A11, "%08X", regs[11].reg,    0xffffffff, 0)
224   TMS340X0_STATE_ENTRY(A12, "%08X", regs[12].reg,    0xffffffff, 0)
225   TMS340X0_STATE_ENTRY(A13, "%08X", regs[13].reg,    0xffffffff, 0)
226   TMS340X0_STATE_ENTRY(A14, "%08X", regs[14].reg,    0xffffffff, 0)
227   TMS340X0_STATE_ENTRY(B0,  "%08X", regs[30-0].reg,  0xffffffff, 0)
228   TMS340X0_STATE_ENTRY(B1,  "%08X", regs[30-1].reg,  0xffffffff, 0)
229   TMS340X0_STATE_ENTRY(B2,  "%08X", regs[30-2].reg,  0xffffffff, 0)
230   TMS340X0_STATE_ENTRY(B3,  "%08X", regs[30-3].reg,  0xffffffff, 0)
231   TMS340X0_STATE_ENTRY(B4,  "%08X", regs[30-4].reg,  0xffffffff, 0)
232   TMS340X0_STATE_ENTRY(B5,  "%08X", regs[30-5].reg,  0xffffffff, 0)
233   TMS340X0_STATE_ENTRY(B6,  "%08X", regs[30-6].reg,  0xffffffff, 0)
234   TMS340X0_STATE_ENTRY(B7,  "%08X", regs[30-7].reg,  0xffffffff, 0)
235   TMS340X0_STATE_ENTRY(B8,  "%08X", regs[30-8].reg,  0xffffffff, 0)
236   TMS340X0_STATE_ENTRY(B9,  "%08X", regs[30-9].reg,  0xffffffff, 0)
237   TMS340X0_STATE_ENTRY(B10, "%08X", regs[30-10].reg, 0xffffffff, 0)
238   TMS340X0_STATE_ENTRY(B11, "%08X", regs[30-11].reg, 0xffffffff, 0)
239   TMS340X0_STATE_ENTRY(B12, "%08X", regs[30-12].reg, 0xffffffff, 0)
240   TMS340X0_STATE_ENTRY(B13, "%08X", regs[30-13].reg, 0xffffffff, 0)
241   TMS340X0_STATE_ENTRY(B14, "%08X", regs[30-14].reg, 0xffffffff, 0)
242};
243
244static const cpu_state_table state_table_template =
245{
246   NULL,                  /* pointer to the base of state (offsets are relative to this) */
247   0,                     /* subtype this table refers to */
248   ARRAY_LENGTH(state_array),   /* number of entries */
249   state_array               /* array of entries */
250};
251
252
253
254/***************************************************************************
255    INLINE SHORTCUTS
256***************************************************************************/
257
200258/* Break up Status Register into indiviual flags */
201259INLINE void SET_ST(tms34010_state *tms, UINT32 st)
202260{
r3957r3958
326384***************************************************************************/
327385
328386/* No Raster Op + No Transparency */
329#define WP(T,m1,m2)                                                           \
387#define WP(T,m1,m2)                                                        \
330388   UINT32 a = TOBYTE(offset & 0xfffffff0);                                       \
331389   UINT32 pix = TMS34010_RDMEM_WORD(T,a);                                       \
332390   UINT32 shiftcount = offset & m1;                                          \
r3957r3958
363421   TMS34010_WRMEM_WORD(T, a, pix);                                             \
364422
365423/* Raster Op + Transparency */
366#define WP_R_T(T,m1,m2)                                                        \
424#define WP_R_T(T,m1,m2)                                                     \
367425   UINT32 a = TOBYTE(offset & 0xfffffff0);                                       \
368426   UINT32 pix = TMS34010_RDMEM_WORD(T,a);                                       \
369427   UINT32 shiftcount = offset & m1;                                          \
r3957r3958
540598      if (!(IOREG(tms, REG_HSTCTLH) & 0x0200))
541599      {
542600         PUSH(tms, tms->pc);
543         PUSH(tms, GET_ST(tms));
601         PUSH(tms, tms->st);
544602      }
545603
546604      /* leap to the vector */
r3957r3958
596654   if (vector)
597655   {
598656      PUSH(tms, tms->pc);
599      PUSH(tms, GET_ST(tms));
657      PUSH(tms, tms->st);
600658      RESET_ST(tms);
601659      tms->pc = RLONG(tms, vector);
602660      COUNT_CYCLES(tms,16);
r3957r3958
624682   tms->irq_callback = irqcallback;
625683   tms->device = device;
626684   tms->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
627   tms->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, configdata->screen_tag);
685   tms->screen = devtag_get_device(device->machine, VIDEO_SCREEN, configdata->screen_tag);
628686
687   /* set up the state table */
688   tms->state = state_table_template;
689   tms->state.baseptr = tms;
690   tms->state.subtypemask = 1;
691
629692   /* allocate a scanline timer and set it to go off at the start */
630693   tms->scantimer = timer_alloc(device->machine, scanline_callback, tms);
631   timer_adjust_oneshot(tms->scantimer, attotime_zero, index);
694   timer_adjust_oneshot(tms->scantimer, attotime_zero, 0);
632695
633696   /* allocate the shiftreg */
634697   tms->shiftreg = auto_malloc(SHIFTREG_SIZE);
r3957r3958
656719   UINT16 *shiftreg = tms->shiftreg;
657720   cpu_irq_callback save_irqcallback = tms->irq_callback;
658721   emu_timer *save_scantimer = tms->scantimer;
722   cpu_state_table savetable = tms->state;
659723
660724   memset(tms, 0, sizeof(*tms));
661725
r3957r3958
666730   tms->scantimer = save_scantimer;
667731   tms->device = device;
668732   tms->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
733   tms->state = savetable;
669734
670735   /* fetch the initial PC and reset the state */
671736   tms->pc = RLONG(tms, 0xffffffe0) & 0xfffffff0;
r3957r3958
737802{
738803   tms34010_state *tms = ptr;
739804   int type = param;
740   int cpunum;
741805
742806   /* call through to the CPU to generate the int */
743807   IOREG(tms, REG_INTPEND) |= type;
744808   LOG(("TMS34010 '%s' set internal interrupt $%04x\n", tms->device->tag, type));
745809
746810   /* generate triggers so that spin loops can key off them */
747   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
748      if (machine->cpu[cpunum] == tms->device)
749      {
750         cpu_triggerint(machine->cpu[cpunum]);
751         break;
752      }
811   cpu_triggerint(tms->device);
753812}
754813
755814
r3957r3958
783842   {
784843      do
785844      {
786         UINT16 op = ROPCODE(tms);
845         UINT16 op;
846         tms->ppc = tms->pc;
847         op = ROPCODE(tms);
787848         (*opcode_table[op >> 4])(tms, op);
788849      } while (tms->icount > 0);
789850   }
r3957r3958
792853      do
793854      {
794855         UINT16 op;
795         if ((tms->device->machine->debug_flags & DEBUG_FLAG_CALL_HOOK) != 0)
796         {
797            tms->st = GET_ST(tms);
798            debugger_instruction_hook(tms->device, tms->pc);
799         }
856         debugger_instruction_hook(tms->device, tms->pc);
857         tms->ppc = tms->pc;
800858         op = ROPCODE(tms);
801859         (*opcode_table[op >> 4])(tms, op);
802860      } while (tms->icount > 0);
r3957r3958
893951   tms34010_state *tms = ptr;
894952   const rectangle *current_visarea;
895953   int vsblnk, veblnk, vtotal;
896   int vcount = param >> 8;
897   int cpunum = param & 0xff;
954   int vcount = param;
898955   int enabled;
899956   int master;
900957
r3957r3958
10251082
10261083   /* note that we add !master (0 or 1) as a attoseconds value; this makes no practical difference */
10271084   /* but helps ensure that masters are updated first before slaves */
1028   timer_adjust_oneshot(tms->scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(tms->screen, vcount, 0), !master), cpunum | (vcount << 8));
1085   timer_adjust_oneshot(tms->scantimer, attotime_add_attoseconds(video_screen_get_time_until_pos(tms->screen, vcount, 0), !master), vcount);
10291086}
10301087
10311088
r3957r3958
10681125   pen_t blackpen = get_black_pen(screen->machine);
10691126   tms34010_display_params params;
10701127   tms34010_state *tms = NULL;
1071   int cpunum = -1;
1128   const device_config *cpu;
10721129   int x;
10731130
10741131   /* find the owning CPU */
1075   for (cpunum = 0; cpunum < ARRAY_LENGTH(screen->machine->cpu); cpunum++)
1132   for (cpu = screen->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
10761133   {
1077      const device_config *cpudevice = screen->machine->cpu[cpunum];
1078      if (cpudevice != NULL)
1134      cpu_type type = cpu_get_type(cpu);
1135      if (type == CPU_TMS34010 || type == CPU_TMS34020)
10791136      {
1080         const cpu_class_header *classdata = cpudevice->classtoken;
1081         if (classdata->cputype == CPU_TMS34010 || classdata->cputype == CPU_TMS34020)
1082         {
1083            tms = cpudevice->token;
1084            if (tms->config != NULL && tms->config->scanline_callback != NULL && tms->screen == screen)
1085               break;
1086            tms = NULL;
1087         }
1137         tms = cpu->token;
1138         if (tms->config != NULL && tms->config->scanline_callback != NULL && tms->screen == screen)
1139            break;
1140         tms = NULL;
10881141      }
10891142   }
10901143   if (tms == NULL)
r3957r3958
12591312   }
12601313
12611314//  if (LOG_CONTROL_REGS)
1262//      logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
1315//      logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(tms->device->machine), ioreg_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
12631316}
12641317
12651318
r3957r3958
12961349   IOREG(tms, offset) = data;
12971350
12981351//  if (LOG_CONTROL_REGS)
1299//      logerror("CPU#%d@%08X: %s = %04X (%d)\n", cpunum, cpu_get_pc(space->cpu), ioreg020_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
1352//      logerror("%s: %s = %04X (%d)\n", cpuexec_describe_context(device->machine), ioreg020_name[offset], IOREG(tms, offset), video_screen_get_vpos(tms->screen));
13001353
13011354   switch (offset)
13021355   {
r3957r3958
14551508   int result, total;
14561509
14571510//  if (LOG_CONTROL_REGS)
1458//      logerror("CPU#%d@%08X: read %s\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset]);
1511//      logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
14591512
14601513   switch (offset)
14611514   {
r3957r3958
14981551   int result, total;
14991552
15001553//  if (LOG_CONTROL_REGS)
1501//      logerror("CPU#%d@%08X: read %s\n", cpunum, cpu_get_pc(space->cpu), ioreg_name[offset]);
1554//      logerror("%s: read %s\n", cpuexec_describe_context(device->machine), ioreg_name[offset]);
15021555
15031556   switch (offset)
15041557   {
r3957r3958
16661719   switch (state)
16671720   {
16681721      /* --- the following bits of info are set as 64-bit signed integers --- */
1669      case CPUINFO_INT_INPUT_STATE + 0:            set_irq_line(tms, 0, info->i);            break;
1670      case CPUINFO_INT_INPUT_STATE + 1:            set_irq_line(tms, 1, info->i);            break;
1671
1672      case CPUINFO_INT_PC:                         tms->pc = info->i;                      break;
1673      case CPUINFO_INT_REGISTER + TMS34010_PC:      tms->pc = info->i;                     break;
1674      case CPUINFO_INT_SP:
1675      case CPUINFO_INT_REGISTER + TMS34010_SP:      SP(tms) = info->i;                     break;
1676      case CPUINFO_INT_REGISTER + TMS34010_ST:      tms->st = info->i;                     break;
1677      case CPUINFO_INT_REGISTER + TMS34010_A0:      AREG(tms, 0) = info->i;                  break;
1678      case CPUINFO_INT_REGISTER + TMS34010_A1:      AREG(tms, 1) = info->i;                  break;
1679      case CPUINFO_INT_REGISTER + TMS34010_A2:      AREG(tms, 2) = info->i;                  break;
1680      case CPUINFO_INT_REGISTER + TMS34010_A3:      AREG(tms, 3) = info->i;                  break;
1681      case CPUINFO_INT_REGISTER + TMS34010_A4:      AREG(tms, 4) = info->i;                  break;
1682      case CPUINFO_INT_REGISTER + TMS34010_A5:      AREG(tms, 5) = info->i;                  break;
1683      case CPUINFO_INT_REGISTER + TMS34010_A6:      AREG(tms, 6) = info->i;                  break;
1684      case CPUINFO_INT_REGISTER + TMS34010_A7:      AREG(tms, 7) = info->i;                  break;
1685      case CPUINFO_INT_REGISTER + TMS34010_A8:      AREG(tms, 8) = info->i;                  break;
1686      case CPUINFO_INT_REGISTER + TMS34010_A9:      AREG(tms, 9) = info->i;                  break;
1687      case CPUINFO_INT_REGISTER + TMS34010_A10:      AREG(tms, 10) = info->i;                  break;
1688      case CPUINFO_INT_REGISTER + TMS34010_A11:      AREG(tms, 11) = info->i;                  break;
1689      case CPUINFO_INT_REGISTER + TMS34010_A12:      AREG(tms, 12) = info->i;                  break;
1690      case CPUINFO_INT_REGISTER + TMS34010_A13:      AREG(tms, 13) = info->i;                  break;
1691      case CPUINFO_INT_REGISTER + TMS34010_A14:      AREG(tms, 14) = info->i;                  break;
1692      case CPUINFO_INT_REGISTER + TMS34010_B0:      BREG(tms, 0) = info->i;                  break;
1693      case CPUINFO_INT_REGISTER + TMS34010_B1:      BREG(tms, 1) = info->i;                  break;
1694      case CPUINFO_INT_REGISTER + TMS34010_B2:      BREG(tms, 2) = info->i;                  break;
1695      case CPUINFO_INT_REGISTER + TMS34010_B3:      BREG(tms, 3) = info->i;                  break;
1696      case CPUINFO_INT_REGISTER + TMS34010_B4:      BREG(tms, 4) = info->i;                  break;
1697      case CPUINFO_INT_REGISTER + TMS34010_B5:      BREG(tms, 5) = info->i;                  break;
1698      case CPUINFO_INT_REGISTER + TMS34010_B6:      BREG(tms, 6) = info->i;                  break;
1699      case CPUINFO_INT_REGISTER + TMS34010_B7:      BREG(tms, 7) = info->i;                  break;
1700      case CPUINFO_INT_REGISTER + TMS34010_B8:      BREG(tms, 8) = info->i;                  break;
1701      case CPUINFO_INT_REGISTER + TMS34010_B9:      BREG(tms, 9) = info->i;                  break;
1702      case CPUINFO_INT_REGISTER + TMS34010_B10:      BREG(tms, 10) = info->i;                  break;
1703      case CPUINFO_INT_REGISTER + TMS34010_B11:      BREG(tms, 11) = info->i;                  break;
1704      case CPUINFO_INT_REGISTER + TMS34010_B12:      BREG(tms, 12) = info->i;                  break;
1705      case CPUINFO_INT_REGISTER + TMS34010_B13:      BREG(tms, 13) = info->i;                  break;
1706      case CPUINFO_INT_REGISTER + TMS34010_B14:      BREG(tms, 14) = info->i;                  break;
1722      case CPUINFO_INT_INPUT_STATE + 0:            set_irq_line(tms, 0, info->i);      break;
1723      case CPUINFO_INT_INPUT_STATE + 1:            set_irq_line(tms, 1, info->i);      break;
17071724   }
17081725}
17091726
r3957r3958
17201737   switch (state)
17211738   {
17221739      /* --- the following bits of info are returned as 64-bit signed integers --- */
1723      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(tms34010_state);      break;
1724      case CPUINFO_INT_INPUT_LINES:               info->i = 2;                     break;
1725      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
1726      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
1727      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
1728      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 8;                     break;
1729      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                     break;
1730      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 10;                     break;
1731      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
1732      case CPUINFO_INT_MAX_CYCLES:               info->i = 10000;                  break;
1740      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(tms34010_state);   break;
1741      case CPUINFO_INT_INPUT_LINES:               info->i = 2;                  break;
1742      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                  break;
1743      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;      break;
1744      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                  break;
1745      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 8;                  break;
1746      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                  break;
1747      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 10;                  break;
1748      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                  break;
1749      case CPUINFO_INT_MAX_CYCLES:               info->i = 10000;               break;
17331750
1734      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
1735      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1736      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 3;               break;
1737      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1738      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1739      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1740      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1741      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1742      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1751      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 16;                  break;
1752      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:       info->i = 32;                  break;
1753      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:       info->i = 3;                  break;
17431754
17441755      case CPUINFO_INT_INPUT_STATE + 0:            info->i = (IOREG(tms, REG_INTPEND) & TMS34010_INT1) ? ASSERT_LINE : CLEAR_LINE; break;
17451756      case CPUINFO_INT_INPUT_STATE + 1:            info->i = (IOREG(tms, REG_INTPEND) & TMS34010_INT2) ? ASSERT_LINE : CLEAR_LINE; break;
17461757
1747      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */               break;
1758      /* --- the following bits of info are returned as pointers to functions --- */
1759      case CPUINFO_FCT_SET_INFO:      info->setinfo = CPU_SET_INFO_NAME(tms34010);      break;
1760      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(tms34010);            break;
1761      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(tms34010);            break;
1762      case CPUINFO_FCT_EXIT:         info->exit = CPU_EXIT_NAME(tms34010);            break;
1763      case CPUINFO_FCT_EXECUTE:      info->execute = CPU_EXECUTE_NAME(tms34010);         break;
1764      case CPUINFO_FCT_BURN:         info->burn = NULL;                           break;
1765      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(tms34010);   break;
17481766
1749      case CPUINFO_INT_PC:
1750      case CPUINFO_INT_REGISTER + TMS34010_PC:      info->i = tms->pc;                     break;
1751      case CPUINFO_INT_SP:
1752      case CPUINFO_INT_REGISTER + TMS34010_SP:      info->i = SP(tms);                     break;
1753      case CPUINFO_INT_REGISTER + TMS34010_ST:      info->i = tms->st;                     break;
1754      case CPUINFO_INT_REGISTER + TMS34010_A0:      info->i = AREG(tms, 0);                  break;
1755      case CPUINFO_INT_REGISTER + TMS34010_A1:      info->i = AREG(tms, 1);                  break;
1756      case CPUINFO_INT_REGISTER + TMS34010_A2:      info->i = AREG(tms, 2);                  break;
1757      case CPUINFO_INT_REGISTER + TMS34010_A3:      info->i = AREG(tms, 3);                  break;
1758      case CPUINFO_INT_REGISTER + TMS34010_A4:      info->i = AREG(tms, 4);                  break;
1759      case CPUINFO_INT_REGISTER + TMS34010_A5:      info->i = AREG(tms, 5);                  break;
1760      case CPUINFO_INT_REGISTER + TMS34010_A6:      info->i = AREG(tms, 6);                  break;
1761      case CPUINFO_INT_REGISTER + TMS34010_A7:      info->i = AREG(tms, 7);                  break;
1762      case CPUINFO_INT_REGISTER + TMS34010_A8:      info->i = AREG(tms, 8);                  break;
1763      case CPUINFO_INT_REGISTER + TMS34010_A9:      info->i = AREG(tms, 9);                  break;
1764      case CPUINFO_INT_REGISTER + TMS34010_A10:      info->i = AREG(tms, 10);                  break;
1765      case CPUINFO_INT_REGISTER + TMS34010_A11:      info->i = AREG(tms, 11);                  break;
1766      case CPUINFO_INT_REGISTER + TMS34010_A12:      info->i = AREG(tms, 12);                  break;
1767      case CPUINFO_INT_REGISTER + TMS34010_A13:      info->i = AREG(tms, 13);                  break;
1768      case CPUINFO_INT_REGISTER + TMS34010_A14:      info->i = AREG(tms, 14);                  break;
1769      case CPUINFO_INT_REGISTER + TMS34010_B0:      info->i = BREG(tms, 0);                  break;
1770      case CPUINFO_INT_REGISTER + TMS34010_B1:      info->i = BREG(tms, 1);                  break;
1771      case CPUINFO_INT_REGISTER + TMS34010_B2:      info->i = BREG(tms, 2);                  break;
1772      case CPUINFO_INT_REGISTER + TMS34010_B3:      info->i = BREG(tms, 3);                  break;
1773      case CPUINFO_INT_REGISTER + TMS34010_B4:      info->i = BREG(tms, 4);                  break;
1774      case CPUINFO_INT_REGISTER + TMS34010_B5:      info->i = BREG(tms, 5);                  break;
1775      case CPUINFO_INT_REGISTER + TMS34010_B6:      info->i = BREG(tms, 6);                  break;
1776      case CPUINFO_INT_REGISTER + TMS34010_B7:      info->i = BREG(tms, 7);                  break;
1777      case CPUINFO_INT_REGISTER + TMS34010_B8:      info->i = BREG(tms, 8);                  break;
1778      case CPUINFO_INT_REGISTER + TMS34010_B9:      info->i = BREG(tms, 9);                  break;
1779      case CPUINFO_INT_REGISTER + TMS34010_B10:      info->i = BREG(tms, 10);                  break;
1780      case CPUINFO_INT_REGISTER + TMS34010_B11:      info->i = BREG(tms, 11);                  break;
1781      case CPUINFO_INT_REGISTER + TMS34010_B12:      info->i = BREG(tms, 12);                  break;
1782      case CPUINFO_INT_REGISTER + TMS34010_B13:      info->i = BREG(tms, 13);                  break;
1783      case CPUINFO_INT_REGISTER + TMS34010_B14:      info->i = BREG(tms, 14);                  break;
1784
1785      /* --- the following bits of info are returned as pointers to data or functions --- */
1786      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms34010);      break;
1787      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms34010);            break;
1788      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms34010);         break;
1789      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms34010);            break;
1790      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms34010);      break;
1791      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1792      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms34010);      break;
1767      /* --- the following bits of info are returned as pointers --- */
17931768      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &tms->icount;      break;
1769      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &tms->state;   break;
17941770
17951771      /* --- the following bits of info are returned as NULL-terminated strings --- */
1796      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS34010");         break;
1772      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS34010");      break;
17971773      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Texas Instruments 340x0"); break;
1798      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");               break;
1799      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
1774      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");            break;
1775      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);         break;
18001776      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Alex Pasadyn/Zsolt Vasvari\nParts based on code by Aaron Giles"); break;
18011777
18021778      case CPUINFO_STR_FLAGS:
r3957r3958
18201796            tms->st & 0x00000002 ? 'F':'.',
18211797            tms->st & 0x00000001 ? 'F':'.');
18221798         break;
1823
1824      case CPUINFO_STR_REGISTER + TMS34010_PC:      sprintf(info->s, "PC :%08X", tms->pc); break;
1825      case CPUINFO_STR_REGISTER + TMS34010_SP:      sprintf(info->s, "SP :%08X", AREG(tms, 15)); break;
1826      case CPUINFO_STR_REGISTER + TMS34010_ST:      sprintf(info->s, "ST :%08X", tms->st); break;
1827      case CPUINFO_STR_REGISTER + TMS34010_A0:      sprintf(info->s, "A0 :%08X", AREG(tms,  0)); break;
1828      case CPUINFO_STR_REGISTER + TMS34010_A1:      sprintf(info->s, "A1 :%08X", AREG(tms,  1)); break;
1829      case CPUINFO_STR_REGISTER + TMS34010_A2:      sprintf(info->s, "A2 :%08X", AREG(tms,  2)); break;
1830      case CPUINFO_STR_REGISTER + TMS34010_A3:      sprintf(info->s, "A3 :%08X", AREG(tms,  3)); break;
1831      case CPUINFO_STR_REGISTER + TMS34010_A4:      sprintf(info->s, "A4 :%08X", AREG(tms,  4)); break;
1832      case CPUINFO_STR_REGISTER + TMS34010_A5:      sprintf(info->s, "A5 :%08X", AREG(tms,  5)); break;
1833      case CPUINFO_STR_REGISTER + TMS34010_A6:      sprintf(info->s, "A6 :%08X", AREG(tms,  6)); break;
1834      case CPUINFO_STR_REGISTER + TMS34010_A7:      sprintf(info->s, "A7 :%08X", AREG(tms,  7)); break;
1835      case CPUINFO_STR_REGISTER + TMS34010_A8:      sprintf(info->s, "A8 :%08X", AREG(tms,  8)); break;
1836      case CPUINFO_STR_REGISTER + TMS34010_A9:      sprintf(info->s, "A9 :%08X", AREG(tms,  9)); break;
1837      case CPUINFO_STR_REGISTER + TMS34010_A10:      sprintf(info->s,"A10:%08X", AREG(tms, 10)); break;
1838      case CPUINFO_STR_REGISTER + TMS34010_A11:      sprintf(info->s,"A11:%08X", AREG(tms, 11)); break;
1839      case CPUINFO_STR_REGISTER + TMS34010_A12:      sprintf(info->s,"A12:%08X", AREG(tms, 12)); break;
1840      case CPUINFO_STR_REGISTER + TMS34010_A13:      sprintf(info->s,"A13:%08X", AREG(tms, 13)); break;
1841      case CPUINFO_STR_REGISTER + TMS34010_A14:      sprintf(info->s,"A14:%08X", AREG(tms, 14)); break;
1842      case CPUINFO_STR_REGISTER + TMS34010_B0:      sprintf(info->s, "B0 :%08X", BREG(tms,  0)); break;
1843      case CPUINFO_STR_REGISTER + TMS34010_B1:      sprintf(info->s, "B1 :%08X", BREG(tms,  1)); break;
1844      case CPUINFO_STR_REGISTER + TMS34010_B2:      sprintf(info->s, "B2 :%08X", BREG(tms,  2)); break;
1845      case CPUINFO_STR_REGISTER + TMS34010_B3:      sprintf(info->s, "B3 :%08X", BREG(tms,  3)); break;
1846      case CPUINFO_STR_REGISTER + TMS34010_B4:      sprintf(info->s, "B4 :%08X", BREG(tms,  4)); break;
1847      case CPUINFO_STR_REGISTER + TMS34010_B5:      sprintf(info->s, "B5 :%08X", BREG(tms,  5)); break;
1848      case CPUINFO_STR_REGISTER + TMS34010_B6:      sprintf(info->s, "B6 :%08X", BREG(tms,  6)); break;
1849      case CPUINFO_STR_REGISTER + TMS34010_B7:      sprintf(info->s, "B7 :%08X", BREG(tms,  7)); break;
1850      case CPUINFO_STR_REGISTER + TMS34010_B8:      sprintf(info->s, "B8 :%08X", BREG(tms,  8)); break;
1851      case CPUINFO_STR_REGISTER + TMS34010_B9:      sprintf(info->s, "B9 :%08X", BREG(tms,  9)); break;
1852      case CPUINFO_STR_REGISTER + TMS34010_B10:      sprintf(info->s,"B10:%08X", BREG(tms, 10)); break;
1853      case CPUINFO_STR_REGISTER + TMS34010_B11:      sprintf(info->s,"B11:%08X", BREG(tms, 11)); break;
1854      case CPUINFO_STR_REGISTER + TMS34010_B12:      sprintf(info->s,"B12:%08X", BREG(tms, 12)); break;
1855      case CPUINFO_STR_REGISTER + TMS34010_B13:      sprintf(info->s,"B13:%08X", BREG(tms, 13)); break;
1856      case CPUINFO_STR_REGISTER + TMS34010_B14:      sprintf(info->s,"B14:%08X", BREG(tms, 14)); break;
18571799   }
18581800}
18591801
r3957r3958
18671809   switch (state)
18681810   {
18691811      /* --- the following bits of info are returned as 64-bit signed integers --- */
1870      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(tms34010_state);      break;
1871      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
1872      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
1812      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                  break;
18731813
18741814      /* --- the following bits of info are returned as pointers to data or functions --- */
1875      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms34020);         break;
1876      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms34020);      break;
1815      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(tms34020);            break;
1816      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(tms34020);   break;
18771817
18781818      /* --- the following bits of info are returned as NULL-terminated strings --- */
1879      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS34020");         break;
1819      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS34020");      break;
18801820
18811821      default:                              CPU_GET_INFO_CALL(tms34010);      break;
18821822   }
src/emu/cpu/tms32031/tms32031.h
r3957r3958
7777extern CPU_GET_INFO( tms32031 );
7878extern CPU_GET_INFO( tms32032 );
7979
80#define CPU_TMS32031 CPU_GET_INFO_NAME( tms32031 )
81#define CPU_TMS32032 CPU_GET_INFO_NAME( tms32032 )
82
8083extern float convert_tms3203x_fp_to_float(UINT32 floatdata);
8184extern double convert_tms3203x_fp_to_double(UINT32 floatdata);
8285extern UINT32 convert_float_to_tms3203x_fp(float fval);
src/emu/cpu/tms32031/tms32031.c
r3957r3958
708708      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
709709      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
710710
711      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
712      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
713      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;               break;
714      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
715      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
716      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
717      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
718      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
719      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
711      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
712      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
713      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -2;               break;
714      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
715      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
716      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
717      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
718      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
719      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
720720
721721      case CPUINFO_INT_INPUT_STATE + TMS32031_IRQ0:   info->i = (IREG(tms, TMR_IF) & (1 << TMS32031_IRQ0)) ? ASSERT_LINE : CLEAR_LINE; break;
722722      case CPUINFO_INT_INPUT_STATE + TMS32031_IRQ1:   info->i = (IREG(tms, TMR_IF) & (1 << TMS32031_IRQ1)) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
775775      case CPUINFO_INT_REGISTER + TMS32031_RC:      info->i = IREG(tms, TMR_RC);               break;
776776
777777      /* --- the following bits of info are returned as pointers to data or functions --- */
778      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32031);      break;
779      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms32031);            break;
780      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms32031);         break;
781      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms32031);            break;
782      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32031);      break;
783      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
784      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32031);      break;
778      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32031);      break;
779      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tms32031);            break;
780      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms32031);         break;
781      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(tms32031);            break;
782      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32031);      break;
783      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
784      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32031);      break;
785785      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &tms->icount;      break;
786      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_32031); break;
786      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_32031); break;
787787
788788      /* --- the following bits of info are returned as NULL-terminated strings --- */
789789      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS32031");         break;
r3957r3958
853853   switch (state)
854854   {
855855      /* --- the following bits of info are returned as pointers to data or functions --- */
856      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms32032);         break;
857      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_32032); break;
856      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms32032);         break;
857      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_32032); break;
858858
859859      /* --- the following bits of info are returned as NULL-terminated strings --- */
860860      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS32032");         break;
src/emu/cpu/mcs48/mcs48.c
r3957r3958
693693    mcs48_init - generic MCS-48 initialization
694694-------------------------------------------------*/
695695
696static void mcs48_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, UINT16 romsize)
696static void mcs48_init(const device_config *device, cpu_irq_callback irqcallback, UINT16 romsize)
697697{
698698   mcs48_state *cpustate = device->token;
699699
r3957r3958
747747#if (HAS_I8035 || HAS_MB8884)
748748static CPU_INIT( i8035 )
749749{
750   mcs48_init(device, index, clock, irqcallback, 0x0);
750   mcs48_init(device, irqcallback, 0x0);
751751}
752752#endif
753753
r3957r3958
761761#if (HAS_I8048 || HAS_I8648 || HAS_I8748 || HAS_N7751)
762762static CPU_INIT( i8048 )
763763{
764   mcs48_init(device, index, clock, irqcallback, 0x400);
764   mcs48_init(device, irqcallback, 0x400);
765765}
766766#endif
767767
r3957r3958
775775#if (HAS_I8039)
776776static CPU_INIT( i8039 )
777777{
778   mcs48_init(device, index, clock, irqcallback, 0x0);
778   mcs48_init(device, irqcallback, 0x0);
779779}
780780#endif
781781
r3957r3958
789789#if (HAS_I8049 || HAS_I8749 || HAS_M58715)
790790static CPU_INIT( i8049 )
791791{
792   mcs48_init(device, index, clock, irqcallback, 0x800);
792   mcs48_init(device, irqcallback, 0x800);
793793}
794794#endif
795795
r3957r3958
10431043      case CPUINFO_INT_MIN_CYCLES:                     info->i = 1;                     break;
10441044      case CPUINFO_INT_MAX_CYCLES:                     info->i = 3;                     break;
10451045
1046      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                     break;
1047      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 12;                     break;
1048      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                     break;
1049      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;                     break;
1050      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    /*info->i = 6 or 7;*/               break;
1051      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                     break;
1052      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;                     break;
1053      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;                     break;
1054      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;                     break;
1046      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;                     break;
1047      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 12;                     break;
1048      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                     break;
1049      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;                     break;
1050      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    /*info->i = 6 or 7;*/               break;
1051      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                     break;
1052      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;                     break;
1053      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;                     break;
1054      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;                     break;
10551055
10561056      case CPUINFO_INT_INPUT_STATE + MCS48_INPUT_IRQ:         info->i = cpustate->irq_state ? ASSERT_LINE : CLEAR_LINE; break;
10571057      case CPUINFO_INT_INPUT_STATE + MCS48_INPUT_EA:         info->i = cpustate->ea;                  break;
r3957r3958
10761076      case CPUINFO_INT_REGISTER + MCS48_EA:               info->i = cpustate->ea;                  break;
10771077
10781078      /* --- the following bits of info are returned as pointers to data or functions --- */
1079      case CPUINFO_PTR_SET_INFO:                        info->setinfo = CPU_SET_INFO_NAME(mcs48);         break;
1080      case CPUINFO_PTR_INIT:                           /*info->init = CPU_INIT_NAME(i8039);*/         break;
1081      case CPUINFO_PTR_RESET:                           info->reset = CPU_RESET_NAME(mcs48);            break;
1082      case CPUINFO_PTR_EXECUTE:                        info->execute = CPU_EXECUTE_NAME(mcs48);         break;
1083      case CPUINFO_PTR_BURN:                           info->burn = NULL;                  break;
1084      case CPUINFO_PTR_DISASSEMBLE:                     info->disassemble = CPU_DISASSEMBLE_NAME(mcs48);         break;
1079      case CPUINFO_FCT_SET_INFO:                        info->setinfo = CPU_SET_INFO_NAME(mcs48);         break;
1080      case CPUINFO_FCT_INIT:                           /*info->init = CPU_INIT_NAME(i8039);*/         break;
1081      case CPUINFO_FCT_RESET:                           info->reset = CPU_RESET_NAME(mcs48);            break;
1082      case CPUINFO_FCT_EXECUTE:                        info->execute = CPU_EXECUTE_NAME(mcs48);         break;
1083      case CPUINFO_FCT_BURN:                           info->burn = NULL;                  break;
1084      case CPUINFO_FCT_DISASSEMBLE:                     info->disassemble = CPU_DISASSEMBLE_NAME(mcs48);         break;
10851085      case CPUINFO_PTR_INSTRUCTION_COUNTER:               info->icount = &cpustate->icount;         break;
10861086
1087      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: /*info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);*/ break;
1088      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    /*info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);*/ break;
1087      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: /*info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);*/ break;
1088      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    /*info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);*/ break;
10891089
10901090      /* --- the following bits of info are returned as NULL-terminated strings --- */
10911091      case CPUINFO_STR_NAME:                           /*strcpy(info->s, "I8039");*/         break;
r3957r3958
11371137{
11381138   switch (state)
11391139   {
1140      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1141      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1142      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8035);                     break;
1140      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1141      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1142      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8035);                     break;
11431143      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8035");                     break;
11441144      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
11451145   }
r3957r3958
11511151{
11521152   switch (state)
11531153   {
1154      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1155      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1156      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1157      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
1154      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1155      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1156      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1157      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
11581158      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8048");                     break;
11591159      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
11601160   }
r3957r3958
11661166{
11671167   switch (state)
11681168   {
1169      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1170      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1171      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1172      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
1169      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1170      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1171      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1172      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
11731173      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8648");                     break;
11741174      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
11751175   }
r3957r3958
11811181{
11821182   switch (state)
11831183   {
1184      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1185      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1186      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1187      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
1184      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1185      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1186      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1187      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
11881188      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8748");                     break;
11891189      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
11901190   }
r3957r3958
11961196{
11971197   switch (state)
11981198   {
1199      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1200      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1201      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8035);                     break;
1199      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1200      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1201      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8035);                     break;
12021202      case CPUINFO_STR_NAME:                                 strcpy(info->s, "MB8884");                     break;
12031203      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12041204   }
r3957r3958
12101210{
12111211   switch (state)
12121212   {
1213      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 6;                              break;
1214      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1215      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1216      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
1213      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 6;                              break;
1214      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1215      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_6bit);      break;
1216      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8048);                     break;
12171217      case CPUINFO_STR_NAME:                                 strcpy(info->s, "N7751");                     break;
12181218      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12191219   }
r3957r3958
12271227{
12281228   switch (state)
12291229   {
1230      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 7;                              break;
1231      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1232      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8039);                     break;
1230      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 7;                              break;
1231      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1232      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8039);                     break;
12331233      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8039");                     break;
12341234      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12351235   }
r3957r3958
12411241{
12421242   switch (state)
12431243   {
1244      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 7;                              break;
1245      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1246      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1247      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
1244      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 7;                              break;
1245      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1246      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1247      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
12481248      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8049");                     break;
12491249      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12501250   }
r3957r3958
12561256{
12571257   switch (state)
12581258   {
1259      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 7;                              break;
1260      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1261      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1262      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
1259      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 7;                              break;
1260      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1261      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1262      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
12631263      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8749");                     break;
12641264      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12651265   }
r3957r3958
12711271{
12721272   switch (state)
12731273   {
1274      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:          info->i = 7;                              break;
1275      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1276      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1277      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
1274      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 7;                              break;
1275      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1276      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1277      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8049);                     break;
12781278      case CPUINFO_STR_NAME:                                 strcpy(info->s, "M58715");                     break;
12791279      default:                                          CPU_GET_INFO_CALL(mcs48);                     break;
12801280   }
src/emu/cpu/mcs48/mcs48.h
r3957r3958
7979CPU_GET_INFO( mb8884 );
8080CPU_GET_INFO( n7751 );
8181
82#define CPU_I8035 CPU_GET_INFO_NAME( i8035 )
83#define CPU_I8048 CPU_GET_INFO_NAME( i8048 )
84#define CPU_I8648 CPU_GET_INFO_NAME( i8648 )
85#define CPU_I8748 CPU_GET_INFO_NAME( i8748 )
86#define CPU_MB8884 CPU_GET_INFO_NAME( mb8884 )
87#define CPU_N7751 CPU_GET_INFO_NAME( n7751 )
88
8289/* variants with 128 bytes of internal RAM and up to 2k of internal ROM */
8390CPU_GET_INFO( i8039 );
8491CPU_GET_INFO( i8049 );
8592CPU_GET_INFO( i8749 );
8693CPU_GET_INFO( m58715 );
8794
95#define CPU_I8039 CPU_GET_INFO_NAME( i8039 )
96#define CPU_I8049 CPU_GET_INFO_NAME( i8049 )
97#define CPU_I8749 CPU_GET_INFO_NAME( i8749 )
98#define CPU_M58715 CPU_GET_INFO_NAME( m58715 )
99
88100/* disassembler */
89101CPU_DISASSEMBLE( mcs48 );
90102
src/emu/cpu/m37710/m37710.c
r3957r3958
10761076      case CPUINFO_INT_MAX_CYCLES:               info->i = 20; /* rough guess */         break;
10771077      case CPUINFO_INT_INPUT_LINES:                 info->i = M37710_LINE_MAX;            break;
10781078
1079      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
1080      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
1081      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1082      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1083      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1084      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1085      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1086      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
1087      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1079      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
1080      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
1081      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1082      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1083      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1084      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1085      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1086      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
1087      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
10881088
10891089      case CPUINFO_INT_INPUT_STATE + M37710_LINE_IRQ0:    info->i = 0;                  break;
10901090      case CPUINFO_INT_INPUT_STATE + M37710_LINE_IRQ1:    info->i = 0;                  break;
r3957r3958
11101110      case CPUINFO_INT_REGISTER + M37710_IRQ_STATE:   info->i = m37710_get_reg(cpustate, M37710_IRQ_STATE); break;
11111111
11121112      /* --- the following bits of info are returned as pointers to data or functions --- */
1113      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m37710);      break;
1114      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m37710);            break;
1115      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m37710);            break;
1116      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m37710);            break;
1117      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m37710);         break;
1118      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1119      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m37710);      break;
1113      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m37710);      break;
1114      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m37710);            break;
1115      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m37710);            break;
1116      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m37710);            break;
1117      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m37710);         break;
1118      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1119      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m37710);      break;
11201120      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->ICount;         break;
11211121
1122      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(m37710_internal_map); break;
1123      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map16 = NULL;   break;
1124      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map8 = NULL;   break;
1122      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(m37710_internal_map); break;
1123      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map16 = NULL;   break;
1124      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map8 = NULL;   break;
11251125
11261126      /* --- the following bits of info are returned as NULL-terminated strings --- */
11271127      case CPUINFO_STR_NAME:                     strcpy(info->s, "M37710");            break;
src/emu/cpu/m37710/m37710op.h
r3957r3958
29032903      case M37710_D: return REG_D;
29042904      case M37710_P: return m37710i_get_reg_p(cpustate);
29052905      case M37710_IRQ_STATE: return LINE_IRQ;
2906      case REG_PREVIOUSPC: return REG_PPC;
2906      case REG_GENPCBASE: return REG_PPC;
29072907   }
29082908   return 0;
29092909}
src/emu/cpu/m37710/m37710.h
r3957r3958
8585   M37710_SER0_XMIT, M37710_SER1_REC, M37710_SER1_XMIT
8686};
8787
88/* ======================================================================== */
89/* ================================= MAME ================================= */
90/* ======================================================================== */
91
92/* Clean up after the emulation core - Not used in this core - */
93CPU_EXIT( m37710 );
94
95/* Save the current CPU state to disk */
96void m37710_state_save(void *file);
97
98/* Load a CPU state from disk */
99void m37710_state_load(void *file);
100
101#undef M37710_CALL_DEBUGGER
102
103#define M37710_CALL_DEBUGGER(x)       debugger_instruction_hook(cpustate->device, x)
104#define m37710_read_8(addr)          memory_read_byte_16le(cpustate->program, addr)
105#define m37710_write_8(addr,data)      memory_write_byte_16le(cpustate->program, addr,data)
106#define m37710_read_8_immediate(A)      memory_read_byte_16le(cpustate->program, A)
107#define m37710_read_16(addr)          memory_read_word_16le(cpustate->program, addr)
108#define m37710_write_16(addr,data)      memory_write_word_16le(cpustate->program, addr,data)
109#define m37710_jumping(A)
110#define m37710_branching(A)
111
112
11388CPU_GET_INFO( m37710 );
89CPU_GET_INFO( m37702 );
11490
91#define CPU_M37710 CPU_GET_INFO_NAME( m37710 )
92#define CPU_M37702 CPU_GET_INFO_NAME( m37702 )
93
11594/* ======================================================================== */
11695/* ============================== END OF FILE ============================= */
11796/* ======================================================================== */
src/emu/cpu/m37710/m37710cm.h
r3957r3958
1818
1919
2020/* ======================================================================== */
21/* ================================= MAME ================================= */
22/* ======================================================================== */
23
24/* Clean up after the emulation core - Not used in this core - */
25CPU_EXIT( m37710 );
26
27/* Save the current CPU state to disk */
28void m37710_state_save(void *file);
29
30/* Load a CPU state from disk */
31void m37710_state_load(void *file);
32
33#undef M37710_CALL_DEBUGGER
34
35#define M37710_CALL_DEBUGGER(x)       debugger_instruction_hook(cpustate->device, x)
36#define m37710_read_8(addr)          memory_read_byte_16le(cpustate->program, addr)
37#define m37710_write_8(addr,data)      memory_write_byte_16le(cpustate->program, addr,data)
38#define m37710_read_8_immediate(A)      memory_read_byte_16le(cpustate->program, A)
39#define m37710_read_16(addr)          memory_read_word_16le(cpustate->program, addr)
40#define m37710_write_16(addr,data)      memory_write_word_16le(cpustate->program, addr,data)
41#define m37710_jumping(A)
42#define m37710_branching(A)
43
44
45/* ======================================================================== */
2146/* ================================ GENERAL =============================== */
2247/* ======================================================================== */
2348
src/emu/cpu/cpu.mak
r3957r3958
142142# Analog Devices ADSP21xx series
143143#-------------------------------------------------
144144
145CPUDEFS += -DHAS_ADSP2100=$(if $(filter ADSP2100,$(CPUS)),1,0)
146CPUDEFS += -DHAS_ADSP2101=$(if $(filter ADSP2101,$(CPUS)),1,0)
147CPUDEFS += -DHAS_ADSP2104=$(if $(filter ADSP2104,$(CPUS)),1,0)
148CPUDEFS += -DHAS_ADSP2105=$(if $(filter ADSP2105,$(CPUS)),1,0)
149CPUDEFS += -DHAS_ADSP2115=$(if $(filter ADSP2115,$(CPUS)),1,0)
150CPUDEFS += -DHAS_ADSP2181=$(if $(filter ADSP2181,$(CPUS)),1,0)
145CPUDEFS += -DHAS_ADSP21XX=$(if $(filter ADSP21XX,$(CPUS)),1,0)
151146
152ifneq ($(filter ADSP2100 ADSP2101 ADSP2104 ADSP2105 ADSP2115 ADSP2181,$(CPUS)),)
147ifneq ($(filter ADSP21XX,$(CPUS)),)
153148OBJDIRS += $(CPUOBJ)/adsp2100
154149CPUOBJS += $(CPUOBJ)/adsp2100/adsp2100.o
155150DBGOBJS += $(CPUOBJ)/adsp2100/2100dasm.o
r3957r3958
627622# Intel 8080/8085A
628623#-------------------------------------------------
629624
630CPUDEFS += -DHAS_8080=$(if $(filter 8080,$(CPUS)),1,0)
631CPUDEFS += -DHAS_8085A=$(if $(filter 8085A,$(CPUS)),1,0)
625CPUDEFS += -DHAS_I8085=$(if $(filter I8085,$(CPUS)),1,0)
632626
633ifneq ($(filter 8080 8085A,$(CPUS)),)
627ifneq ($(filter I8085,$(CPUS)),)
634628OBJDIRS += $(CPUOBJ)/i8085
635629CPUOBJS += $(CPUOBJ)/i8085/i8085.o
636630DBGOBJS += $(CPUOBJ)/i8085/8085dasm.o
r3957r3958
755749endif
756750
757751I86DEPS = \
758   $(CPUSRC)/i86/i86.h \
752   $(CPUSRC)/i86/i86priv.h \
759753   $(CPUSRC)/i86/ea.h \
760754   $(CPUSRC)/i86/host.h \
761755   $(CPUSRC)/i86/modrm.h
762756
763757$(CPUOBJ)/i86/i86.o:   $(CPUSRC)/i86/i86.c \
758                  $(CPUSRC)/i86/i86.h \
764759                  $(CPUSRC)/i86/instr86.c \
765760                  $(CPUSRC)/i86/instr186.c \
766                  $(CPUSRC)/i86/i86intf.h \
767                  $(CPUSRC)/i86/i186intf.h \
768761                  $(I86DEPS)
769762
770$(CPUOBJ)/i86/i286.o:   $(CPUSRC)/i86/i86.c \
763$(CPUOBJ)/i86/i286.o:   $(CPUSRC)/i86/i286.c \
764                  $(CPUSRC)/i86/i286.h \
771765                  $(CPUSRC)/i86/instr286.c \
772                  $(CPUSRC)/i86/i286intf.h \
773766                  $(I86DEPS)
774767
775768$(CPUOBJ)/i386/i386.o:   $(CPUSRC)/i386/i386.c \
776769                  $(CPUSRC)/i386/i386.h \
777                  $(CPUSRC)/i386/i386intf.h \
770                  $(CPUSRC)/i386/i386priv.h \
778771                  $(CPUSRC)/i386/i386op16.c \
779772                  $(CPUSRC)/i386/i386op32.c \
780773                  $(CPUSRC)/i386/i386ops.c \
r3957r3958
12741267
12751268$(CPUOBJ)/nec/nec.o:   $(CPUSRC)/nec/nec.c \
12761269                  $(CPUSRC)/nec/nec.h \
1277                  $(CPUSRC)/nec/necintrf.h \
12781270                  $(CPUSRC)/nec/necea.h \
12791271                  $(CPUSRC)/nec/nechost.h \
12801272                  $(CPUSRC)/nec/necinstr.h \
1281                  $(CPUSRC)/nec/necmodrm.h
1273                  $(CPUSRC)/nec/necmodrm.h \
1274                  $(CPUSRC)/nec/necpriv.h
12821275
12831276$(CPUOBJ)/v30mz/v30mz.o:   $(CPUSRC)/v30mz/v30mz.c \
12841277                     $(CPUSRC)/v30mz/v30mz.h \
r3957r3958
12861279                     $(CPUSRC)/v30mz/necinstr.h \
12871280                     $(CPUSRC)/v30mz/necea.h \
12881281                     $(CPUSRC)/v30mz/nechost.h \
1289                     $(CPUSRC)/v30mz/necintrf.h
1282                     $(CPUSRC)/v30mz/nec.h
12901283
12911284
12921285
src/emu/cpu/sharc/sharc.c
r3957r3958
10811081      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
10821082      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
10831083
1084      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
1085      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
1086      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -3;               break;
1087      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 32;               break;
1088      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 32;               break;
1089      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -2;               break;
1090      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1091      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1092      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1084      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
1085      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
1086      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -3;               break;
1087      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 32;               break;
1088      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 32;               break;
1089      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -2;               break;
1090      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1091      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1092      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
10931093
10941094      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
10951095
r3957r3958
11971197      case CPUINFO_INT_REGISTER + SHARC_B15:         info->i = cpustate->dag2.b[7];            break;
11981198
11991199      /* --- the following bits of info are returned as pointers to data or functions --- */
1200      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(sharc);      break;
1201      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(sharc);   break;
1202      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(sharc);      break;
1203      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sharc);break;
1204      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1205      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sharc);         break;
1200      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(sharc);      break;
1201      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(sharc);   break;
1202      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(sharc);      break;
1203      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sharc);break;
1204      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1205      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sharc);         break;
12061206      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
1207      case CPUINFO_PTR_READ:                     info->read = CPU_READ_NAME(sharc);      break;
1208      case CPUINFO_PTR_READOP:                  info->readop = CPU_READOP_NAME(sharc);   break;
1209      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map64 = ADDRESS_MAP_NAME(internal_pgm); break;
1207      case CPUINFO_FCT_READ:                     info->read = CPU_READ_NAME(sharc);      break;
1208      case CPUINFO_FCT_READOP:                  info->readop = CPU_READOP_NAME(sharc);   break;
1209      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map64 = ADDRESS_MAP_NAME(internal_pgm); break;
12101210
12111211      /* --- the following bits of info are returned as NULL-terminated strings --- */
12121212      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "SHARC");            break;
r3957r3958
13241324   switch(state)
13251325   {
13261326      /* --- the following bits of info are returned as pointers to data or functions --- */
1327      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp21062);      break;
1327      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp21062);      break;
13281328
13291329      /* --- the following bits of info are returned as NULL-terminated strings --- */
13301330      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP21062");         break;
src/emu/cpu/sharc/sharc.h
r3957r3958
2929
3030#if (HAS_ADSP21062)
3131CPU_GET_INFO( adsp21062 );
32#define CPU_ADSP21062 CPU_GET_INFO_NAME( adsp21062 )
3233#endif
3334
3435extern UINT32 sharc_dasm_one(char *buffer, offs_t pc, UINT64 opcode);
src/emu/cpu/z180/z180.c
r3957r3958
118118   const device_config *device;
119119   const address_space *program;
120120   const address_space *iospace;
121   cpu_state_table state;
122   UINT8   rtemp;
123   UINT32   ioltemp;
121124   int icount;
122125};
123126
r3957r3958
758761#define Z180_IOCR_RMASK       0xff
759762#define Z180_IOCR_WMASK       0xff
760763
764
765/***************************************************************************
766    CPU STATE DESCRIPTION
767***************************************************************************/
768
769#define Z180_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
770   CPU_STATE_ENTRY(Z180_##_name, #_name, _format, z180_state, _member, _datamask, ~0, _flags)
771
772#define Z180_STATE_IO_ENTRY(_name, _flags) \
773   CPU_STATE_ENTRY(Z180_##_name, #_name, "%02X", z180_state, IO_##_name, 0xff, ~0, _flags)
774
775
776static const cpu_state_entry state_array[] =
777{
778   Z180_STATE_ENTRY(PC,  "%04X", PC.w.l, 0xffff, 0)
779   Z180_STATE_ENTRY(GENPC, "%04X", _PCD, 0xffff, CPUSTATE_NOSHOW)
780   Z180_STATE_ENTRY(GENPCBASE, "%04X", PREPC.w.l, 0xffff, CPUSTATE_NOSHOW)
781
782   Z180_STATE_ENTRY(SP,  "%04X", _SPD, 0xffff, 0)
783   Z180_STATE_ENTRY(GENSP, "%04X", SP.w.l, 0xffff, CPUSTATE_NOSHOW)
784
785   Z180_STATE_ENTRY(A, "%02X", _A, 0xff, CPUSTATE_NOSHOW)
786   Z180_STATE_ENTRY(B, "%02X", _B, 0xff, CPUSTATE_NOSHOW)
787   Z180_STATE_ENTRY(C, "%02X", _C, 0xff, CPUSTATE_NOSHOW)
788   Z180_STATE_ENTRY(D, "%02X", _D, 0xff, CPUSTATE_NOSHOW)
789   Z180_STATE_ENTRY(E, "%02X", _E, 0xff, CPUSTATE_NOSHOW)
790   Z180_STATE_ENTRY(H, "%02X", _H, 0xff, CPUSTATE_NOSHOW)
791   Z180_STATE_ENTRY(L, "%02X", _L, 0xff, CPUSTATE_NOSHOW)
792
793   Z180_STATE_ENTRY(AF, "%04X", AF.w.l, 0xffff, 0)
794   Z180_STATE_ENTRY(BC, "%04X", BC.w.l, 0xffff, 0)
795   Z180_STATE_ENTRY(DE, "%04X", DE.w.l, 0xffff, 0)
796   Z180_STATE_ENTRY(HL, "%04X", HL.w.l, 0xffff, 0)
797   Z180_STATE_ENTRY(IX, "%04X", IX.w.l, 0xffff, 0)
798   Z180_STATE_ENTRY(IY, "%04X", IY.w.l, 0xffff, 0)
799
800   Z180_STATE_ENTRY(AF2, "%04X", AF2.w.l, 0xffff, 0)
801   Z180_STATE_ENTRY(BC2, "%04X", BC2.w.l, 0xffff, 0)
802   Z180_STATE_ENTRY(DE2, "%04X", DE2.w.l, 0xffff, 0)
803   Z180_STATE_ENTRY(HL2, "%04X", HL2.w.l, 0xffff, 0)
804
805   Z180_STATE_ENTRY(R,      "%02X", rtemp, 0xff, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
806   Z180_STATE_ENTRY(I,      "%02X", I, 0xff, 0)
807   Z180_STATE_ENTRY(IM,     "%1u", IM, 0x3, 0)
808   Z180_STATE_ENTRY(IFF1,   "%1u", IFF1, 0x1, 0)
809   Z180_STATE_ENTRY(IFF2,   "%1u", IFF2, 0x1, 0)
810   Z180_STATE_ENTRY(HALT,   "%1u", HALT, 0x1, 0)
811
812   Z180_STATE_ENTRY(IOLINES, "%06X", ioltemp, 0xffffff, CPUSTATE_IMPORT)
813
814   Z180_STATE_IO_ENTRY(CNTLA0, 0)
815   Z180_STATE_IO_ENTRY(CNTLA1, 0)
816   Z180_STATE_IO_ENTRY(CNTLB0, 0)
817   Z180_STATE_IO_ENTRY(CNTLB1, 0)
818   Z180_STATE_IO_ENTRY(STAT0, 0)
819   Z180_STATE_IO_ENTRY(STAT1, 0)
820   Z180_STATE_IO_ENTRY(TDR0, 0)
821   Z180_STATE_IO_ENTRY(TDR1, 0)
822   Z180_STATE_IO_ENTRY(RDR0, 0)
823   Z180_STATE_IO_ENTRY(RDR1, 0)
824   Z180_STATE_IO_ENTRY(CNTR, 0)
825   Z180_STATE_IO_ENTRY(TRDR, 0)
826   Z180_STATE_IO_ENTRY(TMDR0L, 0)
827   Z180_STATE_IO_ENTRY(TMDR0H, 0)
828   Z180_STATE_IO_ENTRY(RLDR0L, 0)
829   Z180_STATE_IO_ENTRY(RLDR0H, 0)
830   Z180_STATE_IO_ENTRY(TCR, 0)
831   Z180_STATE_IO_ENTRY(IO11, 0)
832   Z180_STATE_IO_ENTRY(ASEXT0, 0)
833   Z180_STATE_IO_ENTRY(ASEXT1, 0)
834   Z180_STATE_IO_ENTRY(TMDR1L, 0)
835   Z180_STATE_IO_ENTRY(TMDR1H, 0)
836   Z180_STATE_IO_ENTRY(RLDR1L, 0)
837   Z180_STATE_IO_ENTRY(RLDR1H, 0)
838   Z180_STATE_IO_ENTRY(FRC, 0)
839   Z180_STATE_IO_ENTRY(IO19, 0)
840   Z180_STATE_IO_ENTRY(ASTC0L, 0)
841   Z180_STATE_IO_ENTRY(ASTC0H, 0)
842   Z180_STATE_IO_ENTRY(ASTC1L, 0)
843   Z180_STATE_IO_ENTRY(ASTC1H, 0)
844   Z180_STATE_IO_ENTRY(CMR, 0)
845   Z180_STATE_IO_ENTRY(CCR, 0)
846   Z180_STATE_IO_ENTRY(SAR0L, 0)
847   Z180_STATE_IO_ENTRY(SAR0H, 0)
848   Z180_STATE_IO_ENTRY(SAR0B, 0)
849   Z180_STATE_IO_ENTRY(DAR0L, 0)
850   Z180_STATE_IO_ENTRY(DAR0H, 0)
851   Z180_STATE_IO_ENTRY(DAR0B, 0)
852   Z180_STATE_IO_ENTRY(BCR0L, 0)
853   Z180_STATE_IO_ENTRY(BCR0H, 0)
854   Z180_STATE_IO_ENTRY(MAR1L, 0)
855   Z180_STATE_IO_ENTRY(MAR1H, 0)
856   Z180_STATE_IO_ENTRY(MAR1B, 0)
857   Z180_STATE_IO_ENTRY(IAR1L, 0)
858   Z180_STATE_IO_ENTRY(IAR1H, 0)
859   Z180_STATE_IO_ENTRY(IAR1B, 0)
860   Z180_STATE_IO_ENTRY(BCR1L, 0)
861   Z180_STATE_IO_ENTRY(BCR1H, 0)
862   Z180_STATE_IO_ENTRY(DSTAT, 0)
863   Z180_STATE_IO_ENTRY(DMODE, 0)
864   Z180_STATE_IO_ENTRY(DCNTL, 0)
865   Z180_STATE_IO_ENTRY(IL, 0)
866   Z180_STATE_IO_ENTRY(ITC, 0)
867   Z180_STATE_IO_ENTRY(IO35, 0)
868   Z180_STATE_IO_ENTRY(RCR, 0)
869   Z180_STATE_IO_ENTRY(IO37, 0)
870   Z180_STATE_IO_ENTRY(CBR, CPUSTATE_IMPORT)
871   Z180_STATE_IO_ENTRY(BBR, CPUSTATE_IMPORT)
872   Z180_STATE_IO_ENTRY(CBAR, CPUSTATE_IMPORT)
873   Z180_STATE_IO_ENTRY(IO3B, 0)
874   Z180_STATE_IO_ENTRY(IO3C, 0)
875   Z180_STATE_IO_ENTRY(IO3D, 0)
876   Z180_STATE_IO_ENTRY(OMCR, 0)
877   Z180_STATE_IO_ENTRY(IOCR, 0)
878};
879
880static const cpu_state_table state_table_template =
881{
882   NULL,                  /* pointer to the base of state (offsets are relative to this) */
883   0,                     /* subtype this table refers to */
884   ARRAY_LENGTH(state_array),   /* number of entries */
885   state_array               /* array of entries */
886};
887
888
889
761890static UINT8 SZ[256];      /* zero and sign flags */
762891static UINT8 SZ_BIT[256];   /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
763892static UINT8 SZP[256];      /* zero, sign and parity flags */
r3957r3958
18842013   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
18852014   cpustate->iospace = memory_find_address_space(device, ADDRESS_SPACE_IO);
18862015
2016   /* set up the state table */
2017   cpustate->state = state_table_template;
2018   cpustate->state.baseptr = cpustate;
2019   cpustate->state.subtypemask = 1;
2020
18872021   state_save_register_device_item(device, 0, cpustate->AF.w.l);
18882022   state_save_register_device_item(device, 0, cpustate->BC.w.l);
18892023   state_save_register_device_item(device, 0, cpustate->DE.w.l);
r3957r3958
19192053   z180_state *cpustate = device->token;
19202054   z80_daisy_state *save_daisy;
19212055   cpu_irq_callback save_irqcallback;
2056   cpu_state_table save_table;
19222057   int i, p;
19232058   int oldval, newval, val;
19242059   UINT8 *padd, *padc, *psub, *psbc;
r3957r3958
19972132
19982133   save_daisy = cpustate->daisy;
19992134   save_irqcallback = cpustate->irq_callback;
2135   save_table = cpustate->state;
20002136   memset(cpustate, 0, sizeof(*cpustate));
20012137   cpustate->daisy = save_daisy;
20022138   cpustate->irq_callback = save_irqcallback;
2139   cpustate->state = save_table;
20032140   cpustate->device = device;
20042141   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
20052142   cpustate->iospace = memory_find_address_space(device, ADDRESS_SPACE_IO);
r3957r3958
23032440   return TRUE;
23042441}
23052442
2443
23062444/**************************************************************************
2445 * STATE IMPORT/EXPORT
2446 **************************************************************************/
2447
2448static CPU_IMPORT_STATE( z180 )
2449{
2450   z180_state *cpustate = device->token;
2451
2452   switch (entry->index)
2453   {
2454      case Z180_R:
2455         cpustate->R = cpustate->rtemp & 0x7f;
2456         cpustate->R2 = cpustate->rtemp & 0x80;
2457         break;
2458
2459      case Z180_CBR:
2460      case Z180_BBR:
2461      case Z180_CBAR:
2462         z180_mmu(cpustate);
2463         break;
2464
2465      case Z180_IOLINES:
2466         z180_write_iolines(cpustate, cpustate->ioltemp);
2467         break;
2468
2469      default:
2470         fatalerror("CPU_IMPORT_STATE(z80) called for unexpected value\n");
2471         break;
2472   }
2473}
2474
2475
2476static CPU_EXPORT_STATE( z180 )
2477{
2478   z180_state *cpustate = device->token;
2479
2480   switch (entry->index)
2481   {
2482      case Z180_R:
2483         cpustate->rtemp = (cpustate->R & 0x7f) | (cpustate->R2 & 0x80);
2484         break;
2485
2486      case Z180_IOLINES:
2487         cpustate->ioltemp = cpustate->iol;
2488         break;
2489
2490      default:
2491         fatalerror("CPU_EXPORT_STATE(z80) called for unexpected value\n");
2492         break;
2493   }
2494}
2495
2496
2497/**************************************************************************
23072498 * Generic set_info
23082499 **************************************************************************/
23092500
r3957r3958
23142505   {
23152506      /* --- the following bits of info are set as 64-bit signed integers --- */
23162507      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   set_irq_line(cpustate, INPUT_LINE_NMI, info->i);   break;
2317      case CPUINFO_INT_INPUT_STATE + Z180_INT0:      set_irq_line(cpustate, Z180_INT0, info->i);      break;
2318      case CPUINFO_INT_INPUT_STATE + Z180_INT1:      set_irq_line(cpustate, Z180_INT1, info->i);      break;
2319      case CPUINFO_INT_INPUT_STATE + Z180_INT2:      set_irq_line(cpustate, Z180_INT2, info->i);      break;
2508      case CPUINFO_INT_INPUT_STATE + Z180_INT0:      set_irq_line(cpustate, Z180_INT0, info->i);         break;
23202509
2321      case CPUINFO_INT_PC:                     cpustate->_PC = info->i;                      break;
2322      case CPUINFO_INT_REGISTER + Z180_PC:         cpustate->PC.w.l = info->i;               break;
2323      case CPUINFO_INT_SP:                     cpustate->_SP = info->i;                     break;
2324      case CPUINFO_INT_REGISTER + Z180_SP:         cpustate->SP.w.l = info->i;               break;
2325      case CPUINFO_INT_REGISTER + Z180_AF:         cpustate->AF.w.l = info->i;               break;
2326      case CPUINFO_INT_REGISTER + Z180_BC:         cpustate->BC.w.l = info->i;               break;
2327      case CPUINFO_INT_REGISTER + Z180_DE:         cpustate->DE.w.l = info->i;               break;
2328      case CPUINFO_INT_REGISTER + Z180_HL:         cpustate->HL.w.l = info->i;               break;
2329      case CPUINFO_INT_REGISTER + Z180_IX:         cpustate->IX.w.l = info->i;               break;
2330      case CPUINFO_INT_REGISTER + Z180_IY:         cpustate->IY.w.l = info->i;               break;
2331      case CPUINFO_INT_REGISTER + Z180_R:            cpustate->R = info->i; cpustate->R2 = info->i & 0x80;   break;
2332      case CPUINFO_INT_REGISTER + Z180_I:            cpustate->I = info->i;                  break;
2333      case CPUINFO_INT_REGISTER + Z180_AF2:         cpustate->AF2.w.l = info->i;               break;
2334      case CPUINFO_INT_REGISTER + Z180_BC2:         cpustate->BC2.w.l = info->i;               break;
2335      case CPUINFO_INT_REGISTER + Z180_DE2:         cpustate->DE2.w.l = info->i;               break;
2336      case CPUINFO_INT_REGISTER + Z180_HL2:         cpustate->HL2.w.l = info->i;               break;
2337      case CPUINFO_INT_REGISTER + Z180_IM:         cpustate->IM = info->i;                  break;
2338      case CPUINFO_INT_REGISTER + Z180_IFF1:         cpustate->IFF1 = info->i;               break;
2339      case CPUINFO_INT_REGISTER + Z180_IFF2:         cpustate->IFF2 = info->i;               break;
2340      case CPUINFO_INT_REGISTER + Z180_HALT:         cpustate->HALT = info->i;               break;
2341      case CPUINFO_INT_REGISTER + Z180_CNTLA0:      cpustate->io[0x00] = info->i;            break;
2342      case CPUINFO_INT_REGISTER + Z180_CNTLA1:      cpustate->io[0x01] = info->i;            break;
2343      case CPUINFO_INT_REGISTER + Z180_CNTLB0:      cpustate->io[0x02] = info->i;            break;
2344      case CPUINFO_INT_REGISTER + Z180_CNTLB1:      cpustate->io[0x03] = info->i;            break;
2345      case CPUINFO_INT_REGISTER + Z180_STAT0:         cpustate->io[0x04] = info->i;            break;
2346      case CPUINFO_INT_REGISTER + Z180_STAT1:         cpustate->io[0x05] = info->i;            break;
2347      case CPUINFO_INT_REGISTER + Z180_TDR0:         cpustate->io[0x06] = info->i;            break;
2348      case CPUINFO_INT_REGISTER + Z180_TDR1:         cpustate->io[0x07] = info->i;            break;
2349      case CPUINFO_INT_REGISTER + Z180_RDR0:         cpustate->io[0x08] = info->i;            break;
2350      case CPUINFO_INT_REGISTER + Z180_RDR1:         cpustate->io[0x09] = info->i;            break;
2351      case CPUINFO_INT_REGISTER + Z180_CNTR:         cpustate->io[0x0a] = info->i;            break;
2352      case CPUINFO_INT_REGISTER + Z180_TRDR:         cpustate->io[0x0b] = info->i;            break;
2353      case CPUINFO_INT_REGISTER + Z180_TMDR0L:      cpustate->io[0x0c] = info->i;            break;
2354      case CPUINFO_INT_REGISTER + Z180_TMDR0H:      cpustate->io[0x0d] = info->i;            break;
2355      case CPUINFO_INT_REGISTER + Z180_RLDR0L:      cpustate->io[0x0e] = info->i;            break;
2356      case CPUINFO_INT_REGISTER + Z180_RLDR0H:      cpustate->io[0x0f] = info->i;            break;
2357      case CPUINFO_INT_REGISTER + Z180_TCR:         cpustate->io[0x10] = info->i;            break;
2358      case CPUINFO_INT_REGISTER + Z180_IO11:         cpustate->io[0x11] = info->i;            break;
2359      case CPUINFO_INT_REGISTER + Z180_ASEXT0:      cpustate->io[0x12] = info->i;            break;
2360      case CPUINFO_INT_REGISTER + Z180_ASEXT1:      cpustate->io[0x13] = info->i;            break;
2361      case CPUINFO_INT_REGISTER + Z180_TMDR1L:      cpustate->io[0x14] = info->i;            break;
2362      case CPUINFO_INT_REGISTER + Z180_TMDR1H:      cpustate->io[0x15] = info->i;            break;
2363      case CPUINFO_INT_REGISTER + Z180_RLDR1L:      cpustate->io[0x16] = info->i;            break;
2364      case CPUINFO_INT_REGISTER + Z180_RLDR1H:      cpustate->io[0x17] = info->i;            break;
2365      case CPUINFO_INT_REGISTER + Z180_FRC:         cpustate->io[0x18] = info->i;            break;
2366      case CPUINFO_INT_REGISTER + Z180_IO19:         cpustate->io[0x19] = info->i;            break;
2367      case CPUINFO_INT_REGISTER + Z180_ASTC0L:      cpustate->io[0x1a] = info->i;            break;
2368      case CPUINFO_INT_REGISTER + Z180_ASTC0H:      cpustate->io[0x1b] = info->i;            break;
2369      case CPUINFO_INT_REGISTER + Z180_ASTC1L:      cpustate->io[0x1c] = info->i;            break;
2370      case CPUINFO_INT_REGISTER + Z180_ASTC1H:      cpustate->io[0x1d] = info->i;            break;
2371      case CPUINFO_INT_REGISTER + Z180_CMR:         cpustate->io[0x1e] = info->i;            break;
2372      case CPUINFO_INT_REGISTER + Z180_CCR:         cpustate->io[0x1f] = info->i;            break;
2373      case CPUINFO_INT_REGISTER + Z180_SAR0L:         cpustate->io[0x20] = info->i;            break;
2374      case CPUINFO_INT_REGISTER + Z180_SAR0H:         cpustate->io[0x21] = info->i;            break;
2375      case CPUINFO_INT_REGISTER + Z180_SAR0B:         cpustate->io[0x22] = info->i;            break;
2376      case CPUINFO_INT_REGISTER + Z180_DAR0L:         cpustate->io[0x23] = info->i;            break;
2377      case CPUINFO_INT_REGISTER + Z180_DAR0H:         cpustate->io[0x24] = info->i;            break;
2378      case CPUINFO_INT_REGISTER + Z180_DAR0B:         cpustate->io[0x25] = info->i;            break;
2379      case CPUINFO_INT_REGISTER + Z180_BCR0L:         cpustate->io[0x26] = info->i;            break;
2380      case CPUINFO_INT_REGISTER + Z180_BCR0H:         cpustate->io[0x27] = info->i;            break;
2381      case CPUINFO_INT_REGISTER + Z180_MAR1L:         cpustate->io[0x28] = info->i;            break;
2382      case CPUINFO_INT_REGISTER + Z180_MAR1H:         cpustate->io[0x29] = info->i;            break;
2383      case CPUINFO_INT_REGISTER + Z180_MAR1B:         cpustate->io[0x2a] = info->i;            break;
2384      case CPUINFO_INT_REGISTER + Z180_IAR1L:         cpustate->io[0x2b] = info->i;            break;
2385      case CPUINFO_INT_REGISTER + Z180_IAR1H:         cpustate->io[0x2c] = info->i;            break;
2386      case CPUINFO_INT_REGISTER + Z180_IAR1B:         cpustate->io[0x2d] = info->i;            break;
2387      case CPUINFO_INT_REGISTER + Z180_BCR1L:         cpustate->io[0x2e] = info->i;            break;
2388      case CPUINFO_INT_REGISTER + Z180_BCR1H:         cpustate->io[0x2f] = info->i;            break;
2389      case CPUINFO_INT_REGISTER + Z180_DSTAT:         cpustate->io[0x30] = info->i;            break;
2390      case CPUINFO_INT_REGISTER + Z180_DMODE:         cpustate->io[0x31] = info->i;            break;
2391      case CPUINFO_INT_REGISTER + Z180_DCNTL:         cpustate->io[0x32] = info->i;            break;
2392      case CPUINFO_INT_REGISTER + Z180_IL:         cpustate->io[0x33] = info->i;            break;
2393      case CPUINFO_INT_REGISTER + Z180_ITC:         cpustate->io[0x34] = info->i;            break;
2394      case CPUINFO_INT_REGISTER + Z180_IO35:         cpustate->io[0x35] = info->i;            break;
2395      case CPUINFO_INT_REGISTER + Z180_RCR:         cpustate->io[0x36] = info->i;            break;
2396      case CPUINFO_INT_REGISTER + Z180_IO37:         cpustate->io[0x37] = info->i;            break;
2397      case CPUINFO_INT_REGISTER + Z180_CBR:         cpustate->io[0x38] = info->i; z180_mmu(cpustate);   break;
2398      case CPUINFO_INT_REGISTER + Z180_BBR:         cpustate->io[0x39] = info->i; z180_mmu(cpustate);   break;
2399      case CPUINFO_INT_REGISTER + Z180_CBAR:         cpustate->io[0x3a] = info->i; z180_mmu(cpustate);   break;
2400      case CPUINFO_INT_REGISTER + Z180_IO3B:         cpustate->io[0x3b] = info->i;            break;
2401      case CPUINFO_INT_REGISTER + Z180_IO3C:         cpustate->io[0x3c] = info->i;            break;
2402      case CPUINFO_INT_REGISTER + Z180_IO3D:         cpustate->io[0x3d] = info->i;            break;
2403      case CPUINFO_INT_REGISTER + Z180_OMCR:         cpustate->io[0x3e] = info->i;            break;
2404      case CPUINFO_INT_REGISTER + Z180_IOCR:         cpustate->io[0x3f] = info->i;            break;
2405      case CPUINFO_INT_REGISTER + Z180_IOLINES:      z180_write_iolines(cpustate, info->i);      break;
2406
24072510      /* --- the following bits of info are set as pointers to data or functions --- */
2408      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: cc[Z180_TABLE_op] = info->p;         break;
2409      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: cc[Z180_TABLE_cb] = info->p;         break;
2410      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: cc[Z180_TABLE_ed] = info->p;         break;
2411      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: cc[Z180_TABLE_xy] = info->p;         break;
2412      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: cc[Z180_TABLE_xycb] = info->p;      break;
2413      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: cc[Z180_TABLE_ex] = info->p;         break;
2511      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op:       cc[Z180_TABLE_op] = info->p;            break;
2512      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb:       cc[Z180_TABLE_cb] = info->p;            break;
2513      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed:       cc[Z180_TABLE_ed] = info->p;            break;
2514      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy:       cc[Z180_TABLE_xy] = info->p;            break;
2515      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb:    cc[Z180_TABLE_xycb] = info->p;            break;
2516      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex:       cc[Z180_TABLE_ex] = info->p;            break;
24142517   }
24152518}
24162519
r3957r3958
24362539      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
24372540      case CPUINFO_INT_MAX_CYCLES:               info->i = 16;                     break;
24382541
2439      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
2440      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
2441      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2442      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2443      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2444      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2445      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
2446      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
2447      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2542      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 8;                     break;
2543      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:       info->i = 20;                     break;
2544      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:       info->i = 0;                     break;
2545      case CPUINFO_INT_DATABUS_WIDTH_IO:            info->i = 8;                     break;
2546      case CPUINFO_INT_ADDRBUS_WIDTH_IO:             info->i = 16;                     break;
2547      case CPUINFO_INT_ADDRBUS_SHIFT_IO:             info->i = 0;                     break;
24482548
2449      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;            break;
2450      case CPUINFO_INT_INPUT_STATE + Z180_INT0:      info->i = cpustate->irq_state[0];         break;
2451      case CPUINFO_INT_INPUT_STATE + Z180_INT1:      info->i = cpustate->irq_state[1];         break;
2452      case CPUINFO_INT_INPUT_STATE + Z180_INT2:      info->i = cpustate->irq_state[2];         break;
2549      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;         break;
2550      case CPUINFO_INT_INPUT_STATE + Z180_INT0:      info->i = cpustate->irq_state[0];      break;
2551      case CPUINFO_INT_INPUT_STATE + Z180_INT1:      info->i = cpustate->irq_state[1];      break;
2552      case CPUINFO_INT_INPUT_STATE + Z180_INT2:      info->i = cpustate->irq_state[2];      break;
24532553
2454      case CPUINFO_INT_PREVIOUSPC:               info->i = cpustate->PREPC.w.l;            break;
2554      /* --- the following bits of info are returned as pointers --- */
2555      case CPUINFO_FCT_SET_INFO:      info->setinfo = CPU_SET_INFO_NAME(z180);            break;
2556      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(z180);                  break;
2557      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(z180);                  break;
2558      case CPUINFO_FCT_EXECUTE:      info->execute = CPU_EXECUTE_NAME(z180);               break;
2559      case CPUINFO_FCT_BURN:         info->burn = CPU_BURN_NAME(z180);                  break;
2560      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(z180);         break;
2561      case CPUINFO_FCT_TRANSLATE:      info->translate = CPU_TRANSLATE_NAME(z180);            break;
2562      case CPUINFO_FCT_IMPORT_STATE:   info->import_state = CPU_IMPORT_STATE_NAME(z180);      break;
2563      case CPUINFO_FCT_EXPORT_STATE:   info->export_state = CPU_EXPORT_STATE_NAME(z180);      break;
24552564
2456      case CPUINFO_INT_PC:                     info->i = cpustate->_PCD;                     break;
2457      case CPUINFO_INT_REGISTER + Z180_PC:         info->i = cpustate->PC.w.l;               break;
2458      case CPUINFO_INT_SP:                     info->i = cpustate->_SPD;                     break;
2459      case CPUINFO_INT_REGISTER + Z180_SP:         info->i = cpustate->SP.w.l;               break;
2460      case CPUINFO_INT_REGISTER + Z180_AF:         info->i = cpustate->AF.w.l;               break;
2461      case CPUINFO_INT_REGISTER + Z180_BC:         info->i = cpustate->BC.w.l;               break;
2462      case CPUINFO_INT_REGISTER + Z180_DE:         info->i = cpustate->DE.w.l;               break;
2463      case CPUINFO_INT_REGISTER + Z180_HL:         info->i = cpustate->HL.w.l;               break;
2464      case CPUINFO_INT_REGISTER + Z180_IX:         info->i = cpustate->IX.w.l;               break;
2465      case CPUINFO_INT_REGISTER + Z180_IY:         info->i = cpustate->IY.w.l;               break;
2466      case CPUINFO_INT_REGISTER + Z180_R:            info->i = (cpustate->R & 0x7f) | (cpustate->R2 & 0x80); break;
2467      case CPUINFO_INT_REGISTER + Z180_I:            info->i = cpustate->I;                  break;
2468      case CPUINFO_INT_REGISTER + Z180_AF2:         info->i = cpustate->AF2.w.l;               break;
2469      case CPUINFO_INT_REGISTER + Z180_BC2:         info->i = cpustate->BC2.w.l;               break;
2470      case CPUINFO_INT_REGISTER + Z180_DE2:         info->i = cpustate->DE2.w.l;               break;
2471      case CPUINFO_INT_REGISTER + Z180_HL2:         info->i = cpustate->HL2.w.l;               break;
2472      case CPUINFO_INT_REGISTER + Z180_IM:         info->i = cpustate->IM;                  break;
2473      case CPUINFO_INT_REGISTER + Z180_IFF1:         info->i = cpustate->IFF1;               break;
2474      case CPUINFO_INT_REGISTER + Z180_IFF2:         info->i = cpustate->IFF2;               break;
2475      case CPUINFO_INT_REGISTER + Z180_HALT:         info->i = cpustate->HALT;               break;
2476      case CPUINFO_INT_REGISTER + Z180_CNTLA0:      info->i = cpustate->io[0x00];            break;
2477      case CPUINFO_INT_REGISTER + Z180_CNTLA1:      info->i = cpustate->io[0x01];            break;
2478      case CPUINFO_INT_REGISTER + Z180_CNTLB0:      info->i = cpustate->io[0x02];            break;
2479      case CPUINFO_INT_REGISTER + Z180_CNTLB1:      info->i = cpustate->io[0x03];            break;
2480      case CPUINFO_INT_REGISTER + Z180_STAT0:         info->i = cpustate->io[0x04];            break;
2481      case CPUINFO_INT_REGISTER + Z180_STAT1:         info->i = cpustate->io[0x05];            break;
2482      case CPUINFO_INT_REGISTER + Z180_TDR0:         info->i = cpustate->io[0x06];            break;
2483      case CPUINFO_INT_REGISTER + Z180_TDR1:         info->i = cpustate->io[0x07];            break;
2484      case CPUINFO_INT_REGISTER + Z180_RDR0:         info->i = cpustate->io[0x08];            break;
2485      case CPUINFO_INT_REGISTER + Z180_RDR1:         info->i = cpustate->io[0x09];            break;
2486      case CPUINFO_INT_REGISTER + Z180_CNTR:         info->i = cpustate->io[0x0a];            break;
2487      case CPUINFO_INT_REGISTER + Z180_TRDR:         info->i = cpustate->io[0x0b];            break;
2488      case CPUINFO_INT_REGISTER + Z180_TMDR0L:      info->i = cpustate->io[0x0c];            break;
2489      case CPUINFO_INT_REGISTER + Z180_TMDR0H:      info->i = cpustate->io[0x0d];            break;
2490      case CPUINFO_INT_REGISTER + Z180_RLDR0L:      info->i = cpustate->io[0x0e];            break;
2491      case CPUINFO_INT_REGISTER + Z180_RLDR0H:      info->i = cpustate->io[0x0f];            break;
2492      case CPUINFO_INT_REGISTER + Z180_TCR:         info->i = cpustate->io[0x10];            break;
2493      case CPUINFO_INT_REGISTER + Z180_IO11:         info->i = cpustate->io[0x11];            break;
2494      case CPUINFO_INT_REGISTER + Z180_ASEXT0:      info->i = cpustate->io[0x12];            break;
2495      case CPUINFO_INT_REGISTER + Z180_ASEXT1:      info->i = cpustate->io[0x13];            break;
2496      case CPUINFO_INT_REGISTER + Z180_TMDR1L:      info->i = cpustate->io[0x14];            break;
2497      case CPUINFO_INT_REGISTER + Z180_TMDR1H:      info->i = cpustate->io[0x15];            break;
2498      case CPUINFO_INT_REGISTER + Z180_RLDR1L:      info->i = cpustate->io[0x16];            break;
2499      case CPUINFO_INT_REGISTER + Z180_RLDR1H:      info->i = cpustate->io[0x17];            break;
2500      case CPUINFO_INT_REGISTER + Z180_FRC:         info->i = cpustate->io[0x18];            break;
2501      case CPUINFO_INT_REGISTER + Z180_IO19:         info->i = cpustate->io[0x19];            break;
2502      case CPUINFO_INT_REGISTER + Z180_ASTC0L:      info->i = cpustate->io[0x1a];            break;
2503      case CPUINFO_INT_REGISTER + Z180_ASTC0H:      info->i = cpustate->io[0x1b];            break;
2504      case CPUINFO_INT_REGISTER + Z180_ASTC1L:      info->i = cpustate->io[0x1c];            break;
2505      case CPUINFO_INT_REGISTER + Z180_ASTC1H:      info->i = cpustate->io[0x1d];            break;
2506      case CPUINFO_INT_REGISTER + Z180_CMR:         info->i = cpustate->io[0x1e];            break;
2507      case CPUINFO_INT_REGISTER + Z180_CCR:         info->i = cpustate->io[0x1f];            break;
2508      case CPUINFO_INT_REGISTER + Z180_SAR0L:         info->i = cpustate->io[0x20];            break;
2509      case CPUINFO_INT_REGISTER + Z180_SAR0H:         info->i = cpustate->io[0x21];            break;
2510      case CPUINFO_INT_REGISTER + Z180_SAR0B:         info->i = cpustate->io[0x22];            break;
2511      case CPUINFO_INT_REGISTER + Z180_DAR0L:         info->i = cpustate->io[0x23];            break;
2512      case CPUINFO_INT_REGISTER + Z180_DAR0H:         info->i = cpustate->io[0x24];            break;
2513      case CPUINFO_INT_REGISTER + Z180_DAR0B:         info->i = cpustate->io[0x25];            break;
2514      case CPUINFO_INT_REGISTER + Z180_BCR0L:         info->i = cpustate->io[0x26];            break;
2515      case CPUINFO_INT_REGISTER + Z180_BCR0H:         info->i = cpustate->io[0x27];            break;
2516      case CPUINFO_INT_REGISTER + Z180_MAR1L:         info->i = cpustate->io[0x28];            break;
2517      case CPUINFO_INT_REGISTER + Z180_MAR1H:         info->i = cpustate->io[0x29];            break;
2518      case CPUINFO_INT_REGISTER + Z180_MAR1B:         info->i = cpustate->io[0x2a];            break;
2519      case CPUINFO_INT_REGISTER + Z180_IAR1L:         info->i = cpustate->io[0x2b];            break;
2520      case CPUINFO_INT_REGISTER + Z180_IAR1H:         info->i = cpustate->io[0x2c];            break;
2521      case CPUINFO_INT_REGISTER + Z180_IAR1B:         info->i = cpustate->io[0x2d];            break;
2522      case CPUINFO_INT_REGISTER + Z180_BCR1L:         info->i = cpustate->io[0x2e];            break;
2523      case CPUINFO_INT_REGISTER + Z180_BCR1H:         info->i = cpustate->io[0x2f];            break;
2524      case CPUINFO_INT_REGISTER + Z180_DSTAT:         info->i = cpustate->io[0x30];            break;
2525      case CPUINFO_INT_REGISTER + Z180_DMODE:         info->i = cpustate->io[0x31];            break;
2526      case CPUINFO_INT_REGISTER + Z180_DCNTL:         info->i = cpustate->io[0x32];            break;
2527      case CPUINFO_INT_REGISTER + Z180_IL:         info->i = cpustate->io[0x33];            break;
2528      case CPUINFO_INT_REGISTER + Z180_ITC:         info->i = cpustate->io[0x34];            break;
2529      case CPUINFO_INT_REGISTER + Z180_IO35:         info->i = cpustate->io[0x35];            break;
2530      case CPUINFO_INT_REGISTER + Z180_RCR:         info->i = cpustate->io[0x36];            break;
2531      case CPUINFO_INT_REGISTER + Z180_IO37:         info->i = cpustate->io[0x37];            break;
2532      case CPUINFO_INT_REGISTER + Z180_CBR:         info->i = cpustate->io[0x38];            break;
2533      case CPUINFO_INT_REGISTER + Z180_BBR:         info->i = cpustate->io[0x39];            break;
2534      case CPUINFO_INT_REGISTER + Z180_CBAR:         info->i = cpustate->io[0x3a];            break;
2535      case CPUINFO_INT_REGISTER + Z180_IO3B:         info->i = cpustate->io[0x3b];            break;
2536      case CPUINFO_INT_REGISTER + Z180_IO3C:         info->i = cpustate->io[0x3c];            break;
2537      case CPUINFO_INT_REGISTER + Z180_IO3D:         info->i = cpustate->io[0x3d];            break;
2538      case CPUINFO_INT_REGISTER + Z180_OMCR:         info->i = cpustate->io[0x3e];            break;
2539      case CPUINFO_INT_REGISTER + Z180_IOCR:         info->i = cpustate->io[0x3f];            break;
2540      case CPUINFO_INT_REGISTER + Z180_IOLINES:      info->i = cpustate->iol;                  break;
2565      /* --- the following bits of info are returned as pointers to functions --- */
2566      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
2567      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &cpustate->state;   break;
25412568
2542      /* --- the following bits of info are returned as pointers to data or functions --- */
2543      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(z180);      break;
2544      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(z180);            break;
2545      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(z180);            break;
2546      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(z180);         break;
2547      case CPUINFO_PTR_BURN:                     info->burn = CPU_BURN_NAME(z180);            break;
2548      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(z180);   break;
2549      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
2550      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(z180);      break;
2551      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op: info->p = (void *)cc[Z180_TABLE_op];         break;
2552      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb: info->p = (void *)cc[Z180_TABLE_cb];         break;
2553      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed: info->p = (void *)cc[Z180_TABLE_ed];         break;
2554      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy: info->p = (void *)cc[Z180_TABLE_xy];         break;
2555      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb: info->p = (void *)cc[Z180_TABLE_xycb];      break;
2556      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex: info->p = (void *)cc[Z180_TABLE_ex];         break;
2569      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_op:       info->p = (void *)cc[Z180_TABLE_op];   break;
2570      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_cb:       info->p = (void *)cc[Z180_TABLE_cb];   break;
2571      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ed:       info->p = (void *)cc[Z180_TABLE_ed];   break;
2572      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xy:       info->p = (void *)cc[Z180_TABLE_xy];   break;
2573      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_xycb:   info->p = (void *)cc[Z180_TABLE_xycb];   break;
2574      case CPUINFO_PTR_Z180_CYCLE_TABLE + Z180_TABLE_ex:       info->p = (void *)cc[Z180_TABLE_ex];   break;
25572575
25582576      /* --- the following bits of info are returned as NULL-terminated strings --- */
25592577      case CPUINFO_STR_NAME:                     strcpy(info->s, "Z180");            break;
r3957r3958
25732591            cpustate->AF.b.l & 0x02 ? 'N':'.',
25742592            cpustate->AF.b.l & 0x01 ? 'C':'.');
25752593         break;
2576
2577      case CPUINFO_STR_REGISTER + Z180_PC:         sprintf(info->s, "PC:%04X", cpustate->PC.w.l); break;
2578      case CPUINFO_STR_REGISTER + Z180_SP:         sprintf(info->s, "SP:%04X", cpustate->SP.w.l); break;
2579      case CPUINFO_STR_REGISTER + Z180_AF:         sprintf(info->s, "AF:%04X", cpustate->AF.w.l); break;
2580      case CPUINFO_STR_REGISTER + Z180_BC:         sprintf(info->s, "BC:%04X", cpustate->BC.w.l); break;
2581      case CPUINFO_STR_REGISTER + Z180_DE:         sprintf(info->s, "DE:%04X", cpustate->DE.w.l); break;
2582      case CPUINFO_STR_REGISTER + Z180_HL:         sprintf(info->s, "HL:%04X", cpustate->HL.w.l); break;
2583      case CPUINFO_STR_REGISTER + Z180_IX:         sprintf(info->s, "IX:%04X", cpustate->IX.w.l); break;
2584      case CPUINFO_STR_REGISTER + Z180_IY:         sprintf(info->s, "IY:%04X", cpustate->IY.w.l); break;
2585      case CPUINFO_STR_REGISTER + Z180_R:          sprintf(info->s, "R   :%02X", (cpustate->R & 0x7f) | (cpustate->R2 & 0x80)); break;
2586      case CPUINFO_STR_REGISTER + Z180_I:          sprintf(info->s, "I   :%02X", cpustate->I); break;
2587      case CPUINFO_STR_REGISTER + Z180_IL:         sprintf(info->s, "IL  :%02X", cpustate->io[Z180_IL-Z180_CNTLA0]); break;
2588      case CPUINFO_STR_REGISTER + Z180_AF2:         sprintf(info->s, "AF2:%04X", cpustate->AF2.w.l); break;
2589      case CPUINFO_STR_REGISTER + Z180_BC2:         sprintf(info->s, "BC2:%04X", cpustate->BC2.w.l); break;
2590      case CPUINFO_STR_REGISTER + Z180_DE2:         sprintf(info->s, "DE2:%04X", cpustate->DE2.w.l); break;
2591      case CPUINFO_STR_REGISTER + Z180_HL2:         sprintf(info->s, "HL2:%04X", cpustate->HL2.w.l); break;
2592      case CPUINFO_STR_REGISTER + Z180_IM:         sprintf(info->s, "IM  :%X", cpustate->IM); break;
2593      case CPUINFO_STR_REGISTER + Z180_IFF1:         sprintf(info->s, "IFF1:%X", cpustate->IFF1); break;
2594      case CPUINFO_STR_REGISTER + Z180_IFF2:         sprintf(info->s, "IFF2:%X", cpustate->IFF2); break;
2595      case CPUINFO_STR_REGISTER + Z180_HALT:         sprintf(info->s, "HALT:%X", cpustate->HALT); break;
2596      case CPUINFO_STR_REGISTER + Z180_CCR:          sprintf(info->s, "CCR :%02X", cpustate->io[Z180_CCR-Z180_CNTLA0]); break;
2597      case CPUINFO_STR_REGISTER + Z180_ITC:          sprintf(info->s, "ITC :%02X", cpustate->io[Z180_ITC-Z180_CNTLA0]); break;
2598      case CPUINFO_STR_REGISTER + Z180_CBR:          sprintf(info->s, "CBR :%02X", cpustate->io[Z180_CBR-Z180_CNTLA0]); break;
2599      case CPUINFO_STR_REGISTER + Z180_BBR:          sprintf(info->s, "BBR :%02X", cpustate->io[Z180_BBR-Z180_CNTLA0]); break;
2600      case CPUINFO_STR_REGISTER + Z180_CBAR:         sprintf(info->s, "CBAR:%02X", cpustate->io[Z180_CBAR-Z180_CNTLA0]); break;
2601      case CPUINFO_STR_REGISTER + Z180_OMCR:         sprintf(info->s, "OMCR:%02X", cpustate->io[Z180_OMCR-Z180_CNTLA0]); break;
2602      case CPUINFO_STR_REGISTER + Z180_IOCR:         sprintf(info->s, "IOCR:%02X", cpustate->io[Z180_IOCR-Z180_CNTLA0]); break;
26032594   }
26042595}
src/emu/cpu/z180/z180.h
r3957r3958
77
88enum
99{
10   Z180_PC=1,
10   Z180_PC,
1111   Z180_SP,
1212   Z180_AF,
1313   Z180_BC,
r3957r3958
1515   Z180_HL,
1616   Z180_IX,
1717   Z180_IY,
18   Z180_A,
19   Z180_B,
20   Z180_C,
21   Z180_D,
22   Z180_E,
23   Z180_H,
24   Z180_L,
1825   Z180_AF2,
1926   Z180_BC2,
2027   Z180_DE2,
r3957r3958
93100   Z180_IO3D,      /* 3d reserved */
94101   Z180_OMCR,      /* 3e operation mode control register */
95102   Z180_IOCR,      /* 3f I/O control register */
96   Z180_IOLINES   /* read/write I/O lines */
103   Z180_IOLINES,   /* read/write I/O lines */
104
105   Z180_GENPC = REG_GENPC,
106   Z180_GENSP = REG_GENSP,
107   Z180_GENPCBASE = REG_GENPCBASE
97108};
98109
99110enum
r3957r3958
129140extern void z180_writemem(const device_config *device, offs_t offset, UINT8 data);
130141
131142extern CPU_GET_INFO( z180 );
143#define CPU_Z180 CPU_GET_INFO_NAME( z180 )
132144
133145CPU_DISASSEMBLE( z180 );
134146
src/emu/cpu/drcfe.c
r3957r3958
147147   drcfe->device = cpu;
148148   drcfe->program = memory_find_address_space(cpu, ADDRESS_SPACE_PROGRAM);
149149   drcfe->pageshift = cpu_get_page_shift(cpu, ADDRESS_SPACE_PROGRAM);
150   drcfe->translate = (cpu_translate_func)cpu_get_info_fct(cpu, CPUINFO_PTR_TRANSLATE);
150   drcfe->translate = (cpu_translate_func)device_get_info_fct(cpu, CPUINFO_FCT_TRANSLATE);
151151#ifdef LSB_FIRST
152152   if (cpu_get_endianness(cpu) == ENDIANNESS_BIG)
153153#else
src/emu/cpu/i86/i86.c
r3957r3958
88#include "cpuintrf.h"
99
1010#include "host.h"
11#include "i86priv.h"
1112#include "i86.h"
12#include "i86intf.h"
1313
1414#include "i86mem.h"
1515
r3957r3958
5151   INT8 test_state;   /* PJB 03/05 */
5252   INT32 extra_cycles;       /* extra cycles for interrupts */
5353
54   UINT16 ip;
55   UINT32 sp;
56
5457   memory_interface   mem;
5558
5659   const device_config *device;
5760   const address_space *program;
5861   const address_space *io;
5962   int icount;
63   cpu_state_table state;
6064
6165   unsigned prefix_base;         /* base address of the latest prefix segment */
6266   char seg_prefix;               /* prefix segment indicator */
r3957r3958
6569};
6670
6771
72/***************************************************************************
73    CPU STATE DESCRIPTION
74***************************************************************************/
6875
76#define I86_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
77   CPU_STATE_ENTRY(I8086_##_name, #_name, _format, i8086_state, _member, _datamask, ~0, _flags)
78
79static const cpu_state_entry state_array[] =
80{
81   I86_STATE_ENTRY(GENPC, "%9s", pc, 0xfffff, CPUSTATE_IMPORT)
82   I86_STATE_ENTRY(GENPCBASE, "%08X", pc, 0xfffff, CPUSTATE_NOSHOW)   /* not implemented */
83   I86_STATE_ENTRY(IP,    "%04X", ip, 0xffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
84
85   I86_STATE_ENTRY(FLAGS, "%04X", flags, 0xffff, CPUSTATE_NOSHOW | CPUSTATE_IMPORT | CPUSTATE_EXPORT)
86
87   I86_STATE_ENTRY(AX,    "%04X", regs.w[AX], 0xffff, 0)
88   I86_STATE_ENTRY(BX,    "%04X", regs.w[BX], 0xffff, 0)
89   I86_STATE_ENTRY(CX,    "%04X", regs.w[CX], 0xffff, 0)
90   I86_STATE_ENTRY(DX,    "%04X", regs.w[DX], 0xffff, 0)
91   I86_STATE_ENTRY(SI,    "%04X", regs.w[SI], 0xffff, 0)
92   I86_STATE_ENTRY(DI,    "%04X", regs.w[DI], 0xffff, 0)
93   I86_STATE_ENTRY(BP,    "%04X", regs.w[BP], 0xffff, 0)
94   I86_STATE_ENTRY(SP,    "%04X", regs.w[SP], 0xffff, 0)
95   I86_STATE_ENTRY(GENSP, "%9s", sp, 0xfffff, CPUSTATE_IMPORT | CPUSTATE_EXPORT)
96
97   I86_STATE_ENTRY(AL,    "%02X", regs.b[AL], 0xff, CPUSTATE_NOSHOW)
98   I86_STATE_ENTRY(BL,    "%02X", regs.b[BL], 0xff, CPUSTATE_NOSHOW)
99   I86_STATE_ENTRY(CL,    "%02X", regs.b[CL], 0xff, CPUSTATE_NOSHOW)
100   I86_STATE_ENTRY(DL,    "%02X", regs.b[DL], 0xff, CPUSTATE_NOSHOW)
101   I86_STATE_ENTRY(AH,    "%02X", regs.b[AH], 0xff, CPUSTATE_NOSHOW)
102   I86_STATE_ENTRY(BH,    "%02X", regs.b[BH], 0xff, CPUSTATE_NOSHOW)
103   I86_STATE_ENTRY(CH,    "%02X", regs.b[CH], 0xff, CPUSTATE_NOSHOW)
104   I86_STATE_ENTRY(DH,    "%02X", regs.b[DH], 0xff, CPUSTATE_NOSHOW)
105
106   I86_STATE_ENTRY(CS,    "%04X", sregs[CS], 0xffff, CPUSTATE_IMPORT)
107   I86_STATE_ENTRY(DS,    "%04X", sregs[DS], 0xffff, CPUSTATE_IMPORT)
108   I86_STATE_ENTRY(ES,    "%04X", sregs[ES], 0xffff, CPUSTATE_IMPORT)
109   I86_STATE_ENTRY(SS,    "%04X", sregs[SS], 0xffff, CPUSTATE_IMPORT)
110};
111
112static const cpu_state_table state_table_template =
113{
114   NULL,                  /* pointer to the base of state (offsets are relative to this) */
115   0,                     /* subtype this table refers to */
116   ARRAY_LENGTH(state_array),   /* number of entries */
117   state_array               /* array of entries */
118};
119
120
121
69122#include "i86time.c"
70123
71124/***************************************************************************/
r3957r3958
152205   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
153206   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
154207
208   /* set up the state table */
209   cpustate->state = state_table_template;
210   cpustate->state.baseptr = cpustate;
211   cpustate->state.subtypemask = 1;
212
155213   i8086_state_register(device);
156214   configure_memory_16bit(cpustate);
157215}
r3957r3958
170228   i8086_state *cpustate = device->token;
171229   cpu_irq_callback save_irqcallback;
172230    memory_interface save_mem;
231    cpu_state_table save_state;
173232
174233   save_irqcallback = cpustate->irq_callback;
175234   save_mem = cpustate->mem;
235    save_state = cpustate->state;
176236   memset(cpustate, 0, sizeof(*cpustate));
177237   cpustate->irq_callback = save_irqcallback;
178238   cpustate->mem = save_mem;
239    cpustate->state = save_state;
179240   cpustate->device = device;
180241   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
181242   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
r3957r3958
225286{
226287   i8086_state *cpustate = device->token;
227288
228   cpustate->base[CS] = SegBase(CS);
229   cpustate->base[DS] = SegBase(DS);
230   cpustate->base[ES] = SegBase(ES);
231   cpustate->base[SS] = SegBase(SS);
232
233289   /* copy over the cycle counts if they're not correct */
234290   if (timing.id != 8086)
235291      timing = i8086_cycles;
r3957r3958
268324
269325#if (HAS_I80186 || HAS_I80188)
270326
271#include "i186intf.h"
327#include "i86.h"
272328
273329#undef PREFIX
274330#define PREFIX(name) i80186##name
r3957r3958
286342{
287343   i8086_state *cpustate = device->token;
288344
289   cpustate->base[CS] = SegBase(CS);
290   cpustate->base[DS] = SegBase(DS);
291   cpustate->base[ES] = SegBase(ES);
292   cpustate->base[SS] = SegBase(SS);
293
294345   /* copy over the cycle counts if they're not correct */
295346   if (timing.id != 80186)
296347      timing = i80186_cycles;
r3957r3958
324375
325376
326377/**************************************************************************
327 * Generic set_info
378 * STATE IMPORT/EXPORT
328379 **************************************************************************/
329380
330static CPU_SET_INFO( i8086 )
381static CPU_IMPORT_STATE( i8086 )
331382{
332383   i8086_state *cpustate = device->token;
333384
334   switch (state)
385   switch (entry->index)
335386   {
336      /* --- the following bits of info are set as 64-bit signed integers --- */
337      case CPUINFO_INT_INPUT_STATE + 0:            set_irq_line(cpustate, 0, info->i);            break;
338      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   set_irq_line(cpustate, INPUT_LINE_NMI, info->i);   break;
339      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_TEST:   set_test_line(cpustate, info->i);               break; /* PJB 03/05 */
340
341      case CPUINFO_INT_PC:
342      case CPUINFO_INT_REGISTER + I8086_PC:
343         if (info->i - cpustate->base[CS] >= 0x10000)
387      case I8086_GENPC:
388         if (cpustate->pc - cpustate->base[CS] >= 0x10000)
344389         {
345            cpustate->base[CS] = info->i & 0xffff0;
390            cpustate->base[CS] = cpustate->pc & 0xffff0;
346391            cpustate->sregs[CS] = cpustate->base[CS] >> 4;
347392         }
348         cpustate->pc = info->i;
349393         break;
350      case CPUINFO_INT_REGISTER + I8086_IP:         cpustate->pc = cpustate->base[CS] + info->i;         break;
351      case CPUINFO_INT_SP:
352         if (info->i - cpustate->base[SS] < 0x10000)
394
395      case I8086_IP:
396         cpustate->pc = cpustate->base[CS] + cpustate->ip;
397         break;
398
399      case I8086_GENSP:
400         if (cpustate->sp - cpustate->base[SS] >= 0x10000)
353401         {
354            cpustate->regs.w[SP] = info->i - cpustate->base[SS];
355         }
356         else
357         {
358            cpustate->base[SS] = info->i & 0xffff0;
402            cpustate->base[SS] = cpustate->sp & 0xffff0;
359403            cpustate->sregs[SS] = cpustate->base[SS] >> 4;
360            cpustate->regs.w[SP] = info->i & 0x0000f;
361404         }
405         cpustate->regs.w[SP] = cpustate->sp - cpustate->base[SS];
362406         break;
363      case CPUINFO_INT_REGISTER + I8086_SP:         cpustate->regs.w[SP] = info->i;             break;
364      case CPUINFO_INT_REGISTER + I8086_FLAGS:       cpustate->flags = info->i;   ExpandFlags(info->i); break;
365      case CPUINFO_INT_REGISTER + I8086_AX:         cpustate->regs.w[AX] = info->i;             break;
366      case CPUINFO_INT_REGISTER + I8086_CX:         cpustate->regs.w[CX] = info->i;             break;
367      case CPUINFO_INT_REGISTER + I8086_DX:         cpustate->regs.w[DX] = info->i;             break;
368      case CPUINFO_INT_REGISTER + I8086_BX:         cpustate->regs.w[BX] = info->i;             break;
369      case CPUINFO_INT_REGISTER + I8086_BP:         cpustate->regs.w[BP] = info->i;             break;
370      case CPUINFO_INT_REGISTER + I8086_SI:         cpustate->regs.w[SI] = info->i;             break;
371      case CPUINFO_INT_REGISTER + I8086_DI:         cpustate->regs.w[DI] = info->i;             break;
372      case CPUINFO_INT_REGISTER + I8086_ES:         cpustate->sregs[ES] = info->i;   cpustate->base[ES] = SegBase(ES); break;
373      case CPUINFO_INT_REGISTER + I8086_CS:         cpustate->sregs[CS] = info->i;   cpustate->base[CS] = SegBase(CS); break;
374      case CPUINFO_INT_REGISTER + I8086_SS:         cpustate->sregs[SS] = info->i;   cpustate->base[SS] = SegBase(SS); break;
375      case CPUINFO_INT_REGISTER + I8086_DS:         cpustate->sregs[DS] = info->i;   cpustate->base[DS] = SegBase(DS); break;
376      case CPUINFO_INT_REGISTER + I8086_VECTOR:      cpustate->int_vector = info->i;             break;
407
408      case I8086_FLAGS:
409         ExpandFlags(cpustate->flags);
410         break;
411
412      case I8086_ES:
413         cpustate->base[ES] = SegBase(ES);
414         break;
415
416      case I8086_CS:
417         cpustate->base[CS] = SegBase(CS);
418         break;
419
420      case I8086_SS:
421         cpustate->base[SS] = SegBase(SS);
422         break;
423
424      case I8086_DS:
425         cpustate->base[DS] = SegBase(DS);
426         break;
427
428      default:
429         fatalerror("CPU_IMPORT_STATE(i8086) called for unexpected value\n");
430         break;
377431   }
378432}
379433
380434
435static CPU_EXPORT_STATE( i8086 )
436{
437   i8086_state *cpustate = device->token;
381438
439   switch (entry->index)
440   {
441      case I8086_IP:
442         cpustate->ip = cpustate->pc - cpustate->base[CS];
443         break;
444
445      case I8086_FLAGS:
446         cpustate->flags = CompressFlags();
447         break;
448
449      case I8086_GENSP:
450         cpustate->sp = cpustate->base[SS] + cpustate->regs.w[SP];
451         break;
452
453      default:
454         fatalerror("CPU_EXPORT_STATE(i8086) called for unexpected value\n");
455         break;
456   }
457}
458
459
460static CPU_EXPORT_STRING( i8086 )
461{
462   i8086_state *cpustate = device->token;
463
464   switch (entry->index)
465   {
466      case I8086_GENPC:
467         sprintf(string, "%04X:%04X", cpustate->sregs[CS] & 0xffff, (cpustate->pc - cpustate->base[CS]) & 0xffff);
468         break;
469
470      case I8086_GENSP:
471         sprintf(string, "%04X:%04X", cpustate->sregs[SS] & 0xffff, cpustate->regs.w[SP] & 0xffff);
472         break;
473
474      default:
475         fatalerror("CPU_EXPORT_STRING(i8086) called for unexpected value\n");
476         break;
477   }
478}
479
480
382481/**************************************************************************
482 * Generic set_info
483 **************************************************************************/
484
485static CPU_SET_INFO( i8086 )
486{
487   i8086_state *cpustate = device->token;
488
489   switch (state)
490   {
491      /* --- the following bits of info are set as 64-bit signed integers --- */
492      case CPUINFO_INT_INPUT_STATE + 0:            set_irq_line(cpustate, 0, info->i);            break;
493      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   set_irq_line(cpustate, INPUT_LINE_NMI, info->i);   break;
494      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_TEST:   set_test_line(cpustate, info->i);               break; /* PJB 03/05 */
495   }
496}
497
498
499
500/**************************************************************************
383501 * Generic get_info
384502 **************************************************************************/
385503
r3957r3958
401519      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
402520      case CPUINFO_INT_MAX_CYCLES:               info->i = 50;                     break;
403521
404      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
405      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
406      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
407      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
408      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
409      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
410      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
411      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
412      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
522      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
523      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
524      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
525      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
526      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
527      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
528      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
529      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
530      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
413531
414532      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_state;               break;
415533      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;               break;
r3957r3958
418536
419537      case CPUINFO_INT_PREVIOUSPC:               info->i = cpustate->prevpc;                  break;
420538
421      case CPUINFO_INT_PC:
422      case CPUINFO_INT_REGISTER + I8086_PC:         info->i = cpustate->pc;                     break;
423      case CPUINFO_INT_REGISTER + I8086_IP:         info->i = cpustate->pc - cpustate->base[CS];         break;
424      case CPUINFO_INT_SP:                     info->i = cpustate->base[SS] + cpustate->regs.w[SP];   break;
425      case CPUINFO_INT_REGISTER + I8086_SP:         info->i = cpustate->regs.w[SP];               break;
426      case CPUINFO_INT_REGISTER + I8086_FLAGS:       cpustate->flags = CompressFlags(); info->i = cpustate->flags; break;
427      case CPUINFO_INT_REGISTER + I8086_AX:         info->i = cpustate->regs.w[AX];               break;
428      case CPUINFO_INT_REGISTER + I8086_CX:         info->i = cpustate->regs.w[CX];               break;
429      case CPUINFO_INT_REGISTER + I8086_DX:         info->i = cpustate->regs.w[DX];               break;
430      case CPUINFO_INT_REGISTER + I8086_BX:         info->i = cpustate->regs.w[BX];               break;
431      case CPUINFO_INT_REGISTER + I8086_BP:         info->i = cpustate->regs.w[BP];               break;
432      case CPUINFO_INT_REGISTER + I8086_SI:         info->i = cpustate->regs.w[SI];               break;
433      case CPUINFO_INT_REGISTER + I8086_DI:         info->i = cpustate->regs.w[DI];               break;
434      case CPUINFO_INT_REGISTER + I8086_ES:         info->i = cpustate->sregs[ES];               break;
435      case CPUINFO_INT_REGISTER + I8086_CS:         info->i = cpustate->sregs[CS];               break;
436      case CPUINFO_INT_REGISTER + I8086_SS:         info->i = cpustate->sregs[SS];               break;
437      case CPUINFO_INT_REGISTER + I8086_DS:         info->i = cpustate->sregs[DS];               break;
438      case CPUINFO_INT_REGISTER + I8086_VECTOR:      info->i = cpustate->int_vector;               break;
439
440539      /* --- the following bits of info are returned as pointers to data or functions --- */
441      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8086);         break;
442      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8086);            break;
443      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(i8086);            break;
444      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(i8086);            break;
445      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i8086);         break;
446      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
447      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8086);         break;
448      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
540      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8086);         break;
541      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8086);               break;
542      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(i8086);            break;
543      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(i8086);               break;
544      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i8086);         break;
545      case CPUINFO_FCT_BURN:                     info->burn = NULL;                           break;
546      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8086);   break;
547      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;               break;
548      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &cpustate->state;            break;
549      case CPUINFO_FCT_IMPORT_STATE:               info->import_state = CPU_IMPORT_STATE_NAME(i8086);   break;
550      case CPUINFO_FCT_EXPORT_STATE:               info->export_state = CPU_EXPORT_STATE_NAME(i8086);   break;
551      case CPUINFO_FCT_EXPORT_STRING:               info->export_string = CPU_EXPORT_STRING_NAME(i8086);break;
449552
450553      /* --- the following bits of info are returned as NULL-terminated strings --- */
451554      case CPUINFO_STR_NAME:                     strcpy(info->s, "8086");            break;
r3957r3958
474577               cpustate->flags & 0x0002 ? 'N' : '.',
475578               cpustate->flags & 0x0001 ? 'C' : '.');
476579         break;
477
478      case CPUINFO_STR_REGISTER + I8086_PC:          sprintf(info->s, "PC:%04X", cpustate->pc); break;
479      case CPUINFO_STR_REGISTER + I8086_IP:          sprintf(info->s, "IP: %04X", cpustate->pc - cpustate->base[CS]); break;
480      case CPUINFO_STR_REGISTER + I8086_SP:          sprintf(info->s, "SP: %04X", cpustate->regs.w[SP]); break;
481      case CPUINFO_STR_REGISTER + I8086_FLAGS:      sprintf(info->s, "F:%04X", cpustate->flags); break;
482      case CPUINFO_STR_REGISTER + I8086_AX:          sprintf(info->s, "AX:%04X", cpustate->regs.w[AX]); break;
483      case CPUINFO_STR_REGISTER + I8086_CX:          sprintf(info->s, "CX:%04X", cpustate->regs.w[CX]); break;
484      case CPUINFO_STR_REGISTER + I8086_DX:          sprintf(info->s, "DX:%04X", cpustate->regs.w[DX]); break;
485      case CPUINFO_STR_REGISTER + I8086_BX:          sprintf(info->s, "BX:%04X", cpustate->regs.w[BX]); break;
486      case CPUINFO_STR_REGISTER + I8086_BP:          sprintf(info->s, "BP:%04X", cpustate->regs.w[BP]); break;
487      case CPUINFO_STR_REGISTER + I8086_SI:          sprintf(info->s, "SI: %04X", cpustate->regs.w[SI]); break;
488      case CPUINFO_STR_REGISTER + I8086_DI:          sprintf(info->s, "DI: %04X", cpustate->regs.w[DI]); break;
489      case CPUINFO_STR_REGISTER + I8086_ES:          sprintf(info->s, "ES:%04X", cpustate->sregs[ES]); break;
490      case CPUINFO_STR_REGISTER + I8086_CS:          sprintf(info->s, "CS:%04X", cpustate->sregs[CS]); break;
491      case CPUINFO_STR_REGISTER + I8086_SS:          sprintf(info->s, "SS:%04X", cpustate->sregs[SS]); break;
492      case CPUINFO_STR_REGISTER + I8086_DS:          sprintf(info->s, "DS:%04X", cpustate->sregs[DS]); break;
493      case CPUINFO_STR_REGISTER + I8086_VECTOR:      sprintf(info->s, "V:%02X", cpustate->int_vector); break;
494580   }
495581}
496582
r3957r3958
505591   switch (state)
506592   {
507593      /* --- the following bits of info are returned as 64-bit signed integers --- */
508      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
509      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
594      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
595      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
510596
511597      /* --- the following bits of info are returned as pointers to data or functions --- */
512      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8088);      break;
598      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8088);      break;
513599
514600      /* --- the following bits of info are returned as NULL-terminated strings --- */
515601      case CPUINFO_STR_NAME:                     strcpy(info->s, "8088");            break;
r3957r3958
534620      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 2;                     break;
535621
536622      /* --- the following bits of info are returned as pointers to data or functions --- */
537      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80186);break;
623      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80186);break;
538624
539625      /* --- the following bits of info are returned as NULL-terminated strings --- */
540626      case CPUINFO_STR_NAME:                     strcpy(info->s, "80186");            break;
r3957r3958
555641   switch (state)
556642   {
557643      /* --- the following bits of info are returned as 64-bit signed integers --- */
558      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
559      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
644      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
645      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
560646
561647      /* --- the following bits of info are returned as pointers to data or functions --- */
562      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8088);      break;
563      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80186);break;
648      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8088);      break;
649      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80186);break;
564650
565651      /* --- the following bits of info are returned as NULL-terminated strings --- */
566652      case CPUINFO_STR_NAME:                     strcpy(info->s, "80188");            break;
src/emu/cpu/i86/i86.h
r3957r3958
1/****************************************************************************/
2/*            real mode i286 emulator by Fabrice Frances                    */
3/*           (initial work based on David Hedley's pcemu)                   */
4/*                                                                          */
5/****************************************************************************/
1/* ASG 971222 -- rewrote this interface */
62#pragma once
73
8#ifndef __I86_H__
9#define __I86_H__
4#ifndef __I86INTF_H__
5#define __I86INTF_H__
106
11#define I8086_NMI_INT_VECTOR 2
7#include "cpuintrf.h"
8
129#define INPUT_LINE_TEST 20    /* PJB 03/05 */
1310
14typedef enum { ES, CS, SS, DS } SREGS;
15typedef enum { AX, CX, DX, BX, SP, BP, SI, DI } WREGS;
11enum
12{
13   I8086_IP,
14   I8086_AX,
15   I8086_CX,
16   I8086_DX,
17   I8086_BX,
18   I8086_SP,
19   I8086_BP,
20   I8086_SI,
21   I8086_DI,
22   I8086_AL,
23   I8086_CL,
24   I8086_DL,
25   I8086_BL,
26   I8086_AH,
27   I8086_CH,
28   I8086_DH,
29   I8086_BH,
30   I8086_FLAGS,
31   I8086_ES,
32   I8086_CS,
33   I8086_SS,
34   I8086_DS,
35   I8086_VECTOR,
1636
17#ifndef FALSE
18#define FALSE 0
19#define TRUE 1
20#endif
37   I8086_GENPC = REG_GENPC,
38   I8086_GENSP = REG_GENSP,
39   I8086_GENPCBASE = REG_GENPCBASE
40};
2141
22#ifdef LSB_FIRST
23typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,SIL,SIH,DIL,DIH } BREGS;
24#else
25typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,SIH,SIL,DIH,DIL } BREGS;
26#endif
42/* Public functions */
43CPU_GET_INFO( i8086 );
44#define CPU_I8086 CPU_GET_INFO_NAME( i8086 )
2745
28/* parameter x = result, y = source 1, z = source 2 */
46CPU_GET_INFO( i8088 );
47#define CPU_I8088 CPU_GET_INFO_NAME( i8088 )
2948
30#define SetTF(x)         (cpustate->TF = (x))
31#define SetIF(x)         (cpustate->IF = (x))
32#define SetDF(x)         (cpustate->DirVal = (x) ? -1 : 1)
49CPU_GET_INFO( i80186 );
50#define CPU_I80186 CPU_GET_INFO_NAME( i80186 )
3351
34#define SetOFW_Add(x,y,z)   (cpustate->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x8000)
35#define SetOFB_Add(x,y,z)   (cpustate->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x80)
36#define SetOFW_Sub(x,y,z)   (cpustate->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x8000)
37#define SetOFB_Sub(x,y,z)   (cpustate->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x80)
52CPU_GET_INFO( i80188 );
53#define CPU_I80188 CPU_GET_INFO_NAME( i80188 )
3854
39#define SetCFB(x)         (cpustate->CarryVal = (x) & 0x100)
40#define SetCFW(x)         (cpustate->CarryVal = (x) & 0x10000)
41#define SetAF(x,y,z)      (cpustate->AuxVal = ((x) ^ ((y) ^ (z))) & 0x10)
42#define SetSF(x)         (cpustate->SignVal = (x))
43#define SetZF(x)         (cpustate->ZeroVal = (x))
44#define SetPF(x)         (cpustate->ParityVal = (x))
45
46#define SetSZPF_Byte(x)    (cpustate->ParityVal = cpustate->SignVal = cpustate->ZeroVal = (INT8)(x))
47#define SetSZPF_Word(x)    (cpustate->ParityVal = cpustate->SignVal = cpustate->ZeroVal = (INT16)(x))
48
49#define ADDB(dst,src) { unsigned res=dst+src; SetCFB(res); SetOFB_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
50#define ADDW(dst,src) { unsigned res=dst+src; SetCFW(res); SetOFW_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
51
52#define SUBB(dst,src) { unsigned res=dst-src; SetCFB(res); SetOFB_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
53#define SUBW(dst,src) { unsigned res=dst-src; SetCFW(res); SetOFW_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
54
55#define ORB(dst,src)       dst |= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
56#define ORW(dst,src)       dst |= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
57
58#define ANDB(dst,src)       dst &= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
59#define ANDW(dst,src)       dst &= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
60
61#define XORB(dst,src)       dst ^= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
62#define XORW(dst,src)       dst ^= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
63
64#define CF               (cpustate->CarryVal != 0)
65#define SF               (cpustate->SignVal < 0)
66#define ZF               (cpustate->ZeroVal == 0)
67#define PF               parity_table[cpustate->ParityVal]
68#define AF               (cpustate->AuxVal != 0)
69#define OF               (cpustate->OverVal != 0)
70#define DF               (cpustate->DirVal < 0)
71
72/************************************************************************/
73
74#define read_byte(a)         (*cpustate->mem.rbyte)(cpustate->program, a)
75#define read_word(a)         (*cpustate->mem.rword)(cpustate->program, a)
76#define write_byte(a,d)         (*cpustate->mem.wbyte)(cpustate->program, (a),(d))
77#define write_word(a,d)         (*cpustate->mem.wword)(cpustate->program, (a),(d))
78
79#define read_port_byte(a)      (*cpustate->mem.rbyte)(cpustate->io, a)
80#define read_port_word(a)      (*cpustate->mem.rword)(cpustate->io, a)
81#define write_port_byte(a,d)   (*cpustate->mem.wbyte)(cpustate->io, (a),(d))
82#define write_port_word(a,d)   (*cpustate->mem.wword)(cpustate->io, (a),(d))
83
84/************************************************************************/
85
86#define SegBase(Seg)          (cpustate->sregs[Seg] << 4)
87
88#define DefaultBase(Seg)       ((cpustate->seg_prefix && (Seg == DS || Seg == SS)) ? cpustate->prefix_base : cpustate->base[Seg])
89
90#define GetMemB(Seg,Off)      (read_byte((DefaultBase(Seg) + (Off)) & AMASK))
91#define GetMemW(Seg,Off)      (read_word((DefaultBase(Seg) + (Off)) & AMASK))
92#define PutMemB(Seg,Off,x)      write_byte((DefaultBase(Seg) + (Off)) & AMASK, (x))
93#define PutMemW(Seg,Off,x)      write_word((DefaultBase(Seg) + (Off)) & AMASK, (x))
94
95#define PEEKBYTE(ea)          (read_byte((ea) & AMASK))
96#define ReadByte(ea)          (read_byte((ea) & AMASK))
97#define ReadWord(ea)         (read_word((ea) & AMASK))
98#define WriteByte(ea,val)      write_byte((ea) & AMASK, val);
99#define WriteWord(ea,val)      write_word((ea) & AMASK, val);
100
101#define FETCH_XOR(a)         ((a) ^ cpustate->mem.fetch_xor)
102#define FETCH               (memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc++)))
103#define FETCHOP               (memory_decrypted_read_byte(cpustate->program, FETCH_XOR(cpustate->pc++)))
104#define PEEKOP(addr)         (memory_decrypted_read_byte(cpustate->program, FETCH_XOR(addr)))
105#define FETCHWORD(var)          { var = memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc)); var += (memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc + 1)) << 8); cpustate->pc += 2; }
106#define CHANGE_PC(addr)
107#define PUSH(val)            { cpustate->regs.w[SP] -= 2; WriteWord(((cpustate->base[SS] + cpustate->regs.w[SP]) & AMASK), val); }
108#define POP(var)            { var = ReadWord(((cpustate->base[SS] + cpustate->regs.w[SP]) & AMASK)); cpustate->regs.w[SP] += 2; }
109
110/************************************************************************/
111
112#define CompressFlags() (WORD)(CF | (PF << 2) | (AF << 4) | (ZF << 6) \
113            | (SF << 7) | (cpustate->TF << 8) | (cpustate->IF << 9) \
114            | (DF << 10) | (OF << 11))
115
116#define ExpandFlags(f) \
117{ \
118     cpustate->CarryVal = (f) & 1; \
119     cpustate->ParityVal = !((f) & 4); \
120     cpustate->AuxVal = (f) & 16; \
121     cpustate->ZeroVal = !((f) & 64); \
122     cpustate->SignVal = ((f) & 128) ? -1 : 0; \
123     cpustate->TF = ((f) & 256) >> 8; \
124     cpustate->IF = ((f) & 512) >> 9; \
125     cpustate->DirVal = ((f) & 1024) ? -1 : 1; \
126     cpustate->OverVal = (f) & 2048; \
127}
128
129#endif /* __I86_H__ */
55#endif /* __I86INTF_H__ */
src/emu/cpu/i86/i86priv.h
r0r3958
1/****************************************************************************/
2/*            real mode i286 emulator by Fabrice Frances                    */
3/*           (initial work based on David Hedley's pcemu)                   */
4/*                                                                          */
5/****************************************************************************/
6#pragma once
7
8#ifndef __I86_H__
9#define __I86_H__
10
11#define I8086_NMI_INT_VECTOR 2
12
13typedef enum { ES, CS, SS, DS } SREGS;
14typedef enum { AX, CX, DX, BX, SP, BP, SI, DI } WREGS;
15
16#ifndef FALSE
17#define FALSE 0
18#define TRUE 1
19#endif
20
21#ifdef LSB_FIRST
22typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,SIL,SIH,DIL,DIH } BREGS;
23#else
24typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,SIH,SIL,DIH,DIL } BREGS;
25#endif
26
27/* parameter x = result, y = source 1, z = source 2 */
28
29#define SetTF(x)         (cpustate->TF = (x))
30#define SetIF(x)         (cpustate->IF = (x))
31#define SetDF(x)         (cpustate->DirVal = (x) ? -1 : 1)
32
33#define SetOFW_Add(x,y,z)   (cpustate->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x8000)
34#define SetOFB_Add(x,y,z)   (cpustate->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x80)
35#define SetOFW_Sub(x,y,z)   (cpustate->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x8000)
36#define SetOFB_Sub(x,y,z)   (cpustate->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x80)
37
38#define SetCFB(x)         (cpustate->CarryVal = (x) & 0x100)
39#define SetCFW(x)         (cpustate->CarryVal = (x) & 0x10000)
40#define SetAF(x,y,z)      (cpustate->AuxVal = ((x) ^ ((y) ^ (z))) & 0x10)
41#define SetSF(x)         (cpustate->SignVal = (x))
42#define SetZF(x)         (cpustate->ZeroVal = (x))
43#define SetPF(x)         (cpustate->ParityVal = (x))
44
45#define SetSZPF_Byte(x)    (cpustate->ParityVal = cpustate->SignVal = cpustate->ZeroVal = (INT8)(x))
46#define SetSZPF_Word(x)    (cpustate->ParityVal = cpustate->SignVal = cpustate->ZeroVal = (INT16)(x))
47
48#define ADDB(dst,src) { unsigned res=dst+src; SetCFB(res); SetOFB_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
49#define ADDW(dst,src) { unsigned res=dst+src; SetCFW(res); SetOFW_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
50
51#define SUBB(dst,src) { unsigned res=dst-src; SetCFB(res); SetOFB_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
52#define SUBW(dst,src) { unsigned res=dst-src; SetCFW(res); SetOFW_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
53
54#define ORB(dst,src)       dst |= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
55#define ORW(dst,src)       dst |= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
56
57#define ANDB(dst,src)       dst &= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
58#define ANDW(dst,src)       dst &= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
59
60#define XORB(dst,src)       dst ^= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Byte(dst)
61#define XORW(dst,src)       dst ^= src; cpustate->CarryVal = cpustate->OverVal = cpustate->AuxVal = 0; SetSZPF_Word(dst)
62
63#define CF               (cpustate->CarryVal != 0)
64#define SF               (cpustate->SignVal < 0)
65#define ZF               (cpustate->ZeroVal == 0)
66#define PF               parity_table[cpustate->ParityVal]
67#define AF               (cpustate->AuxVal != 0)
68#define OF               (cpustate->OverVal != 0)
69#define DF               (cpustate->DirVal < 0)
70
71/************************************************************************/
72
73#define read_byte(a)         (*cpustate->mem.rbyte)(cpustate->program, a)
74#define read_word(a)         (*cpustate->mem.rword)(cpustate->program, a)
75#define write_byte(a,d)         (*cpustate->mem.wbyte)(cpustate->program, (a),(d))
76#define write_word(a,d)         (*cpustate->mem.wword)(cpustate->program, (a),(d))
77
78#define read_port_byte(a)      (*cpustate->mem.rbyte)(cpustate->io, a)
79#define read_port_word(a)      (*cpustate->mem.rword)(cpustate->io, a)
80#define write_port_byte(a,d)   (*cpustate->mem.wbyte)(cpustate->io, (a),(d))
81#define write_port_word(a,d)   (*cpustate->mem.wword)(cpustate->io, (a),(d))
82
83/************************************************************************/
84
85#define SegBase(Seg)          (cpustate->sregs[Seg] << 4)
86
87#define DefaultBase(Seg)       ((cpustate->seg_prefix && (Seg == DS || Seg == SS)) ? cpustate->prefix_base : cpustate->base[Seg])
88
89#define GetMemB(Seg,Off)      (read_byte((DefaultBase(Seg) + (Off)) & AMASK))
90#define GetMemW(Seg,Off)      (read_word((DefaultBase(Seg) + (Off)) & AMASK))
91#define PutMemB(Seg,Off,x)      write_byte((DefaultBase(Seg) + (Off)) & AMASK, (x))
92#define PutMemW(Seg,Off,x)      write_word((DefaultBase(Seg) + (Off)) & AMASK, (x))
93
94#define PEEKBYTE(ea)          (read_byte((ea) & AMASK))
95#define ReadByte(ea)          (read_byte((ea) & AMASK))
96#define ReadWord(ea)         (read_word((ea) & AMASK))
97#define WriteByte(ea,val)      write_byte((ea) & AMASK, val);
98#define WriteWord(ea,val)      write_word((ea) & AMASK, val);
99
100#define FETCH_XOR(a)         ((a) ^ cpustate->mem.fetch_xor)
101#define FETCH               (memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc++)))
102#define FETCHOP               (memory_decrypted_read_byte(cpustate->program, FETCH_XOR(cpustate->pc++)))
103#define PEEKOP(addr)         (memory_decrypted_read_byte(cpustate->program, FETCH_XOR(addr)))
104#define FETCHWORD(var)          { var = memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc)); var += (memory_raw_read_byte(cpustate->program, FETCH_XOR(cpustate->pc + 1)) << 8); cpustate->pc += 2; }
105#define CHANGE_PC(addr)
106#define PUSH(val)            { cpustate->regs.w[SP] -= 2; WriteWord(((cpustate->base[SS] + cpustate->regs.w[SP]) & AMASK), val); }
107#define POP(var)            { var = ReadWord(((cpustate->base[SS] + cpustate->regs.w[SP]) & AMASK)); cpustate->regs.w[SP] += 2; }
108
109/************************************************************************/
110
111#define CompressFlags() (WORD)(CF | (PF << 2) | (AF << 4) | (ZF << 6) \
112            | (SF << 7) | (cpustate->TF << 8) | (cpustate->IF << 9) \
113            | (DF << 10) | (OF << 11))
114
115#define ExpandFlags(f) \
116{ \
117     cpustate->CarryVal = (f) & 1; \
118     cpustate->ParityVal = !((f) & 4); \
119     cpustate->AuxVal = (f) & 16; \
120     cpustate->ZeroVal = !((f) & 64); \
121     cpustate->SignVal = ((f) & 128) ? -1 : 0; \
122     cpustate->TF = ((f) & 256) >> 8; \
123     cpustate->IF = ((f) & 512) >> 9; \
124     cpustate->DirVal = ((f) & 1024) ? -1 : 1; \
125     cpustate->OverVal = (f) & 2048; \
126}
127
128#endif /* __I86_H__ */
src/emu/cpu/i86/i286.c
r3957r3958
1616
1717#define INPUT_LINE_A20      1
1818
19#include "i86.h"
20#include "i286intf.h"
19#include "i86priv.h"
20#include "i286.h"
2121
2222
2323#include "i86time.c"
r3957r3958
381381      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
382382      case CPUINFO_INT_MAX_CYCLES:               info->i = 50;                     break;
383383
384      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
385      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
386      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
387      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
388      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
389      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
390      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
391      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
392      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
384      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
385      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
386      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
387      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
388      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
389      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
390      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
391      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
392      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
393393
394394      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_state;               break;
395395      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;               break;
r3957r3958
425425      case CPUINFO_INT_REGISTER + I80286_TR_LIMIT:   info->i = cpustate->tr.limit;               break;
426426
427427      /* --- the following bits of info are returned as pointers to data or functions --- */
428      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i80286);      break;
429      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80286);            break;
430      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(i80286);            break;
431      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                  break;
432      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80286);         break;
433      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
434      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80286);      break;
428      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i80286);      break;
429      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80286);            break;
430      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(i80286);            break;
431      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                  break;
432      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i80286);         break;
433      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
434      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80286);      break;
435435      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
436436
437437      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/i86/i286.h
r0r3958
1/* ASG 971222 -- rewrote this interface */
2#pragma once
3
4#ifndef __I286INTF_H__
5#define __I286INTF_H__
6
7#include "i86.h"
8
9enum
10{
11   I80286_PC=0,
12   I80286_IP,
13   I80286_AX,
14   I80286_CX,
15   I80286_DX,
16   I80286_BX,
17   I80286_SP,
18   I80286_BP,
19   I80286_SI,
20   I80286_DI,
21   I80286_FLAGS,
22   I80286_ES,
23   I80286_CS,
24   I80286_SS,
25   I80286_DS,
26   I80286_ES_2,
27   I80286_CS_2,
28   I80286_SS_2,
29   I80286_DS_2,
30   I80286_MSW,
31   I80286_GDTR_BASE,
32   I80286_IDTR_BASE,
33   I80286_LDTR_BASE,
34   I80286_TR_BASE,
35   I80286_GDTR_LIMIT,
36   I80286_IDTR_LIMIT,
37   I80286_LDTR_LIMIT,
38   I80286_TR_LIMIT,
39   I80286_VECTOR,
40   I80286_PENDING,
41   I80286_NMI_STATE,
42   I80286_IRQ_STATE
43};
44
45/* Public functions */
46CPU_GET_INFO( i80286 );
47#define CPU_I80286 CPU_GET_INFO_NAME( i80286 )
48
49#endif /* __I286INTF_H__ */
src/emu/cpu/cubeqcpu/cubeqcpu.c
r3957r3958
1212
1313#include "debugger.h"
1414#include "cubeqcpu.h"
15#include "cpuexec.h"
15#include "driver.h"
1616
1717
1818/***************************************************************************
r3957r3958
18641864      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
18651865      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
18661866
1867      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
1868      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 8;               break;
1869      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -3;               break;
1870      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1871      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1872      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1873      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1874      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1875      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1867      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
1868      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 8;               break;
1869      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -3;               break;
1870      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1871      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1872      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1873      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1874      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1875      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
18761876
18771877      case CPUINFO_INT_PC:
18781878      case CPUINFO_INT_REGISTER + CQUESTSND_PC:         info->i = cpustate->pc;            break;
r3957r3958
18801880      case CPUINFO_INT_REGISTER + CQUESTSND_ADRCNTR:      info->i = cpustate->adrcntr;      break;
18811881
18821882      /* --- the following bits of info are returned as pointers to data or functions --- */
1883      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestsnd);      break;
1884      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cquestsnd);         break;
1885      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cquestsnd);         break;
1886      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(cquestsnd);         break;
1887      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestsnd);      break;
1888      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1889      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestsnd);      break;
1883      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestsnd);      break;
1884      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cquestsnd);         break;
1885      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cquestsnd);         break;
1886      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(cquestsnd);         break;
1887      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestsnd);      break;
1888      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1889      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestsnd);      break;
18901890      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
18911891
18921892      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
19821982      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
19831983      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
19841984
1985      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
1986      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 9;               break;
1987      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -3;               break;
1988      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1989      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1990      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1991      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1992      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1993      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1985      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
1986      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 9;               break;
1987      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -3;               break;
1988      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1989      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1990      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1991      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1992      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1993      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
19941994
19951995      case CPUINFO_INT_PC:
19961996      case CPUINFO_INT_REGISTER + CQUESTROT_PC:      info->i = cpustate->pc;               break;
19971997
19981998      /* --- the following bits of info are returned as pointers to data or functions --- */
1999      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestrot);      break;
2000      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cquestrot);         break;
2001      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cquestrot);         break;
2002      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(cquestrot);         break;
2003      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestrot);      break;
2004      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2005      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestrot);      break;
1999      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestrot);      break;
2000      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cquestrot);         break;
2001      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cquestrot);         break;
2002      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(cquestrot);         break;
2003      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestrot);      break;
2004      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2005      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestrot);      break;
20062006      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
20072007
20082008      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
21002100      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
21012101      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
21022102
2103      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
2104      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 8;               break;
2105      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -3;               break;
2106      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2107      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2108      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2109      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
2110      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
2111      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2103      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
2104      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 8;               break;
2105      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -3;               break;
2106      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
2107      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
2108      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
2109      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
2110      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
2111      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
21122112
21132113      case CPUINFO_INT_PC:
21142114      case CPUINFO_INT_REGISTER + CQUESTLIN_FGPC:      info->i = cpustate->pc[cpustate->clkcnt & 3 ? BACKGROUND : FOREGROUND];   break;
21152115
21162116      /* --- the following bits of info are returned as pointers to data or functions --- */
2117      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestlin);      break;
2118      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cquestlin);         break;
2119      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cquestlin);         break;
2120      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(cquestlin);         break;
2121      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestlin);      break;
2122      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2123      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestlin);      break;
2117      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cquestlin);      break;
2118      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cquestlin);         break;
2119      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cquestlin);         break;
2120      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(cquestlin);         break;
2121      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cquestlin);      break;
2122      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2123      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cquestlin);      break;
21242124      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
21252125
21262126      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/cubeqcpu/cubeqcpu.h
r3957r3958
156156UINT8 cubeqcpu_get_ptr_ram_val(const device_config *device, int i);
157157UINT32* cubeqcpu_get_stack_ram(const device_config *device);
158158
159CPU_GET_INFO( cquestsnd );
160CPU_GET_INFO( cquestrot );
161CPU_GET_INFO( cquestlin );
159162
163#define CPU_CQUESTSND CPU_GET_INFO_NAME( cquestsnd )
164#define CPU_CQUESTROT CPU_GET_INFO_NAME( cquestrot )
165#define CPU_CQUESTLIN CPU_GET_INFO_NAME( cquestlin )
166
160167#endif /* _CUBEQCPU_H */
src/emu/cpu/upd7810/upd7810.c
r3957r3958
987987   {
988988      TXD = cpustate->txs & 1;
989989      if (cpustate->config.io_callback)
990         (*cpustate->config.io_callback)(UPD7810_TXD,TXD);
990         (*cpustate->config.io_callback)(cpustate->device,UPD7810_TXD,TXD);
991991      cpustate->txs >>= 1;
992992      cpustate->txcnt--;
993993      if (0 == cpustate->txcnt)
r3957r3958
10861086   if (cpustate->rxcnt > 0)
10871087   {
10881088      if (cpustate->config.io_callback)
1089         RXD = (*cpustate->config.io_callback)(UPD7810_RXD,RXD);
1089         RXD = (*cpustate->config.io_callback)(cpustate->device,UPD7810_RXD,RXD);
10901090      cpustate->rxs = (cpustate->rxs >> 1) | ((UINT16)RXD << 15);
10911091      cpustate->rxcnt--;
10921092      if (0 == cpustate->rxcnt)
r3957r3958
12881288               {
12891289                  TO ^= 1;
12901290                  if (cpustate->config.io_callback)
1291                     (*cpustate->config.io_callback)(UPD7810_TO,TO);
1291                     (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
12921292               }
12931293               /* timer 1 chained with timer 0 ? */
12941294               if ((TMM & 0xe0) == 0x60)
r3957r3958
13031303                     {
13041304                        TO ^= 1;
13051305                        if (cpustate->config.io_callback)
1306                           (*cpustate->config.io_callback)(UPD7810_TO,TO);
1306                           (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
13071307                     }
13081308                  }
13091309               }
r3957r3958
13251325               {
13261326                  TO ^= 1;
13271327                  if (cpustate->config.io_callback)
1328                     (*cpustate->config.io_callback)(UPD7810_TO,TO);
1328                     (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
13291329               }
13301330               /* timer 1 chained with timer 0 ? */
13311331               if ((TMM & 0xe0) == 0x60)
r3957r3958
13401340                     {
13411341                        TO ^= 1;
13421342                        if (cpustate->config.io_callback)
1343                           (*cpustate->config.io_callback)(UPD7810_TO,TO);
1343                           (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
13441344                     }
13451345                  }
13461346               }
r3957r3958
13761376               {
13771377                  TO ^= 1;
13781378                  if (cpustate->config.io_callback)
1379                     (*cpustate->config.io_callback)(UPD7810_TO,TO);
1379                     (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
13801380               }
13811381            }
13821382         }
r3957r3958
13961396               {
13971397                  TO ^= 1;
13981398                  if (cpustate->config.io_callback)
1399                     (*cpustate->config.io_callback)(UPD7810_TO,TO);
1399                     (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
14001400               }
14011401            }
14021402         }
r3957r3958
14171417      {
14181418         TO ^= 1;
14191419         if (cpustate->config.io_callback)
1420            (*cpustate->config.io_callback)(UPD7810_TO,TO);
1420            (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
14211421         OVCF -= 3;
14221422      }
14231423   }
r3957r3958
16091609         if (0x00 == (TMM & 0x03)) {
16101610            TO ^= 1;
16111611            if (cpustate->config.io_callback)
1612               (*cpustate->config.io_callback)(UPD7810_TO,TO);
1612               (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
16131613         }
16141614
16151615         while ( cpustate->ovc0 <= 0 ) {
r3957r3958
20162016      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
20172017      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
20182018
2019      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
2020      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
2021      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2022      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2023      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2024      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2025      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
2026      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;               break;
2027      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2019      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
2020      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
2021      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
2022      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
2023      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
2024      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
2025      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
2026      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 8;               break;
2027      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
20282028
20292029      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = (IRR & INTNMI) ? ASSERT_LINE : CLEAR_LINE; break;
20302030      case CPUINFO_INT_INPUT_STATE + UPD7810_INTF1:   info->i = (IRR & INTF1) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
20872087      case CPUINFO_INT_REGISTER + UPD7810_CO1:      info->i = CO1;                     break;
20882088
20892089      /* --- the following bits of info are returned as pointers to data or functions --- */
2090      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(upd7810);      break;
2091      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(upd7810);            break;
2092      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(upd7810);         break;
2093      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(upd7810);            break;
2094      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(upd7810);      break;
2095      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2096      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7810);      break;
2090      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(upd7810);      break;
2091      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(upd7810);            break;
2092      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(upd7810);         break;
2093      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(upd7810);            break;
2094      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(upd7810);      break;
2095      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2096      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7810);      break;
20972097      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
20982098
20992099      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
21782178   switch (state)
21792179   {
21802180      /* --- the following bits of info are returned as pointers to data or functions --- */
2181      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(upd7807);         break;
2182      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7807);      break;
2181      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(upd7807);         break;
2182      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7807);      break;
21832183
21842184      /* --- the following bits of info are returned as NULL-terminated strings --- */
21852185      case CPUINFO_STR_NAME:                     strcpy(info->s, "uPD7807");            break;
r3957r3958
21902190
21912191CPU_GET_INFO( upd7801 ) {
21922192   switch( state ) {
2193      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(upd7801);         break;
2194      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7801);      break;
2193      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(upd7801);         break;
2194      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd7801);      break;
21952195
21962196      case CPUINFO_STR_NAME:                     strcpy(info->s, "uPD7801");            break;
21972197
r3957r3958
22032203   switch ( state ) {
22042204      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
22052205
2206      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(upd78c05);         break;
2207      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd78c05);      break;
2206      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(upd78c05);         break;
2207      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(upd78c05);      break;
22082208
22092209      case CPUINFO_STR_NAME:                     strcpy(info->s, "uPD78C05");         break;
22102210
r3957r3958
22482248
22492249CPU_GET_INFO( upd78c06 ) {
22502250   switch ( state ) {
2251      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(upd78c06);         break;
2251      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(upd78c06);         break;
22522252
22532253      case CPUINFO_STR_NAME:                     strcpy(info->s, "uPD78C06");         break;
22542254
src/emu/cpu/upd7810/upd7810.h
r3957r3958
3131 * It will be called whenever an output signal changes or a new
3232 * input line state is to be sampled.
3333 */
34typedef int (*upd7810_io_callback)(int ioline, int state);
34typedef int (*upd7810_io_callback)(const device_config *device, int ioline, int state);
3535
3636// use it as reset parameter in the Machine struct
3737typedef struct {
r3957r3958
7777CPU_GET_INFO( upd78c05 );
7878CPU_GET_INFO( upd78c06 );
7979
80#define CPU_UPD7810 CPU_GET_INFO_NAME( upd7810 )
81#define CPU_UPD7807 CPU_GET_INFO_NAME( upd7807 )
82#define CPU_UPD7801 CPU_GET_INFO_NAME( upd7801 )
83#define CPU_UPD78C05 CPU_GET_INFO_NAME( upd78c05 )
84#define CPU_UPD78C06 CPU_GET_INFO_NAME( upd78c06 )
85
8086CPU_DISASSEMBLE( upd7810 );
8187CPU_DISASSEMBLE( upd7807 );
8288CPU_DISASSEMBLE( upd7801 );
src/emu/cpu/sc61860/sc61860.h
r3957r3958
5757UINT8 *sc61860_internal_ram(const device_config *device);
5858
5959CPU_GET_INFO( sc61860 );
60#define CPU_SC61860 CPU_GET_INFO_NAME( sc61860 )
6061
6162#endif /* __SC61860_H__ */
src/emu/cpu/sc61860/sc61860.c
r3957r3958
179179      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
180180      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
181181
182      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
183      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
184      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
185      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
186      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
187      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
188      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
189      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
190      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
182      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
183      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
184      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
185      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
186      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
187      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
188      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
189      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
190      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
191191
192192      case CPUINFO_INT_PREVIOUSPC:               info->i = cpustate->oldpc;                  break;
193193
r3957r3958
202202      case CPUINFO_INT_REGISTER + SC61860_ZERO:         info->i =  cpustate->zero;               break;
203203
204204      /* --- the following bits of info are returned as pointers to data or functions --- */
205      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sc61860);            break;
206      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(sc61860);                  break;
207      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(sc61860);               break;
208      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sc61860);            break;
209      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
210      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sc61860);            break;
205      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sc61860);            break;
206      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(sc61860);                  break;
207      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(sc61860);               break;
208      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sc61860);            break;
209      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
210      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sc61860);            break;
211211      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;               break;
212212
213213      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/minx/minx.h
r3957r3958
1515        MINX_XI, MINX_YI,
1616};
1717
18CPU_GET_INFO( minx );
19#define CPU_MINX CPU_GET_INFO_NAME( minx )
20
1821extern CPU_DISASSEMBLE( minx );
1922
2023#endif /* __MINX_H__ */
src/emu/cpu/minx/minx.c
r3957r3958
214214{
215215   switch( regnum )
216216   {
217   case REG_PC:   return GET_MINX_PC;
217   case REG_GENPC:   return GET_MINX_PC;
218218   case MINX_PC:   return regs.PC;
219   case REG_SP:
219   case REG_GENSP:
220220   case MINX_SP:   return regs.SP;
221221   case MINX_BA:   return regs.BA;
222222   case MINX_HL:   return regs.HL;
r3957r3958
239239{
240240   switch( regnum )
241241   {
242   case REG_PC:   break;
242   case REG_GENPC:   break;
243243   case MINX_PC:   regs.PC = val; break;
244   case REG_SP:
244   case REG_GENSP:
245245   case MINX_SP:   regs.SP = val; break;
246246   case MINX_BA:   regs.BA = val; break;
247247   case MINX_HL:   regs.HL = val; break;
r3957r3958
312312   case CPUINFO_INT_MAX_INSTRUCTION_BYTES:                  info->i = 5; break;
313313   case CPUINFO_INT_MIN_CYCLES:                        info->i = 1; break;
314314   case CPUINFO_INT_MAX_CYCLES:                        info->i = 4; break;
315   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:      info->i = 8; break;
316   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:      info->i = 24; break;
317   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:      info->i = 0; break;
318   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:      info->i = 0; break;
319   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:      info->i = 0; break;
320   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:      info->i = 0; break;
321   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:         info->i = 0; break;
322   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:         info->i = 0; break;
323   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:         info->i = 0; break;
315   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:      info->i = 8; break;
316   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:      info->i = 24; break;
317   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:      info->i = 0; break;
318   case CPUINFO_INT_DATABUS_WIDTH_DATA:      info->i = 0; break;
319   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:      info->i = 0; break;
320   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:      info->i = 0; break;
321   case CPUINFO_INT_DATABUS_WIDTH_IO:         info->i = 0; break;
322   case CPUINFO_INT_ADDRBUS_WIDTH_IO:         info->i = 0; break;
323   case CPUINFO_INT_ADDRBUS_SHIFT_IO:         info->i = 0; break;
324324   case CPUINFO_INT_INPUT_STATE + 0:                     info->i = 0; break;
325   case CPUINFO_INT_REGISTER + REG_PC:                     info->i = GET_MINX_PC; break;
326   case CPUINFO_INT_REGISTER + REG_SP:
325   case CPUINFO_INT_REGISTER + REG_GENPC:                     info->i = GET_MINX_PC; break;
326   case CPUINFO_INT_REGISTER + REG_GENSP:
327327   case CPUINFO_INT_REGISTER + MINX_PC:
328328   case CPUINFO_INT_REGISTER + MINX_SP:
329329   case CPUINFO_INT_REGISTER + MINX_BA:
r3957r3958
339339   case CPUINFO_INT_REGISTER + MINX_XI:
340340   case CPUINFO_INT_REGISTER + MINX_YI:                  info->i = minx_get_reg( state - CPUINFO_INT_REGISTER ); break;
341341   case CPUINFO_INT_PREVIOUSPC:                        info->i = 0x0000; break;
342   case CPUINFO_PTR_SET_INFO:                           info->setinfo = CPU_SET_INFO_NAME(minx); break;
343   case CPUINFO_PTR_INIT:                              info->init = CPU_INIT_NAME(minx); break;
344   case CPUINFO_PTR_RESET:                              info->reset = CPU_RESET_NAME(minx); break;
345   case CPUINFO_PTR_EXIT:                              info->exit = CPU_EXIT_NAME(minx); break;
346   case CPUINFO_PTR_EXECUTE:                           info->execute = CPU_EXECUTE_NAME(minx); break;
347   case CPUINFO_PTR_BURN:                              info->burn = CPU_BURN_NAME(minx); break;
348   case CPUINFO_PTR_DISASSEMBLE:                        info->disassemble = CPU_DISASSEMBLE_NAME(minx); break;
342   case CPUINFO_FCT_SET_INFO:                           info->setinfo = CPU_SET_INFO_NAME(minx); break;
343   case CPUINFO_FCT_INIT:                              info->init = CPU_INIT_NAME(minx); break;
344   case CPUINFO_FCT_RESET:                              info->reset = CPU_RESET_NAME(minx); break;
345   case CPUINFO_FCT_EXIT:                              info->exit = CPU_EXIT_NAME(minx); break;
346   case CPUINFO_FCT_EXECUTE:                           info->execute = CPU_EXECUTE_NAME(minx); break;
347   case CPUINFO_FCT_BURN:                              info->burn = CPU_BURN_NAME(minx); break;
348   case CPUINFO_FCT_DISASSEMBLE:                        info->disassemble = CPU_DISASSEMBLE_NAME(minx); break;
349349   case CPUINFO_PTR_INSTRUCTION_COUNTER:                  info->icount = &minx_icount; break;
350350   case CPUINFO_STR_NAME:                              strcpy( info->s, "Minx" ); break;
351351   case CPUINFO_STR_CORE_FAMILY:                        strcpy( info->s, "Nintendo Minx" ); break;
src/emu/cpu/v60/v60.c
r3957r3958
578578      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
579579      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
580580
581      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
582      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
583      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
584      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
585      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
586      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
587      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
588      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 24;               break;
589      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
581      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
582      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
583      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
584      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
585      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
586      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
587      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
588      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 24;               break;
589      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
590590
591591      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_line;         break;
592592      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_line;         break;
r3957r3958
655655      case CPUINFO_INT_REGISTER + V60_ADTMR1:         info->i = cpustate->ADTMR1;            break;
656656
657657      /* --- the following bits of info are returned as pointers to data or functions --- */
658      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(v60);         break;
659      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v60);            break;
660      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(v60);            break;
661      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(v60);            break;
662      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(v60);         break;
663      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
664      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v60);   break;
658      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(v60);         break;
659      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v60);            break;
660      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(v60);            break;
661      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(v60);            break;
662      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(v60);         break;
663      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
664      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v60);   break;
665665      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
666666
667667      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
744744   switch (state)
745745   {
746746      /* --- the following bits of info are returned as 64-bit signed integers --- */
747      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
748      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
749      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
747      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
748      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
749      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
750750
751751      /* --- the following bits of info are returned as pointers to data or functions --- */
752      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v70);               break;
753      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v70);         break;
752      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v70);               break;
753      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v70);         break;
754754
755755      /* --- the following bits of info are returned as NULL-terminated strings --- */
756756      case CPUINFO_STR_NAME:                     strcpy(info->s, "V70");               break;
src/emu/cpu/v60/v60.h
r3957r3958
8383
8484#if HAS_V60
8585CPU_GET_INFO( v60 );
86#define CPU_V60 CPU_GET_INFO_NAME( v60 )
8687#endif /* HAS_V60 */
8788
8889#if HAS_V70
8990CPU_GET_INFO( v70 );
91#define CPU_V70 CPU_GET_INFO_NAME( v70 )
9092#endif /* HAS_V70 */
9193
9294#endif /* __V60_H__ */
src/emu/cpu/dsp56k/dsp56k.h
r3957r3958
6666
6767// Needed for MAME
6868extern CPU_GET_INFO( dsp56k );
69#define CPU_DSP56156 CPU_GET_INFO_NAME( dsp56k )
6970
7071
7172/***************************************************************************
src/emu/cpu/dsp56k/dsp56ops.c
r3957r3958
1515//
1616//
1717
18/*
19TODO:
20    - 0x01ee: should this move sign extend?  otherwise the test-against-minus means nothing.
21    - Restore only the proper bits upon loop termination!
22    - BFCLR has some errata in the docs that may need to be applied.
23    - *_bit_set(0) is difficult to read.  maybe make it *_bit_chg(0).
24    - Potentially "better" reporting for unimplemented opcodes.
25*/
26
1827/************************/
1928/* Datatypes and macros */
2029/************************/
r3957r3958
175184static int      decode_cccc_table(dsp56k_core* cpustate, UINT16 cccc);
176185static void      decode_DDDDD_table(dsp56k_core* cpustate, UINT16 DDDDD, typed_pointer* ret);
177186static void      decode_DD_table(dsp56k_core* cpustate, UINT16 DD, typed_pointer* ret);
187static void      decode_DDF_table(dsp56k_core* cpustate, UINT16 DD, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
178188static void      decode_F_table(dsp56k_core* cpustate, UINT16 F, typed_pointer* ret);
179189static void      decode_h0hF_table(dsp56k_core* cpustate, UINT16 h0h, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret);
180190static void      decode_HH_table(dsp56k_core* cpustate, UINT16 HH, typed_pointer* ret);
r3957r3958
11251135      case DT_LONG_WORD:   useVal = (UINT64)*((UINT64*)S.addr);       break;
11261136   }
11271137
1128   /* TODO: Verify : Sign-extend everyone for proper add/sub op */
1129   if (useVal &  U64(0x0000000080000000))
1130      useVal |= U64(0xffffffff00000000);
1138   /* Sign-extend word for proper add/sub op */
1139   if ((S.data_type == DT_WORD) && useVal & U64(0x0000000080000000))
1140      useVal |= U64(0x000000ff00000000);
11311141
11321142   /* Operate*/
11331143   if (op_type == OP_ADD)
r3957r3958
11411151   /* S L E U N Z V C */
11421152   /* * * * * * * * * */
11431153   /* TODO S, L, E, U, V, C */
1144   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1);
1145   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1);
1154   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1155   if (*((UINT64*)D.addr) == 0)                 Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
11461156
11471157   cycles += 2;      /* TODO: + mv oscillator cycles */
11481158   return 1;
r3957r3958
11921202   /* S L E U N Z V C */
11931203   /* * * * * * * * - */
11941204   /* TODO: S, L, E, V */
1195   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
1196   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
1205   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1206   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
11971207
11981208   cycles += 2;      /* TODO: +mv oscillator cycles */
11991209   return 1;
r3957r3958
12461256   /* S L E U N Z V C */
12471257   /* * * * * * * * - */
12481258   /* TODO: S, L, E, V */
1249   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
1250   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
1259   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1260   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
12511261
12521262   cycles += 2;      /* TODO: +mv oscillator cycles */
12531263   return 1;
r3957r3958
13341344      case DT_LONG_WORD:   addVal = (UINT64)*((UINT64*)S.addr);       break;
13351345   }
13361346
1337   /* TODO: Verify : Sign-extend everyone for proper addition op */
1338   if (addVal &  U64(0x0000000080000000))
1339      addVal |= U64(0xffffffff00000000);
1347   /* Sign-extend word for proper add/sub op */
1348   if ((S.data_type == DT_WORD) && addVal & U64(0x0000000080000000))
1349      addVal |= U64(0x000000ff00000000);
13401350
13411351   /* Operate*/
13421352   *((UINT64*)D.addr) += addVal;
r3957r3958
13471357   /* S L E U N Z V C */
13481358   /* * * * * * * * * */
13491359   /* TODO S, L, E, U, V, C */
1350   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1);
1351   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1);
1360   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1361   if (*((UINT64*)D.addr) == 0)                 Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
13521362
13531363   cycles += 2;      /* TODO: + mv oscillator cycles */
13541364   return 1;
r3957r3958
13951405/* RND : .... .... 0010 F000 : A-188 */
13961406static size_t dsp56k_op_rnd(dsp56k_core* cpustate, const UINT16 op_byte, typed_pointer* d_register, UINT64* p_accum, UINT8* cycles)
13971407{
1408   typed_pointer D = {NULL, DT_BYTE};
1409
1410   decode_F_table(cpustate, BITS(op_byte,0x0008), &D);
1411
1412   *p_accum = *((UINT64*)D.addr);
1413
1414   /* WARNING : ROUNDING NOT FULLY IMPLEMENTED YET! */
1415   if ((*((UINT64*)D.addr) & U64(0x000000000000ffff)) >= 0x8000)
1416      *((UINT64*)D.addr) += U64(0x0000000000010000);
1417
1418   *((UINT64*)D.addr) = *((UINT64*)D.addr) & U64(0x000000ffffff0000);
1419
1420   d_register->addr = D.addr;
1421   d_register->data_type = D.data_type;
1422
13981423   /* S L E U N Z V C */
13991424   /* * * * * * * * - */
1400   return 0;
1425   /* TODO: S, L, E, U, V */
1426   if ((*((UINT64*)D.addr)) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1427   if ((*((UINT64*)D.addr)) == 0)                      Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
1428
1429   cycles += 2;      /* TODO: + mv oscillator clock cycles */
1430   return 1;
14011431}
14021432
14031433/* TST : .... .... 0010 F001 : A-218 */
r3957r3958
14451475   /* S L E U N Z V C */
14461476   /* * * * * * * * * */
14471477   /* TODO: S, L, E, U, V, C */
1448   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1);
1449   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1);
1478   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1479   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
14501480
14511481   cycles += 2;   /* TODO: +mv oscillator cycles */
14521482   return 1;
r3957r3958
14781508   /* S L E U N Z V C */
14791509   /* * * * * * ? * * */
14801510   /* TODO: S, L, E, U, V, C */
1481   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1);
1482   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1);
1511   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1512   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
14831513
14841514   cycles += 2;      /* TODO: + mv oscillator clock cycles */
14851515   return 1;
r3957r3958
15361566   /* S L E U N Z V C */
15371567   /* * * * * * * 0 ? */
15381568   /* TODO: S, L, E, U */
1539   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1);
1540   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1);
1569   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1570   if (*((UINT64*)D.addr) == 0)                 Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
15411571   V_bit_set(cpustate, 0);
1542   if (*p_accum & U64(0x0000000000000001)) C_bit_set(cpustate, 1);
1572   if (*p_accum & U64(0x0000000000000001))          C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
15431573
15441574   cycles += 2;      /* TODO: + mv oscillator cycles */
15451575   return 1;
r3957r3958
15771607   /* * * - - ? ? 0 ? */
15781608   /* TODO: S, L */
15791609   N_bit_set(cpustate, 0);
1580   if (((PAIR64*)D.addr)->w.h == 0) Z_bit_set(cpustate, 1);
1610   if (((PAIR64*)D.addr)->w.h == 0)      Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
15811611   V_bit_set(cpustate, 0);
1582   if (*p_accum & U64(0x0000000000010000)) C_bit_set(cpustate, 1);
1612   if (*p_accum & U64(0x0000000000010000))   C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
15831613
15841614   cycles += 2;      /* TODO: + mv oscillator cycles */
15851615   return 1;
r3957r3958
16561686
16571687   switch(S.data_type)
16581688   {
1659      case DT_WORD:        cmpVal = (UINT64)*((UINT16*)S.addr);  break;
1689      case DT_WORD:        cmpVal = (UINT64)*((UINT16*)S.addr) << 16;  break;
16601690      case DT_DOUBLE_WORD: cmpVal = (UINT64)*((UINT32*)S.addr);  break;
16611691      case DT_LONG_WORD:   cmpVal = (UINT64)*((UINT64*)S.addr);  break;
16621692   }
16631693
1694   /* Sign-extend word for proper subtraction op */
1695   if ((S.data_type == DT_WORD) && cmpVal & U64(0x0000000080000000))
1696      cmpVal |= U64(0x000000ff00000000);
1697
1698   /* Make sure they're both real 40-bit values */
1699   cmpVal &= U64(0x000000ffffffffff);
1700   *((UINT64*)D.addr) &= U64(0x000000ffffffffff);
1701
1702   /* Operate */
16641703   result = *((UINT64*)D.addr) - cmpVal;
16651704
16661705   d_register->addr = D.addr;
r3957r3958
16691708   /* S L E U N Z V C */
16701709   /* * * * * * * * * */
16711710   /* TODO: S, L, E, U, N, V, C */
1672   if (result == 0) Z_bit_set(cpustate, 1);      /* TODO: Do you clear it if this isn't true? */
1711   if (result == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
16731712
16741713
16751714   cycles += 2;      /* TODO: + mv oscillator clock cycles */
r3957r3958
17011740   /* S L E U N Z V C */
17021741   /* * * - - ? ? 0 - */
17031742   /* TODO: S?, L */
1704   if ( *((UINT64*)D.addr) & U64(0x0000000080000000))       N_bit_set(cpustate, 1);
1705   if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(cpustate, 1);
1743   if ( *((UINT64*)D.addr) & U64(0x0000000080000000))       N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1744   if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
17061745   V_bit_set(cpustate, 0);
17071746
17081747   cycles += 2;      /* TODO: + mv oscillator cycles */
r3957r3958
17431782   /* S L E U N Z V C */
17441783   /* * * * * * ? * * */
17451784   /* TODO: S, L, E, U, V, C */
1746   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1);
1747   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1);
1785   if ( *((UINT64*)D.addr) & U64(0x0000008000000000))       N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1786   if ((*((UINT64*)D.addr) & U64(0x000000ffffff0000)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
17481787
17491788   cycles += 2;      /* TODO: + mv oscillator clock cycles */
17501789   return 1;
r3957r3958
17701809   /* S L E U N Z V C */
17711810   /* * * - - ? ? 0 - */
17721811   /* TODO: S, L */
1773   if ( *((UINT64*)D.addr) & U64(0x0000000080000000))       N_bit_set(cpustate, 1);
1774   if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(cpustate, 1);
1812   if ( *((UINT64*)D.addr) & U64(0x0000000080000000))       N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1813   if ((*((UINT64*)D.addr) & U64(0x00000000ffff0000)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
17751814   V_bit_set(cpustate, 0);
17761815
17771816   cycles += 2;      /* TODO: + mv oscillator cycles */
r3957r3958
18611900   /* S L E U N Z V C */
18621901   /* * * * * * * * * */
18631902   /* TODO: S, L, E, U, V, C */
1864   if ( (absResult) & U64(0x0000008000000000))        N_bit_set(cpustate, 1);  else N_bit_set(cpustate, 0);
1865   if (((absResult) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);  else Z_bit_set(cpustate, 0);
1903   if ( (absResult) & U64(0x0000008000000000))        N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1904   if (((absResult) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
18661905
18671906   cycles += 2;      /* TODO: +mv oscillator cycles */
18681907   return 1;
r3957r3958
19011940   /* S L E U N Z V C */
19021941   /* * * * * * * * - */
19031942   /* TODO: S, L, E, V */
1904   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
1905   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
1943   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
1944   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
19061945
19071946   cycles += 2;      /* TODO: +mv oscillator cycles */
19081947   return 1;
r3957r3958
19672006   /* S L E U N Z V C */
19682007   /* * * * * * * * - */
19692008   /* TODO: S, L, E, V */
1970   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
1971   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
2009   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2010   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
19722011
19732012   cycles += 2;      /* TODO: +mv oscillator cycles */
19742013   return 1;
r3957r3958
20152054
20162055   /* Round the result */
20172056   /* WARNING : ROUNDING NOT FULLY IMPLEMENTED YET! */
2057   if ((opD & U64(0x000000000000ffff)) >= 0x8000)
2058      opD += U64(0x0000000000010000);
2059
20182060   opD &= U64(0x000000ffffff0000);
20192061
20202062   /* And out the bits that don't live in the register */
r3957r3958
20302072   /* S L E U N Z V C */
20312073   /* * * * * * * * - */
20322074   /* TODO: S, L, E, V */
2033   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
2034   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
2075   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2076   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
20352077
20362078   cycles += 2;      /* TODO: +mv oscillator cycles */
20372079   return 1;
r3957r3958
21012143           not the same. */
21022144   /* C - Set if bit 36 of source operand is set. Cleared otherwise. */
21032145   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2104   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
2146   if (*((UINT64*)D.addr) == 0)                  Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
21052147   if ( (*((UINT64*)D.addr) & U64(0x000000ff00000000)) != (p_accum & U64(0x000000ff00000000)) ) V_bit_set(cpustate, 1); else V_bit_set(cpustate, 0);
2106   if (p_accum & U64(0x0000001000000000)) C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
2148   if (p_accum & U64(0x0000001000000000))            C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
21072149
21082150   cycles += 2;
21092151   return 1;
r3957r3958
21322174   /* TODO: E, U  */
21332175   /* C - Set if bit 3 of source operand is set. Cleared otherwise. */
21342176   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2135   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
2177   if (*((UINT64*)D.addr) == 0)                  Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
21362178   V_bit_set(cpustate, 0);
2137   if (p_accum & U64(0x0000000000000008)) C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
2179   if (p_accum & U64(0x0000000000000008))          C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
21382180
21392181   cycles += 2;
21402182   return 1;
r3957r3958
21612203   /* - * * * * * 0 ? */
21622204   /* TODO: E, U */
21632205   if (*((UINT64*)D.addr) & U64(0x0000008000000000)) N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2164   if (*((UINT64*)D.addr) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
2206   if (*((UINT64*)D.addr) == 0)                Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
21652207   V_bit_set(cpustate, 0);
2166   if (backupVal & U64(0x0000000000008000)) C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
2208   if (backupVal & U64(0x0000000000008000))        C_bit_set(cpustate, 1); else C_bit_set(cpustate, 0);
21672209
21682210   cycles += 2;
21692211   return 1;
r3957r3958
21842226   UINT16 iVal = op2 & 0x00ff;
21852227   decode_BBB_bitmask(cpustate, BITS(op2,0xe000), &iVal);
21862228
2187   workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(OP,0x0020), BITS(OP,0x001f));
2229   workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(op,0x0020), BITS(op,0x001f));
21882230   previousValue = memory_read_word_16le(cpustate->data, WORD(workAddr));
21892231   workingWord = previousValue;
21902232
r3957r3958
25962638/* WARNING : DOCS SAY THERE IS A PARALLEL MOVE HERE !!! */
25972639static size_t dsp56k_op_div(dsp56k_core* cpustate, const UINT16 op, UINT8* cycles)
25982640{
2641   /* WARNING : THIS DOES NOT WORK.  IT DOESN'T EVEN TRY !!! */
2642   typed_pointer S = {NULL, DT_BYTE};
2643   typed_pointer D = {NULL, DT_BYTE};
2644
2645   decode_DDF_table(cpustate, BITS(op,0x0003), BITS(op,0x0008), &S, &D);
2646
25992647   /* S L E U N Z V C */
26002648   /* - * - - - - ? ? */
26012649   /* V - Set if an arithmetic overflow occurs in the 40 bit result. Also set if the most significantst
26022650           bit of the destination operand is changed as a result of the left shift. Cleared otherwise. */
26032651   /* C - Set if bit 39 of the result is cleared. Cleared otherwise. */
2604   return 0;
2652   cycles += 2;
2653   return 1;
26052654}
26062655
26072656/* DMAC : 0001 0101 10s1 FsQQ : A-80 */
26082657static size_t dsp56k_op_dmac(dsp56k_core* cpustate, const UINT16 op, UINT8* cycles)
26092658{
2659   UINT8 ss = 0;
2660   INT64 result = 0;
2661
2662   void* D = NULL;
2663   void* S1 = NULL;
2664   void* S2 = NULL;
2665
2666   decode_QQF_special_table(cpustate, BITS(op,0x0003), BITS(op,0x0008), &S1, &S2, &D);
2667
2668   ss = BITS(op,0x0024);
2669
2670   /* Fixed-point 2's complement multiplication requires a shift */
2671   if (ss == 0x00 || ss == 0x01)
2672   {
2673      /* Signed * Signed */
2674      INT32 s1 = ((INT32)(*((UINT16*)S1)));
2675      INT32 s2 = ((INT32)(*((UINT16*)S2)));
2676      result = ( s1 * s2 ) << 1;
2677   }
2678   else if (ss == 0x2)
2679   {
2680      /* Signed * Unsigned */
2681      /* WARNING : THERE IS A HUGE CHANCE THIS DOESN'T WORK RIGHT */
2682      INT32 s1 = ((INT32)(*((UINT16*)S1)));
2683      INT32 s2 = (UINT32)(*((UINT16*)S2));
2684      result = ( s1 * s2 ) << 1;
2685   }
2686   else if (ss == 0x3)
2687   {
2688      /* Unsigned * Unsigned */
2689      UINT32 s1 = (UINT32)(*((UINT16*)S1));
2690      UINT32 s2 = (UINT32)(*((UINT16*)S2));
2691      result = ( s1 * s2 ) << 1;
2692   }
2693
2694   /* Shift right, then accumulate */
2695   (*((UINT64*)D)) =  (*((UINT64*)D)) >> 16;
2696   (*((UINT64*)D)) += result;
2697
26102698   /* S L E U N Z V C */
26112699   /* - * * * * * * - */
2612   return 0;
2700   /* TODO: L, E, U, V */
2701   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
2702   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
2703
2704   cycles += 2;
2705   return 1;
26132706}
26142707
26152708/* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */
r3957r3958
26232716/* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */
26242717static size_t dsp56k_op_do_1(dsp56k_core* cpustate, const UINT16 op, const UINT16 op2, UINT8* cycles)
26252718{
2719   UINT8 retSize = 0;
26262720   UINT8 iValue = BITS(op,0x00ff);
26272721
26282722   /* Don't execute if the loop counter == 0 */
r3957r3958
26452739      /* Third instruction cycle */
26462740      LF_bit_set(cpustate, 1);
26472741
2742      /* Undocumented, but it must be true to nest Dos in DoForevers */
2743      FV_bit_set(cpustate, 0);
26482744
2745
26492746      /* S L E U N Z V C */
26502747      /* - * - - - - - - */
26512748      /* TODO : L */
26522749
26532750      cycles += 6;   /* TODO: + mv oscillator cycles */
2751      retSize = 2;
26542752   }
26552753   else
26562754   {
2755      /* Skip over the contents of the loop */
2756      cpustate->ppc = PC;
2757      PC = PC + 2 + op2;
2758
26572759      cycles += 10;   /* TODO: + mv oscillator cycles */
2760      retSize = 0;
26582761   }
26592762
2660   return 2;
2763   return retSize;
26612764}
26622765
26632766/* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */
26642767static size_t dsp56k_op_do_2(dsp56k_core* cpustate, const UINT16 op, const UINT16 op2, UINT8* cycles)
26652768{
2769   UINT8 retSize = 0;
26662770   UINT16 lValue = 0x0000;
26672771   typed_pointer S = {NULL, DT_BYTE};
26682772   decode_DDDDD_table(cpustate, BITS(op,0x001f), &S);
r3957r3958
27042808      /* TODO : L */
27052809
27062810      cycles += 6;   /* TODO: + mv oscillator cycles */
2811      retSize = 2;
27072812   }
27082813   else
27092814   {
2815      /* Skip over the contents of the loop */
2816      cpustate->ppc = PC;
2817      PC = PC + 2 + op2;
2818
27102819      cycles += 10;   /* TODO: + mv oscillator cycles */
2820      retSize = 0;
27112821   }
27122822
2713   return 2;
2823   return retSize;
27142824}
27152825
27162826/* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */
r3957r3958
29773087   else
29783088   {
29793089      /* Signed * Unsigned */
2980      /* TODO: THERE IS A HUGE CHANCE THIS DOESN'T WORK RIGHT */
2981      UINT32 s1 = (UINT32)((INT32)(*((UINT16*)S1)));
2982      UINT32 s2 = (UINT32)(*((UINT16*)S2));
3090      /* WARNING : THERE IS A HUGE CHANCE THIS DOESN'T WORK RIGHT */
3091      INT32 s1 = ((INT32)(*((UINT16*)S1)));
3092      INT32 s2 = (UINT32)(*((UINT16*)S2));
29833093      result = ( s1 * s2 ) << 1;
29843094   }
29853095
29863096   (*((UINT64*)D)) += result;
29873097
3098   /* And out the bits that don't live in the register */
3099   (*((UINT64*)D)) &= U64(0x000000ffffffffff);
3100
29883101   /* S L E U N Z V C */
29893102   /* - * * * * * * - */
29903103   /* TODO: L, E, U, V */
2991   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1);
2992   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1);
3104   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
3105   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
29933106
29943107   cycles += 2;
29953108   return 1;
r3957r3958
33833496   pp = op & 0x001f;
33843497   pp = assemble_address_from_IO_short_address(cpustate, pp);
33853498
3386   W = BITS(OP,0x0100);
3499   W = BITS(op,0x0100);
33873500
33883501   /* A little different than most W if's - opposite read and write */
33893502   if (W)
r3957r3958
34033516   }
34043517
34053518   // Postincrement
3406   execute_m_table(cpustate, BITS(OP,0x00c0), BITS(OP,0x0020));
3519   execute_m_table(cpustate, BITS(op,0x00c0), BITS(op,0x0020));
34073520
34083521   /* S L E U N Z V C */
34093522   /* * * - - - - - - */
r3957r3958
34233536/* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */
34243537static size_t dsp56k_op_mpysuuu(dsp56k_core* cpustate, const UINT16 op, UINT8* cycles)
34253538{
3539   UINT8 s = 0;
3540   INT64 result = 0;
3541
3542   void* D = NULL;
3543   void* S1 = NULL;
3544   void* S2 = NULL;
3545
3546   decode_QQF_special_table(cpustate, BITS(op,0x0003), BITS(op,0x0008), &S1, &S2, &D);
3547
3548   s = BITS(op,0x0004);
3549
3550   /* Fixed-point 2's complement multiplication requires a shift */
3551   if (s)
3552   {
3553      /* Unsigned * Unsigned */
3554      UINT32 s1 = (UINT32)(*((UINT16*)S1));
3555      UINT32 s2 = (UINT32)(*((UINT16*)S2));
3556      result = ( s1 * s2 ) << 1;
3557   }
3558   else
3559   {
3560      /* Signed * Unsigned */
3561      /* WARNING : THERE IS A HUGE CHANCE THIS DOESN'T WORK RIGHT */
3562      INT32 s1 = ((INT32)(*((UINT16*)S1)));
3563      INT32 s2 = (UINT32)(*((UINT16*)S2));
3564      result = ( s1 * s2 ) << 1;
3565   }
3566
3567   (*((UINT64*)D)) = result;
3568
3569   /* And out the bits that don't live in the register */
3570   (*((UINT64*)D)) &= U64(0x000000ffffffffff);
3571
34263572   /* S L E U N Z V C */
34273573   /* - * * * * * * - */
3428   return 0;
3574   /* TODO: L, E, U, V */
3575   if ( *((UINT64*)D) & U64(0x0000008000000000))      N_bit_set(cpustate, 1); else N_bit_set(cpustate, 0);
3576   if ((*((UINT64*)D) & U64(0x000000ffffffffff)) == 0) Z_bit_set(cpustate, 1); else Z_bit_set(cpustate, 0);
3577
3578   cycles += 2;
3579   return 1;
34293580}
34303581
34313582/* NEGC : 0001 0101 0110 F000 : A-168 */
r3957r3958
35543705/* RTI : 0000 0000 0000 0111 : A-194 */
35553706static size_t dsp56k_op_rti(dsp56k_core* cpustate, const UINT16 op, UINT8* cycles)
35563707{
3708   /* WARNING : THERE SHOULD BE A MORE GENERAL HANDLING OF STACK ERRORS. */
3709   if (SP == 0)
3710   {
3711      dsp56k_add_pending_interrupt(cpustate, "Stack Error");
3712      return 0;
3713   }
3714
35573715   cpustate->ppc = PC;
35583716   PC = SSH;
35593717
r3957r3958
37863944   }
37873945}
37883946
3947static void decode_DDF_table(dsp56k_core* cpustate, UINT16 DD, UINT16 F, typed_pointer* src_ret, typed_pointer* dst_ret)
3948{
3949   UINT16 switchVal = (DD << 1) | F;
3950
3951   switch (switchVal)
3952   {
3953      case 0x0: src_ret->addr = &X0;  src_ret->data_type = DT_WORD; dst_ret->addr = &A;  dst_ret->data_type = DT_LONG_WORD;  break;
3954      case 0x1: src_ret->addr = &X0;  src_ret->data_type = DT_WORD; dst_ret->addr = &B;  dst_ret->data_type = DT_LONG_WORD;  break;
3955      case 0x2: src_ret->addr = &Y0;  src_ret->data_type = DT_WORD; dst_ret->addr = &A;  dst_ret->data_type = DT_LONG_WORD;  break;
3956      case 0x3: src_ret->addr = &Y0;  src_ret->data_type = DT_WORD; dst_ret->addr = &B;  dst_ret->data_type = DT_LONG_WORD;  break;
3957      case 0x4: src_ret->addr = &X1;  src_ret->data_type = DT_WORD; dst_ret->addr = &A;  dst_ret->data_type = DT_LONG_WORD;  break;
3958      case 0x5: src_ret->addr = &X1;  src_ret->data_type = DT_WORD; dst_ret->addr = &B;  dst_ret->data_type = DT_LONG_WORD;  break;
3959      case 0x6: src_ret->addr = &Y1;  src_ret->data_type = DT_WORD; dst_ret->addr = &A;  dst_ret->data_type = DT_LONG_WORD;  break;
3960      case 0x7: src_ret->addr = &Y1;  src_ret->data_type = DT_WORD; dst_ret->addr = &B;  dst_ret->data_type = DT_LONG_WORD;  break;
3961   }
3962}
3963
37893964static void decode_F_table(dsp56k_core* cpustate, UINT16 F, typed_pointer* ret)
37903965{
37913966   switch(F)
r3957r3958
42504425         if (LC == 1)
42514426         {
42524427            /* End of loop processing */
4253            SR = SSL;   /* TODO: A-83.  I believe only the Loop Flag comes back here. */
4428            SR = SSL;   /* TODO: A-83.  I believe only the Loop Flag comes back here. And maybe the do forever bit too. */
42544429            SP--;
42554430
42564431            LA = SSH;
r3957r3958
45314706         {
45324707            case DT_BYTE:        *((UINT64*)dest.addr) = (*((UINT8*)source.addr)) & 0xff; break;
45334708
4534            case DT_WORD:        destinationValue = (*((INT16*)source.addr)) << 16;         /* Sign extend */
4535                            destinationValue &= U64(0x000000ffffff0000);
4536                            *((UINT64*)dest.addr) = destinationValue; break;         /* Forget not, yon shift register */
4709            case DT_WORD:        destinationValue = (*((UINT16*)source.addr)) << 16;
4710                            if (destinationValue & U64(0x0000000080000000))
4711                               destinationValue |= U64(0x000000ff00000000);
4712                            *((UINT64*)dest.addr) = (UINT64)destinationValue; break;   /* Forget not, yon shift register */
45374713
45384714            case DT_DOUBLE_WORD: *((UINT64*)dest.addr) = (*((UINT32*)source.addr)) & 0xffffffff; break;
45394715            case DT_LONG_WORD:   *((UINT64*)dest.addr) = (*((UINT64*)source.addr)) & U64(0x000000ffffffffff); break;
src/emu/cpu/dsp56k/dsp56dsm.c
r3957r3958
308308      int parallelType = -1;
309309
310310      /* Note: it's important that NPDM comes before RtRDM here */
311      /* No Parallel Data Move : 0100 1010 ---- ---- : A-131 */
311      /* No Parallel Data Move : 0100 1010 .... .... : A-131 */
312312      if ((op & 0xff00) == 0x4a00)
313313      {
314314         op_byte = op & 0x00ff;
315315         parallelType = kNoParallelDataMove;
316316      }
317      /* Register to Register Data Move : 0100 IIII ---- ---- : A-133 */
317      /* Register to Register Data Move : 0100 IIII .... .... : A-133 */
318318      else if ((op & 0xf000) == 0x4000)
319319      {
320320         op_byte = op & 0x00ff;
321321         parallelType = kRegisterToRegister;
322322      }
323      /* Address Register Update : 0011 0zRR ---- ---- : A-135 */
323      /* Address Register Update : 0011 0zRR .... .... : A-135 */
324324      else if ((op & 0xf800) == 0x3000)
325325      {
326326         op_byte = op & 0x00ff;
327327         parallelType = kAddressRegister;
328328      }
329      /* X Memory Data Move : 1mRR HHHW ---- ---- : A-137 */
329      /* X Memory Data Move : 1mRR HHHW .... .... : A-137 */
330330      else if ((op & 0x8000) == 0x8000)
331331      {
332332         op_byte = op & 0x00ff;
333333         parallelType = kXMemoryDataMove;
334334      }
335      /* X Memory Data Move : 0101 HHHW ---- ---- : A-137 */
335      /* X Memory Data Move : 0101 HHHW .... .... : A-137 */
336336      else if ((op & 0xf000) == 0x5000)
337337      {
338338         op_byte = op & 0x00ff;
339339         parallelType = kXMemoryDataMove2;
340340      }
341      /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW ---- ---- : A-139 */
341      /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW .... .... : A-139 */
342342      else if ((op & 0xff00) == 0x0500)
343343      {
344344         /* Now check it against all the other potential collisions */
src/emu/cpu/dsp56k/dsp56pcu.c
r3957r3958
113113}
114114
115115
116static void pcu_init(dsp56k_core* cpustate, int index)
116static void pcu_init(dsp56k_core* cpustate)
117117{
118118   // Init the irq table
119119   dsp56k_irq_table_init();
r3957r3958
142142         //        This, in actuality, is handled with the internal boot ROM.
143143         for (i = 0; i < 0x800; i++)
144144         {
145            UINT32 mem_offset = (0xc0000<<1) + (i<<1);   /* TODO: TEST */
145            UINT32 mem_offset = (0xc000<<1) + (i<<1);   /* TODO: TEST */
146146
147147            // TODO - DO I HAVE TO FLIP THIS WORD?
148148            // P:$c000 -> Internal P:$0000 low byte
src/emu/cpu/dsp56k/dsp56k.c
r3957r3958
3939***************************************************************************/
4040static CPU_RESET( dsp56k );
4141
42
4243/***************************************************************************
4344    ONBOARD MEMORY ALLOCATION
4445***************************************************************************/
46// TODO: Put these in the cpustate!!!
4547static UINT16 *dsp56k_peripheral_ram;
4648static UINT16 *dsp56k_program_ram;
4749
50
4851/***************************************************************************
4952    COMPONENT FUNCTIONALITY
5053***************************************************************************/
r3957r3958
6366// 4-8 Memory handlers for on-chip peripheral memory.
6467#include "dsp56mem.c"
6568
69
6670/***************************************************************************
71    Direct Update Handler
72***************************************************************************/
73static DIRECT_UPDATE_HANDLER( dsp56k_direct_handler )
74{
75   if (address >= (0x0000<<1) && address <= (0x07ff<<1))
76   {
77      direct->raw = direct->decrypted = (void*)(dsp56k_program_ram - (0x0000<<1));
78      return ~0;
79   }
80
81   return address;
82}
83
84
85/***************************************************************************
6786    MEMORY ACCESSORS
6887***************************************************************************/
6988#define ROPCODE(pc)   memory_decrypted_read_word(cpustate->program, pc)
r3957r3958
150169   dsp56k_core* cpustate = device->token;
151170
152171   // Call specific module inits
153   pcu_init(cpustate, index);
154   // agu_init(cpustate, index);
155   // alu_init(cpustate, index);
172   pcu_init(cpustate);
173   // agu_init(cpustate);
174   // alu_init(cpustate);
156175
157176   // HACK - You're not in bootstrap mode upon bootup
158177   cpustate->bootstrap_mode = BOOTSTRAP_OFF;
r3957r3958
172191   cpustate->device = device;
173192   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
174193   cpustate->data = memory_find_address_space(device, ADDRESS_SPACE_DATA);
194
195   /* Setup the direct memory handler for this CPU */
196   /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */
197   memory_set_direct_update_handler(cpustate->program, dsp56k_direct_handler);
175198}
176199
177200static void agu_reset(dsp56k_core* cpustate)
r3957r3958
219242   agu_reset(cpustate);
220243   alu_reset(cpustate);
221244
222   /* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU put in MAME */
245   /* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU locked to the instruction at address 0x0000 */
223246   memory_write_word_16le(cpustate->program, 0x0000, 0x0124);
224247}
225248
r3957r3958
381404      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;   // ?
382405      case CPUINFO_INT_MAX_CYCLES:               info->i = 8;                     break;   // ?
383406
384      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;   // 1-5
385      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;   // 1-5
386      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
387      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;               break;
388      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 16;               break;
389      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;               break;
390      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
391      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
392      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
407      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;   // 1-5
408      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;   // 1-5
409      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
410      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 16;               break;
411      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 16;               break;
412      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -1;               break;
413      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
414      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
415      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
393416
394417      case CPUINFO_INT_INPUT_STATE + DSP56K_IRQ_MODA:         info->i = DSP56K_IRQ_MODA;      break;
395418      case CPUINFO_INT_INPUT_STATE + DSP56K_IRQ_MODB:         info->i = DSP56K_IRQ_MODB;      break;
r3957r3958
451474      case CPUINFO_INT_REGISTER + DSP56K_ST15:      info->i = ST15;                     break;
452475
453476      // --- the following bits of info are returned as pointers to data or functions ---
454      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dsp56k);         break;
455      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(dsp56k);               break;
456      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(dsp56k);            break;
457      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(dsp56k);               break;
458      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dsp56k);         break;
459      case CPUINFO_PTR_BURN:                     info->burn = NULL;                           break;
460      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dsp56k);   break;
461      case CPUINFO_PTR_DEBUG_INIT:               info->debug_init = NULL;            break;
462      case CPUINFO_PTR_TRANSLATE:                  info->translate = NULL;               break;
463      case CPUINFO_PTR_READ:                     info->read = NULL;                  break;
464      case CPUINFO_PTR_WRITE:                     info->write = NULL;                  break;
465      case CPUINFO_PTR_READOP:                  info->readop = NULL;               break;
477      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dsp56k);         break;
478      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(dsp56k);               break;
479      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(dsp56k);            break;
480      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(dsp56k);               break;
481      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dsp56k);         break;
482      case CPUINFO_FCT_BURN:                     info->burn = NULL;                           break;
483      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dsp56k);   break;
484      case CPUINFO_FCT_DEBUG_INIT:               info->debug_init = NULL;            break;
485      case CPUINFO_FCT_TRANSLATE:                  info->translate = NULL;               break;
486      case CPUINFO_FCT_READ:                     info->read = NULL;                  break;
487      case CPUINFO_FCT_WRITE:                     info->write = NULL;                  break;
488      case CPUINFO_FCT_READOP:                  info->readop = NULL;               break;
466489      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
467       case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:
490       case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:
468491          info->internal_map16 = ADDRESS_MAP_NAME(dsp56156_x_data_map);                  break;
469       case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
492       case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
470493          info->internal_map16 = ADDRESS_MAP_NAME(dsp56156_program_map);                  break;
471494
472495      // --- the following bits of info are returned as NULL-terminated strings ---
src/emu/cpu/spc700/spc700.h
r3957r3958
33#ifndef __SPC700_H__
44#define __SPC700_H__
55
6#include "cpuintrf.h"
7
8extern CPU_GET_INFO( spc700 );
9#define CPU_SPC700 CPU_GET_INFO_NAME( spc700 )
10
611/* ======================================================================== */
712/* ============================= Configuration ============================ */
813/* ======================================================================== */
r3957r3958
3136#define SPC700_INT_IRQ         1
3237#define SPC700_INT_NMI         2
3338
34/* CPU Structure */
35typedef struct
36{
37   uint a;      /* Accumulator */
38   uint x;      /* Index Register X */
39   uint y;      /* Index Register Y */
40   uint s;      /* Stack Pointer */
41   uint pc;   /* Program Counter */
42   uint ppc;   /* Previous Program Counter */
43   uint flag_n;   /* Negative Flag */
44   uint flag_z;   /* Zero flag */
45   uint flag_v;   /* Overflow Flag */
46   uint flag_p;   /* Direct Page Flag */
47   uint flag_b;   /* BRK Instruction Flag */
48   uint flag_h;   /* Half-carry Flag */
49   uint flag_i;   /* Interrupt Mask Flag */
50   uint flag_c;   /* Carry Flag */
51   uint line_irq;   /* Status of the IRQ line */
52   uint line_nmi;   /* Status of the NMI line */
53   uint line_rst;   /* Status of the RESET line */
54   uint ir;      /* Instruction Register */
55   cpu_irq_callback int_ack;
56   const device_config *device;
57   const address_space *program;
58   uint stopped;   /* stopped status */
59   int ICount;
60   uint source;
61   uint destination;
62   uint temp1, temp2, temp3;
63   short spc_int16;
64   int spc_int32;
65} spc700i_cpu;
6639
67
6840/* ======================================================================== */
69/* ============================= INTERFACE API ============================ */
70/* ======================================================================== */
71
72/* This is the interface, not the implementation.  Please call the  */
73/* implementation APIs below.                                       */
74
75
76CPU_INIT( spc700 );
77
78/* Pulse the RESET pin on the CPU */
79CPU_RESET( spc700 );
80
81/* Set the RESET line on the CPU */
82void spc700_set_reset_line(spc700i_cpu *cpustate, int state, void* param);
83
84/* Clean up after the emulation core - Not used in this core - */
85CPU_EXIT( spc700 );
86
87/* Get the current Program Counter */
88unsigned spc700_get_pc(spc700i_cpu *cpustate);
89
90/* Set the current Program Counter */
91void spc700_set_pc(spc700i_cpu *cpustate,unsigned val);
92
93/* Get the current Stack Pointer */
94unsigned spc700_get_sp(spc700i_cpu *cpustate);
95
96/* Set the current Stack Pointer */
97void spc700_set_sp(spc700i_cpu *cpustate,unsigned val);
98
99/* Get a register from the core */
100unsigned spc700_get_reg(spc700i_cpu *cpustate,int regnum);
101
102/* Set a register in the core */
103void spc700_set_reg(spc700i_cpu *cpustate,int regnum, unsigned val);
104
105/* Note about NMI:
106 *   NMI is a one-shot trigger.  In order to trigger NMI again, you must
107 *   clear NMI and then assert it again.
108 */
109void spc700_set_nmi_line(spc700i_cpu *cpustate,int state);
110
111/* Assert or clear the IRQ pin */
112void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state);
113
114/* Set the callback that will be called when an interrupt is serviced */
115void spc700_set_irq_callback(spc700i_cpu *cpustate,cpu_irq_callback callback);
116
117/* Get a formatted string representing a register and its contents */
118const char *spc700_info(spc700i_cpu *cpustate,void *context, int regnum);
119
120
121/* Pulse the SO (Set Overflow) pin on the CPU */
122void spc700_pulse_so(spc700i_cpu *cpustate);
123
124
125/* ======================================================================== */
126/* =================== Functions Implemented by the Host ================== */
127/* ======================================================================== */
128
129/* Read data from RAM */
130unsigned int spc700_read_8(unsigned int address);
131
132/* Read data from the direct page */
133unsigned int spc700_read_8_direct(unsigned int address);
134
135/* Read data from ROM */
136unsigned int spc700_read_8_immediate(unsigned int address);
137unsigned int spc700_read_8_instruction(unsigned int address);
138
139/* Write data to RAM */
140void spc700_write_8(unsigned int address, unsigned int value);
141void spc700_write_8_direct(unsigned int address, unsigned int value);
142
143void spc700_jumping(unsigned int new_pc);
144void spc700_branching(unsigned int new_pc);
145
146
147
148/* ======================================================================== */
149/* ================================= MAME ================================= */
150/* ======================================================================== */
151
152#include "cpuintrf.h"
153
154extern CPU_GET_INFO( spc700 );
155
156#define spc700_read_8(addr) memory_read_byte_8le(cpustate->program,addr)
157#define spc700_write_8(addr,data) memory_write_byte_8le(cpustate->program,addr,data)
158
159#define spc700_read_8_direct(A)     spc700_read_8(A)
160#define spc700_write_8_direct(A, V) spc700_write_8(A, V)
161//#define spc700_read_instruction(A)    memory_decrypted_read_byte(cpustate->program,A)
162//#define spc700_read_8_immediate(A)    memory_raw_read_byte(cpustate->program,A)
163#define spc700_read_instruction(A)    memory_read_byte_8le(cpustate->program,A)
164#define spc700_read_8_immediate(A)    memory_read_byte_8le(cpustate->program,A)
165#define spc700_jumping(A)
166#define spc700_branching(A)
167
168
169
170/* ======================================================================== */
17141/* ============================== END OF FILE ============================= */
17242/* ======================================================================== */
17343
src/emu/cpu/spc700/spc700.c
r3957r3958
6464#include "debugger.h"
6565#include "spc700.h"
6666
67/* CPU Structure */
68typedef struct
69{
70   uint a;      /* Accumulator */
71   uint x;      /* Index Register X */
72   uint y;      /* Index Register Y */
73   uint s;      /* Stack Pointer */
74   uint pc;   /* Program Counter */
75   uint ppc;   /* Previous Program Counter */
76   uint flag_n;   /* Negative Flag */
77   uint flag_z;   /* Zero flag */
78   uint flag_v;   /* Overflow Flag */
79   uint flag_p;   /* Direct Page Flag */
80   uint flag_b;   /* BRK Instruction Flag */
81   uint flag_h;   /* Half-carry Flag */
82   uint flag_i;   /* Interrupt Mask Flag */
83   uint flag_c;   /* Carry Flag */
84   uint line_irq;   /* Status of the IRQ line */
85   uint line_nmi;   /* Status of the NMI line */
86   uint line_rst;   /* Status of the RESET line */
87   uint ir;      /* Instruction Register */
88   cpu_irq_callback int_ack;
89   const device_config *device;
90   const address_space *program;
91   uint stopped;   /* stopped status */
92   int ICount;
93   uint source;
94   uint destination;
95   uint temp1, temp2, temp3;
96   short spc_int16;
97   int spc_int32;
98} spc700i_cpu;
99
67100/* ======================================================================== */
68101/* ==================== ARCHITECTURE-DEPENDANT DEFINES ==================== */
69102/* ======================================================================== */
r3957r3958
206239#define NZFLAG_16(A) (((A)&0x7f) | (((A)>>1)&0x40) | (((A)>>8)&0xff))
207240#define CFLAG_16(A)  ((A)>>8)
208241
242
209243/* ======================================================================== */
244/* ================================= MAME ================================= */
245/* ======================================================================== */
246
247#define spc700_read_8(addr) memory_read_byte_8le(cpustate->program,addr)
248#define spc700_write_8(addr,data) memory_write_byte_8le(cpustate->program,addr,data)
249
250#define spc700_read_8_direct(A)     spc700_read_8(A)
251#define spc700_write_8_direct(A, V) spc700_write_8(A, V)
252//#define spc700_read_instruction(A)    memory_decrypted_read_byte(cpustate->program,A)
253//#define spc700_read_8_immediate(A)    memory_raw_read_byte(cpustate->program,A)
254#define spc700_read_instruction(A)    memory_read_byte_8le(cpustate->program,A)
255#define spc700_read_8_immediate(A)    memory_read_byte_8le(cpustate->program,A)
256#define spc700_jumping(A)
257#define spc700_branching(A)
258
259
260
261/* ======================================================================== */
262/* ============================= INTERFACE API ============================ */
263/* ======================================================================== */
264
265/* This is the interface, not the implementation.  Please call the  */
266/* implementation APIs below.                                       */
267
268
269CPU_INIT( spc700 );
270
271/* Pulse the RESET pin on the CPU */
272CPU_RESET( spc700 );
273
274/* Set the RESET line on the CPU */
275void spc700_set_reset_line(spc700i_cpu *cpustate, int state, void* param);
276
277/* Clean up after the emulation core - Not used in this core - */
278CPU_EXIT( spc700 );
279
280/* Get the current Program Counter */
281unsigned spc700_get_pc(spc700i_cpu *cpustate);
282
283/* Set the current Program Counter */
284void spc700_set_pc(spc700i_cpu *cpustate,unsigned val);
285
286/* Get the current Stack Pointer */
287unsigned spc700_get_sp(spc700i_cpu *cpustate);
288
289/* Set the current Stack Pointer */
290void spc700_set_sp(spc700i_cpu *cpustate,unsigned val);
291
292/* Get a register from the core */
293unsigned spc700_get_reg(spc700i_cpu *cpustate,int regnum);
294
295/* Set a register in the core */
296void spc700_set_reg(spc700i_cpu *cpustate,int regnum, unsigned val);
297
298/* Note about NMI:
299 *   NMI is a one-shot trigger.  In order to trigger NMI again, you must
300 *   clear NMI and then assert it again.
301 */
302void spc700_set_nmi_line(spc700i_cpu *cpustate,int state);
303
304/* Assert or clear the IRQ pin */
305void spc700_set_irq_line(spc700i_cpu *cpustate,int line, int state);
306
307/* Set the callback that will be called when an interrupt is serviced */
308void spc700_set_irq_callback(spc700i_cpu *cpustate,cpu_irq_callback callback);
309
310/* Get a formatted string representing a register and its contents */
311const char *spc700_info(spc700i_cpu *cpustate,void *context, int regnum);
312
313
314/* Pulse the SO (Set Overflow) pin on the CPU */
315void spc700_pulse_so(spc700i_cpu *cpustate);
316
317
318/* ======================================================================== */
210319/* ============================ UTILITY MACROS ============================ */
211320/* ======================================================================== */
212321
r3957r3958
15991708   spc700i_cpu *cpustate = (device != NULL) ? device->token : NULL;
16001709   uint p = 0;
16011710
1602   if (device != NULL)
1711   if (cpustate != NULL)
16031712   {
16041713      p = ((cpustate->flag_n & 0x80)         |
16051714               ((cpustate->flag_v & 0x80) >> 1)   |
r3957r3958
16251734      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
16261735      case CPUINFO_INT_MAX_CYCLES:               info->i = 8;                     break;
16271736
1628      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1629      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
1630      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1631      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1632      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1633      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1634      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;            break;
1635      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;            break;
1636      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;            break;
1737      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1738      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
1739      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1740      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1741      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1742      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1743      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;            break;
1744      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;            break;
1745      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;            break;
16371746
16381747      case CPUINFO_INT_INPUT_STATE + 0:            info->i = (LINE_IRQ == IRQ_SET) ? ASSERT_LINE : CLEAR_LINE; break;
16391748
r3957r3958
16491758      case CPUINFO_INT_REGISTER + SPC700_Y:            info->i = REG_Y;         break;
16501759
16511760      /* --- the following bits of info are returned as pointers to data or functions --- */
1652      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(spc700);      break;
1653      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(spc700);         break;
1654      case CPUINFO_PTR_RESET:                  info->reset = CPU_RESET_NAME(spc700);         break;
1655      case CPUINFO_PTR_EXIT:                  info->exit = CPU_EXIT_NAME(spc700);         break;
1656      case CPUINFO_PTR_EXECUTE:               info->execute = CPU_EXECUTE_NAME(spc700);      break;
1657      case CPUINFO_PTR_BURN:                  info->burn = NULL;               break;
1658      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(spc700);   break;
1761      case CPUINFO_FCT_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(spc700);      break;
1762      case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(spc700);         break;
1763      case CPUINFO_FCT_RESET:                  info->reset = CPU_RESET_NAME(spc700);         break;
1764      case CPUINFO_FCT_EXIT:                  info->exit = CPU_EXIT_NAME(spc700);         break;
1765      case CPUINFO_FCT_EXECUTE:               info->execute = CPU_EXECUTE_NAME(spc700);      break;
1766      case CPUINFO_FCT_BURN:                  info->burn = NULL;               break;
1767      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(spc700);   break;
16591768      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->ICount;            break;
16601769
16611770      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/hd6309/hd6309.h
r3957r3958
1919
2020/* PUBLIC FUNCTIONS */
2121CPU_GET_INFO( hd6309 );
22#define CPU_HD6309 CPU_GET_INFO_NAME( hd6309 )
2223
2324
2425CPU_DISASSEMBLE( hd6309 );
src/emu/cpu/hd6309/hd6309.c
r3957r3958
12651265      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
12661266      case CPUINFO_INT_MAX_CYCLES:               info->i = 20;                     break;
12671267
1268      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1269      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
1270      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1271      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1272      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1273      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1274      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1275      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1276      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1268      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1269      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
1270      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1271      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1272      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1273      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1274      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1275      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1276      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
12771277
12781278      case CPUINFO_INT_INPUT_STATE + HD6309_IRQ_LINE:   info->i = m68_state->irq_state[HD6309_IRQ_LINE]; break;
12791279      case CPUINFO_INT_INPUT_STATE + HD6309_FIRQ_LINE:info->i = m68_state->irq_state[HD6309_FIRQ_LINE]; break;
r3957r3958
12981298      case CPUINFO_INT_REGISTER + HD6309_DP:         info->i = DP;                     break;
12991299
13001300      /* --- the following bits of info are returned as pointers to data or functions --- */
1301      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hd6309);      break;
1302      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(hd6309);            break;
1303      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(hd6309);            break;
1304      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(hd6309);            break;
1305      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hd6309);         break;
1306      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1307      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hd6309);      break;
1301      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hd6309);      break;
1302      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(hd6309);            break;
1303      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(hd6309);            break;
1304      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(hd6309);            break;
1305      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hd6309);         break;
1306      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1307      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hd6309);      break;
13081308      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &m68_state->icount;         break;
13091309
13101310      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/ssp1601/ssp1601.h
r3957r3958
1818
1919#if (HAS_SSP1601)
2020CPU_GET_INFO( ssp1601 );
21#define CPU_SSP1601 CPU_GET_INFO_NAME( ssp1601 )
2122#endif
2223
2324extern unsigned dasm_ssp1601(char *buffer, unsigned pc, const UINT8 *oprom);
src/emu/cpu/ssp1601/ssp1601.c
r3957r3958
824824      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
825825      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
826826
827      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
828      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
829      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
830      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
831      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
832      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
833      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
834      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 4;               break;
835      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
827      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
828      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
829      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
830      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
831      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
832      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
833      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
834      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 4;               break;
835      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
836836
837837      case CPUINFO_INT_INPUT_STATE + 0:               /* not implemented */            break;
838838
r3957r3958
863863      case CPUINFO_INT_REGISTER + SSP_PR7:         info->i = ssp1601_state->r[7];               break;
864864
865865      /* --- the following bits of info are returned as pointers to data or functions --- */
866      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ssp1601);   break;
867      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ssp1601);         break;
868      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ssp1601);         break;
869      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ssp1601);         break;
870      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ssp1601);      break;
871      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
872      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ssp1601);   break;
866      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ssp1601);   break;
867      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ssp1601);         break;
868      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ssp1601);         break;
869      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ssp1601);         break;
870      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ssp1601);      break;
871      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
872      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ssp1601);   break;
873873      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &ssp1601_state->g_cycles;         break;
874874
875      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map16 = NULL;   break;
876      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map16 = NULL;   break;
875      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map16 = NULL;   break;
876      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map16 = NULL;   break;
877877
878878      /* --- the following bits of info are returned as NULL-terminated strings --- */
879879      case CPUINFO_STR_NAME:                  strcpy(info->s, CHIP_NAME);                           break;
src/emu/cpu/tlcs90/tlcs90.c
r3957r3958
27412741      case CPUINFO_INT_MIN_CYCLES:                        info->i = 2;               break;
27422742      case CPUINFO_INT_MAX_CYCLES:                        info->i = 26;               break;
27432743
2744      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:      info->i = 8;               break;
2745      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:      info->i = 20;               break;
2746      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:      info->i = 0;               break;
2744      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:      info->i = 8;               break;
2745      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:      info->i = 20;               break;
2746      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:      info->i = 0;               break;
27472747
2748      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:      info->i = 0;               break;
2749      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:      info->i = 0;               break;
2750      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:      info->i = 0;               break;
2748      case CPUINFO_INT_DATABUS_WIDTH_DATA:      info->i = 0;               break;
2749      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:      info->i = 0;               break;
2750      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:      info->i = 0;               break;
27512751
2752      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:         info->i = 8;               break;
2753      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:         info->i = 16;               break;
2754      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:         info->i = 0;               break;
2752      case CPUINFO_INT_DATABUS_WIDTH_IO:         info->i = 8;               break;
2753      case CPUINFO_INT_ADDRBUS_WIDTH_IO:         info->i = 16;               break;
2754      case CPUINFO_INT_ADDRBUS_SHIFT_IO:         info->i = 0;               break;
27552755
27562756      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:            info->i = cpustate->irq_state & (1 << INTNMI);   break;
27572757      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_IRQ0:            info->i = cpustate->irq_state & (1 << INT0);      break;
r3957r3958
27792779
27802780      /* --- the following bits of info are returned as pointers to data or functions --- */
27812781
2782      case CPUINFO_PTR_SET_INFO:                           info->setinfo = CPU_SET_INFO_NAME(t90);      break;
2783      case CPUINFO_PTR_INIT:                              info->init = CPU_INIT_NAME(t90);            break;
2784      case CPUINFO_PTR_RESET:                              info->reset = CPU_RESET_NAME(t90);         break;
2785      case CPUINFO_PTR_EXIT:                              info->exit = CPU_EXIT_NAME(t90);            break;
2786      case CPUINFO_PTR_EXECUTE:                           info->execute = CPU_EXECUTE_NAME(t90);      break;
2787      case CPUINFO_PTR_BURN:                              info->burn = CPU_BURN_NAME(t90);            break;
2788      case CPUINFO_PTR_DISASSEMBLE:                        info->disassemble = CPU_DISASSEMBLE_NAME(t90);      break;
2782      case CPUINFO_FCT_SET_INFO:                           info->setinfo = CPU_SET_INFO_NAME(t90);      break;
2783      case CPUINFO_FCT_INIT:                              info->init = CPU_INIT_NAME(t90);            break;
2784      case CPUINFO_FCT_RESET:                              info->reset = CPU_RESET_NAME(t90);         break;
2785      case CPUINFO_FCT_EXIT:                              info->exit = CPU_EXIT_NAME(t90);            break;
2786      case CPUINFO_FCT_EXECUTE:                           info->execute = CPU_EXECUTE_NAME(t90);      break;
2787      case CPUINFO_FCT_BURN:                              info->burn = CPU_BURN_NAME(t90);            break;
2788      case CPUINFO_FCT_DISASSEMBLE:                        info->disassemble = CPU_DISASSEMBLE_NAME(t90);      break;
27892789      case CPUINFO_PTR_INSTRUCTION_COUNTER:                  info->icount = &cpustate->icount;         break;
2790      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp90840_mem); break;
2790      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp90840_mem); break;
27912791
27922792      /* --- the following bits of info are returned as NULL-terminated strings --- */
27932793
r3957r3958
28332833   {
28342834      /* --- the following bits of info are returned as 64-bit signed integers --- */
28352835
2836      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp90841_mem); return;
2836      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp90841_mem); return;
28372837
28382838      /* --- the following bits of info are returned as NULL-terminated strings --- */
28392839
r3957r3958
28492849   {
28502850      /* --- the following bits of info are returned as 64-bit signed integers --- */
28512851
2852      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp91640_mem); return;
2852      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp91640_mem); return;
28532853
28542854      /* --- the following bits of info are returned as NULL-terminated strings --- */
28552855
r3957r3958
28652865   {
28662866      /* --- the following bits of info are returned as 64-bit signed integers --- */
28672867
2868      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp91641_mem); return;
2868      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(tmp91641_mem); return;
28692869
28702870      /* --- the following bits of info are returned as NULL-terminated strings --- */
28712871
src/emu/cpu/tlcs90/tlcs90.h
r3957r3958
1010CPU_GET_INFO( tmp91640 );
1111CPU_GET_INFO( tmp91641 );
1212
13#define CPU_TMP90840 CPU_GET_INFO_NAME( tmp90840 )
14#define CPU_TMP90841 CPU_GET_INFO_NAME( tmp90841 )
15#define CPU_TMP91640 CPU_GET_INFO_NAME( tmp91640 )
16#define CPU_TMP91641 CPU_GET_INFO_NAME( tmp91641 )
17
1318CPU_DISASSEMBLE( t90 );
1419
1520#define T90_IOBASE   0xffc0
src/emu/cpu/s2650/s2650.c
r3957r3958
15221522      case CPUINFO_INT_MIN_CYCLES:               info->i = 5;                     break;
15231523      case CPUINFO_INT_MAX_CYCLES:               info->i = 13;                     break;
15241524
1525      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1526      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 15;               break;
1527      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;               break;
1525      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1526      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 15;               break;
1527      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;               break;
15281528
1529      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1530      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1531      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1529      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1530      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;               break;
1531      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;               break;
15321532
1533      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1534      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 9;               break;
1535      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;               break;
1533      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1534      case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 9;               break;
1535      case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;               break;
15361536
15371537      case CPUINFO_INT_INPUT_STATE + 0:            info->i = s2650c->irq_state;               break;
15381538      case CPUINFO_INT_INPUT_STATE + 1:            info->i = s2650_get_sense(s2650c) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
15561556      case CPUINFO_INT_REGISTER + S2650_FO:         info->i = s2650_get_flag(s2650c);            break;
15571557
15581558      /* --- the following bits of info are returned as pointers to data or functions --- */
1559      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(s2650);         break;
1560      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(s2650);            break;
1561      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(s2650);            break;
1562      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(s2650);            break;
1563      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(s2650);         break;
1564      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1565      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(s2650);         break;
1559      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(s2650);         break;
1560      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(s2650);            break;
1561      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(s2650);            break;
1562      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(s2650);            break;
1563      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(s2650);         break;
1564      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1565      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(s2650);         break;
15661566      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &s2650c->icount;         break;
15671567
15681568      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/s2650/s2650.h
r3957r3958
2525#define S2650_SENSE_PORT 0x102
2626
2727extern CPU_GET_INFO( s2650 );
28#define CPU_S2650 CPU_GET_INFO_NAME( s2650 )
2829
2930extern CPU_DISASSEMBLE( s2650 );
3031
src/emu/cpu/cdp1802/cdp1802.c
r3957r3958
993993      case CPUINFO_INT_MIN_CYCLES:               info->i = CDP1802_CYCLES_EXECUTE * 2;   break;
994994      case CPUINFO_INT_MAX_CYCLES:               info->i = CDP1802_CYCLES_EXECUTE * 3;   break;
995995
996      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
997      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
998      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
999      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1000      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1001      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1002      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1003      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 3;               break;
1004      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
996      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
997      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
998      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
999      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1000      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1001      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1002      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1003      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 3;               break;
1004      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
10051005
10061006      case CPUINFO_INT_INPUT_STATE + CDP1802_INPUT_LINE_INT:      info->i = cpustate->irq;      break;
10071007      case CPUINFO_INT_INPUT_STATE + CDP1802_INPUT_LINE_DMAIN:   info->i = cpustate->dmain;   break;
r3957r3958
10401040      case CPUINFO_INT_REGISTER + CDP1802_PC:         info->i = cpustate->r[cpustate->p];      break;
10411041
10421042      /* --- the following bits of info are returned as pointers to data or functions --- */
1043      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cdp1802);         break;
1044      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cdp1802);            break;
1045      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cdp1802);            break;
1046      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cdp1802);         break;
1047      case CPUINFO_PTR_BURN:                     info->burn = NULL;                           break;
1048      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cdp1802);   break;
1043      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cdp1802);         break;
1044      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cdp1802);            break;
1045      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cdp1802);            break;
1046      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cdp1802);         break;
1047      case CPUINFO_FCT_BURN:                     info->burn = NULL;                           break;
1048      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cdp1802);   break;
10491049      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;               break;
10501050
10511051      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/cdp1802/cdp1802.h
r3957r3958
8888};
8989
9090CPU_GET_INFO( cdp1802 );
91#define CPU_CDP1802 CPU_GET_INFO_NAME( cdp1802 )
9192
9293typedef cdp1802_control_mode (*cdp1802_mode_read_func)(const device_config *device);
9394#define CDP1802_MODE_READ(name) cdp1802_control_mode name(const device_config *device)
src/emu/cpu/se3208/se3208.c
r3957r3958
2727   UINT8 IRQ;
2828   UINT8 NMI;
2929
30   int SE3208_ICount;
30   int icount;
3131};
3232
3333#define FLAG_C      0x0080
r3957r3958
17021702      OpTable[i]=DecodeOp(i);
17031703}
17041704
1705static CPU_RESET( SE3208 )
1705static CPU_RESET( se3208 )
17061706{
17071707   se3208_state_t *se3208_state = device->token;
17081708
r3957r3958
17451745}
17461746
17471747
1748static CPU_EXECUTE( SE3208 )
1748static CPU_EXECUTE( se3208 )
17491749{
17501750   se3208_state_t *se3208_state = device->token;
17511751
1752   se3208_state->SE3208_ICount=cycles;
1752   se3208_state->icount=cycles;
17531753   do
17541754   {
17551755      UINT16 Opcode=memory_decrypted_read_word(se3208_state->program, WORD_XOR_LE(se3208_state->PC));
r3957r3958
17691769      {
17701770         SE3208_Interrupt(se3208_state);
17711771      }
1772      --(se3208_state->SE3208_ICount);
1773   } while(se3208_state->SE3208_ICount>0);
1772      --(se3208_state->icount);
1773   } while(se3208_state->icount>0);
17741774
1775   return cycles-se3208_state->SE3208_ICount;
1775   return cycles-se3208_state->icount;
17761776}
17771777
1778static CPU_INIT( SE3208 )
1778static CPU_INIT( se3208 )
17791779{
17801780   se3208_state_t *se3208_state = device->token;
17811781
r3957r3958
17861786   se3208_state->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
17871787}
17881788
1789static CPU_EXIT( SE3208 )
1789static CPU_EXIT( se3208 )
17901790{
17911791   if(OpTable)
17921792      free(OpTable);
r3957r3958
18021802}
18031803
18041804
1805static CPU_SET_INFO( SE3208 )
1805static CPU_SET_INFO( se3208 )
18061806{
18071807   se3208_state_t *se3208_state = device->token;
18081808
r3957r3958
18301830}
18311831
18321832
1833CPU_GET_INFO( SE3208 )
1833CPU_GET_INFO( se3208 )
18341834{
18351835   se3208_state_t *se3208_state = (device != NULL) ? device->token : NULL;
18361836
r3957r3958
18481848      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
18491849      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
18501850
1851      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1852      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1853      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1854      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1855      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1856      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1857      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1858      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1859      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1851      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1852      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1853      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1854      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1855      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1856      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1857      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1858      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1859      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
18601860
18611861      case CPUINFO_INT_INPUT_STATE + SE3208_INT:      info->i = se3208_state->IRQ;               break;
18621862      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = se3208_state->NMI;               break;
r3957r3958
18791879      case CPUINFO_INT_REGISTER + SE3208_R7:         info->i = se3208_state->R[ 7];            break;
18801880
18811881      /* --- the following bits of info are returned as pointers to data or functions --- */
1882      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(SE3208);      break;
1883      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(SE3208);      break;
1884      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(SE3208);   break;
1885      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(SE3208);      break;
1886      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(SE3208);break;
1887      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1888      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(SE3208);      break;
1889      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &se3208_state->SE3208_ICount;         break;
1882      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(se3208);      break;
1883      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(se3208);      break;
1884      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(se3208);   break;
1885      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(se3208);      break;
1886      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(se3208);break;
1887      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1888      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(se3208);      break;
1889      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &se3208_state->icount;         break;
18901890
18911891      /* --- the following bits of info are returned as NULL-terminated strings --- */
18921892      case CPUINFO_STR_NAME:                     strcpy(info->s, "SE3208");            break;
src/emu/cpu/se3208/se3208dis.c
r3957r3958
14001400}
14011401
14021402
1403CPU_DISASSEMBLE( SE3208 )
1403CPU_DISASSEMBLE( se3208 )
14041404{
14051405   UINT16 Opcode;
14061406
src/emu/cpu/se3208/se3208.h
r3957r3958
88
99#define SE3208_INT   0
1010
11extern CPU_GET_INFO( SE3208 );
11extern CPU_GET_INFO( se3208 );
12#define CPU_SE3208 CPU_GET_INFO_NAME( se3208 )
1213
13CPU_DISASSEMBLE( SE3208 );
14CPU_DISASSEMBLE( se3208 );
src/emu/cpu/e132xs/e132xs.c
r3957r3958
15211521      ISR &= ~(1 << irqline);
15221522}
15231523
1524static void hyperstone_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, int scale_mask)
1524static void hyperstone_init(const device_config *device, cpu_irq_callback irqcallback, int scale_mask)
15251525{
15261526   hyperstone_state *cpustate = device->token;
15271527
r3957r3958
15441544}
15451545
15461546#if (HAS_E116T || HAS_E116XT || HAS_E116XS || HAS_E116XSR || HAS_GMS30C2116 || HAS_GMS30C2216)
1547static void e116_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, int scale_mask)
1547static void e116_init(const device_config *device, cpu_irq_callback irqcallback, int scale_mask)
15481548{
15491549   hyperstone_state *cpustate = device->token;
1550   hyperstone_init(device, index, clock, irqcallback, scale_mask);
1550   hyperstone_init(device, irqcallback, scale_mask);
15511551   cpustate->opcodexor = 0;
15521552}
15531553#endif
r3957r3958
15551555#if (HAS_E116T)
15561556static CPU_INIT( e116t )
15571557{
1558   e116_init(device, index, clock, irqcallback, 0);
1558   e116_init(device, irqcallback, 0);
15591559}
15601560#endif
15611561
15621562#if (HAS_E116XT)
15631563static CPU_INIT( e116xt )
15641564{
1565   e116_init(device, index, clock, irqcallback, 3);
1565   e116_init(device, irqcallback, 3);
15661566}
15671567#endif
15681568
15691569#if (HAS_E116XS)
15701570static CPU_INIT( e116xs )
15711571{
1572   e116_init(device, index, clock, irqcallback, 7);
1572   e116_init(device, irqcallback, 7);
15731573}
15741574#endif
15751575
15761576#if (HAS_E116XSR)
15771577static CPU_INIT( e116xsr )
15781578{
1579   e116_init(device, index, clock, irqcallback, 7);
1579   e116_init(device, irqcallback, 7);
15801580}
15811581#endif
15821582
15831583#if (HAS_GMS30C2116)
15841584static CPU_INIT( gms30c2116 )
15851585{
1586   e116_init(device, index, clock, irqcallback, 0);
1586   e116_init(device, irqcallback, 0);
15871587}
15881588#endif
15891589
15901590#if (HAS_GMS30C2216)
15911591static CPU_INIT( gms30c2216 )
15921592{
1593   e116_init(device, index, clock, irqcallback, 0);
1593   e116_init(device, irqcallback, 0);
15941594}
15951595#endif
15961596
15971597#if (HAS_E132N || HAS_E132T || HAS_E132XN || HAS_E132XT || HAS_E132XS || HAS_E132XSR || HAS_GMS30C2132 || HAS_GMS30C2232)
1598static void e132_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, int scale_mask)
1598static void e132_init(const device_config *device, cpu_irq_callback irqcallback, int scale_mask)
15991599{
16001600   hyperstone_state *cpustate = device->token;
1601   hyperstone_init(device, index, clock, irqcallback, scale_mask);
1601   hyperstone_init(device, irqcallback, scale_mask);
16021602   cpustate->opcodexor = WORD_XOR_BE(0);
16031603}
16041604#endif
r3957r3958
16061606#if (HAS_E132N)
16071607static CPU_INIT( e132n )
16081608{
1609   e132_init(device, index, clock, irqcallback, 0);
1609   e132_init(device, irqcallback, 0);
16101610}
16111611#endif
16121612
16131613#if (HAS_E132T)
16141614static CPU_INIT( e132t )
16151615{
1616   e132_init(device, index, clock, irqcallback, 0);
1616   e132_init(device, irqcallback, 0);
16171617}
16181618#endif
16191619
16201620#if (HAS_E132XN)
16211621static CPU_INIT( e132xn )
16221622{
1623   e132_init(device, index, clock, irqcallback, 3);
1623   e132_init(device, irqcallback, 3);
16241624}
16251625#endif
16261626
16271627#if (HAS_E132XT)
16281628static CPU_INIT( e132xt )
16291629{
1630   e132_init(device, index, clock, irqcallback, 3);
1630   e132_init(device, irqcallback, 3);
16311631}
16321632#endif
16331633
16341634#if (HAS_E132XS)
16351635static CPU_INIT( e132xs )
16361636{
1637   e132_init(device, index, clock, irqcallback, 7);
1637   e132_init(device, irqcallback, 7);
16381638}
16391639#endif
16401640
16411641#if (HAS_E132XSR)
16421642static CPU_INIT( e132xsr )
16431643{
1644   e132_init(device, index, clock, irqcallback, 7);
1644   e132_init(device, irqcallback, 7);
16451645}
16461646#endif
16471647
16481648#if (HAS_GMS30C2132)
16491649static CPU_INIT( gms30c2132 )
16501650{
1651   e132_init(device, index, clock, irqcallback, 0);
1651   e132_init(device, irqcallback, 0);
16521652}
16531653#endif
16541654
16551655#if (HAS_GMS30C2232)
16561656static CPU_INIT( gms30c2232 )
16571657{
1658   e132_init(device, index, clock, irqcallback, 0);
1658   e132_init(device, irqcallback, 0);
16591659}
16601660#endif
16611661
r3957r3958
48854885      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
48864886      case CPUINFO_INT_MAX_CYCLES:               info->i = 36;                     break;
48874887
4888      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
4889      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
4890      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
4891      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4892      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4893      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 15;               break;
4894      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
4888      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
4889      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
4890      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
4891      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
4892      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
4893      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 15;               break;
4894      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
48954895
48964896      case CPUINFO_INT_INPUT_STATE + 0:               /* not implemented */            break;
48974897
r3957r3958
50135013      case CPUINFO_INT_REGISTER + E132XS_L63:         info->i =  cpustate->local_regs[63];   break;
50145014
50155015      /* --- the following bits of info are returned as pointers to data or functions --- */
5016      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hyperstone);   break;
5017      case CPUINFO_PTR_INIT:                     info->init = NULL;                  break;
5018      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(hyperstone);         break;
5019      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(hyperstone);         break;
5020      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hyperstone);      break;
5021      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
5022      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hyperstone);   break;
5016      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(hyperstone);   break;
5017      case CPUINFO_FCT_INIT:                     info->init = NULL;                  break;
5018      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(hyperstone);         break;
5019      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(hyperstone);         break;
5020      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hyperstone);      break;
5021      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
5022      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hyperstone);   break;
50235023      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
50245024
5025      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map16 = NULL;   break;
5026      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map16 = NULL;   break;
5025      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map16 = NULL;   break;
5026      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map16 = NULL;   break;
50275027
50285028      /* --- the following bits of info are returned as NULL-terminated strings --- */
50295029      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Hyperstone CPU");      break;
r3957r3958
51745174   switch (state)
51755175   {
51765176
5177      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5178      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5177      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5178      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
51795179
5180      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_4k_iram_map); break;
5180      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_4k_iram_map); break;
51815181
51825182      /* --- the following bits of info are returned as pointers to data or functions --- */
5183      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e116t);               break;
5183      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e116t);               break;
51845184
51855185      /* --- the following bits of info are returned as NULL-terminated strings --- */
51865186      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16T");            break;
r3957r3958
51975197   switch (state)
51985198   {
51995199
5200      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5201      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5200      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5201      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
52025202
5203      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_8k_iram_map); break;
5203      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_8k_iram_map); break;
52045204
52055205      /* --- the following bits of info are returned as pointers to data or functions --- */
5206      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e116xt);               break;
5206      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e116xt);               break;
52075207
52085208      /* --- the following bits of info are returned as NULL-terminated strings --- */
52095209      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XT");            break;
r3957r3958
52205220   switch (state)
52215221   {
52225222
5223      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5224      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5223      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5224      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
52255225
5226      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_16k_iram_map); break;
5226      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_16k_iram_map); break;
52275227
52285228      /* --- the following bits of info are returned as pointers to data or functions --- */
5229      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e116xs);               break;
5229      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e116xs);               break;
52305230
52315231      /* --- the following bits of info are returned as NULL-terminated strings --- */
52325232      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XS");            break;
r3957r3958
52435243   switch (state)
52445244   {
52455245
5246      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5247      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5246      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5247      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
52485248
5249      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_16k_iram_map); break;
5249      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_16k_iram_map); break;
52505250
52515251      /* --- the following bits of info are returned as pointers to data or functions --- */
5252      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e116xsr);               break;
5252      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e116xsr);               break;
52535253
52545254      /* --- the following bits of info are returned as NULL-terminated strings --- */
52555255      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-16XSR");         break;
r3957r3958
52665266   switch (state)
52675267   {
52685268
5269      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5270      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5269      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5270      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
52715271
5272      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
5272      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
52735273
52745274      /* --- the following bits of info are returned as pointers to data or functions --- */
5275      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132n);               break;
5275      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132n);               break;
52765276
52775277      /* --- the following bits of info are returned as NULL-terminated strings --- */
52785278      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32N");            break;
r3957r3958
52895289   switch (state)
52905290   {
52915291
5292      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5293      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5292      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5293      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
52945294
5295      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
5295      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
52965296
52975297      /* --- the following bits of info are returned as pointers to data or functions --- */
5298      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132t);               break;
5298      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132t);               break;
52995299
53005300      /* --- the following bits of info are returned as NULL-terminated strings --- */
53015301      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32T");            break;
r3957r3958
53125312   switch (state)
53135313   {
53145314
5315      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5316      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5315      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5316      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
53175317
5318      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
5318      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
53195319
53205320      /* --- the following bits of info are returned as pointers to data or functions --- */
5321      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132xn);               break;
5321      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132xn);               break;
53225322
53235323      /* --- the following bits of info are returned as NULL-terminated strings --- */
53245324      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XN");            break;
r3957r3958
53355335   switch (state)
53365336   {
53375337
5338      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5339      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5338      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5339      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
53405340
5341      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
5341      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
53425342
53435343      /* --- the following bits of info are returned as pointers to data or functions --- */
5344      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132xt);               break;
5344      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132xt);               break;
53455345
53465346      /* --- the following bits of info are returned as NULL-terminated strings --- */
53475347      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XT");            break;
r3957r3958
53585358   switch (state)
53595359   {
53605360
5361      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5362      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5361      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5362      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
53635363
5364      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_16k_iram_map); break;
5364      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_16k_iram_map); break;
53655365
53665366      /* --- the following bits of info are returned as pointers to data or functions --- */
5367      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132xs);               break;
5367      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132xs);               break;
53685368
53695369      /* --- the following bits of info are returned as NULL-terminated strings --- */
53705370      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XS");            break;
r3957r3958
53815381   switch (state)
53825382   {
53835383
5384      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5385      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5384      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5385      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
53865386
5387      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_16k_iram_map); break;
5387      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_16k_iram_map); break;
53885388
53895389      /* --- the following bits of info are returned as pointers to data or functions --- */
5390      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(e132xsr);               break;
5390      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(e132xsr);               break;
53915391
53925392      /* --- the following bits of info are returned as NULL-terminated strings --- */
53935393      case CPUINFO_STR_NAME:                     strcpy(info->s, "E1-32XSR");         break;
r3957r3958
54045404   switch (state)
54055405   {
54065406
5407      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5408      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5407      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5408      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
54095409
5410      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_4k_iram_map); break;
5410      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_4k_iram_map); break;
54115411
54125412      /* --- the following bits of info are returned as pointers to data or functions --- */
5413      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(gms30c2116);               break;
5413      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(gms30c2116);               break;
54145414
54155415      /* --- the following bits of info are returned as NULL-terminated strings --- */
54165416      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2116");         break;
r3957r3958
54275427   switch (state)
54285428   {
54295429
5430      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5431      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5430      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5431      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
54325432
5433      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
5433      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_4k_iram_map); break;
54345434
54355435      /* --- the following bits of info are returned as pointers to data or functions --- */
5436      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(gms30c2132);               break;
5436      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(gms30c2132);               break;
54375437
54385438      /* --- the following bits of info are returned as NULL-terminated strings --- */
54395439      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2132");         break;
r3957r3958
54505450   switch (state)
54515451   {
54525452
5453      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
5454      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
5453      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
5454      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
54555455
5456      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_8k_iram_map); break;
5456      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(e116_8k_iram_map); break;
54575457
54585458      /* --- the following bits of info are returned as pointers to data or functions --- */
5459      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(gms30c2216);               break;
5459      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(gms30c2216);               break;
54605460
54615461      /* --- the following bits of info are returned as NULL-terminated strings --- */
54625462      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2216");         break;
r3957r3958
54735473   switch (state)
54745474   {
54755475
5476      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
5477      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
5476      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
5477      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
54785478
5479      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
5479      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(e132_8k_iram_map); break;
54805480
54815481      /* --- the following bits of info are returned as pointers to data or functions --- */
5482      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(gms30c2232);               break;
5482      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(gms30c2232);               break;
54835483
54845484      /* --- the following bits of info are returned as NULL-terminated strings --- */
54855485      case CPUINFO_STR_NAME:                     strcpy(info->s, "GMS30C2232");         break;
src/emu/cpu/e132xs/e132xs.h
r3957r3958
2525
2626#if (HAS_E116T)
2727CPU_GET_INFO( e116t );
28#define CPU_E116T CPU_GET_INFO_NAME( e116t )
2829#endif
2930
3031#if (HAS_E116XT)
3132CPU_GET_INFO( e116xt );
33#define CPU_E116XT CPU_GET_INFO_NAME( e116xt )
3234#endif
3335
3436#if (HAS_E116XS)
3537CPU_GET_INFO( e116xs );
38#define CPU_E116XS CPU_GET_INFO_NAME( e116xs )
3639#endif
3740
3841#if (HAS_E116XSR)
3942CPU_GET_INFO( e116xsr );
43#define CPU_E116XSR CPU_GET_INFO_NAME( e116xsr )
4044#endif
4145
4246#if (HAS_E132N)
4347CPU_GET_INFO( e132n );
48#define CPU_E132N CPU_GET_INFO_NAME( e132n )
4449#endif
4550
4651#if (HAS_E132T)
4752CPU_GET_INFO( e132t );
53#define CPU_E132T CPU_GET_INFO_NAME( e132t )
4854#endif
4955
5056#if (HAS_E132XN)
5157CPU_GET_INFO( e132xn );
58#define CPU_E132XN CPU_GET_INFO_NAME( e132xn )
5259#endif
5360
5461#if (HAS_E132XT)
5562CPU_GET_INFO( e132xt );
63#define CPU_E132XT CPU_GET_INFO_NAME( e132xt )
5664#endif
5765
5866#if (HAS_E132XS)
5967CPU_GET_INFO( e132xs );
68#define CPU_E132XS CPU_GET_INFO_NAME( e132xs )
6069#endif
6170
6271#if (HAS_E132XSR)
6372CPU_GET_INFO( e132xsr );
73#define CPU_E132XSR CPU_GET_INFO_NAME( e132xsr )
6474#endif
6575
6676#if (HAS_GMS30C2116)
6777CPU_GET_INFO( gms30c2116 );
78#define CPU_GMS30C2116 CPU_GET_INFO_NAME( gms30c2116 )
6879#endif
6980
7081#if (HAS_GMS30C2132)
7182CPU_GET_INFO( gms30c2132 );
83#define CPU_GMS30C2132 CPU_GET_INFO_NAME( gms30c2132 )
7284#endif
7385
7486#if (HAS_GMS30C2216)
7587CPU_GET_INFO( gms30c2216 );
88#define CPU_GMS30C2216 CPU_GET_INFO_NAME( gms30c2216 )
7689#endif
7790
7891#if (HAS_GMS30C2232)
7992CPU_GET_INFO( gms30c2232 );
93#define CPU_GMS30C2232 CPU_GET_INFO_NAME( gms30c2232 )
8094#endif
8195
8296extern unsigned dasm_hyperstone(char *buffer, unsigned pc, const UINT8 *oprom, unsigned h_flag, int private_fp);
src/emu/cpu/mcs51/mcs51.c
r3957r3958
24622462      case CPUINFO_INT_MAX_CYCLES:               info->i = 20; /* rough guess */            break;
24632463      case CPUINFO_INT_INPUT_LINES:                 info->i = 3;                        break;
24642464
2465      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                  break;
2466      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;                  break;
2467      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                  break;
2468      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;                  break;
2469      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 9; /* due to sfr mapping */               break;
2470      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                  break;
2471      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 8;                     break;
2472      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:    info->i = 18; /* 128k for ds5002fp */                     break;
2473      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:    info->i = 0;                     break;
2465      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;                  break;
2466      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;                  break;
2467      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                  break;
2468      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;                  break;
2469      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 9; /* due to sfr mapping */               break;
2470      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                  break;
2471      case CPUINFO_INT_DATABUS_WIDTH_IO:   info->i = 8;                     break;
2472      case CPUINFO_INT_ADDRBUS_WIDTH_IO:    info->i = 18; /* 128k for ds5002fp */                     break;
2473      case CPUINFO_INT_ADDRBUS_SHIFT_IO:    info->i = 0;                     break;
24742474
24752475      case CPUINFO_INT_PREVIOUSPC:               info->i = PPC;                        break;
24762476      case CPUINFO_INT_PC:                      info->i = PC;                        break;
r3957r3958
24952495      case CPUINFO_INT_REGISTER + MCS51_RB:          info->i = R_REG(8);                   break;
24962496
24972497      /* --- the following bits of info are returned as pointers to data or functions --- */
2498      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mcs51);            break;
2499      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(mcs51);         break;
2500      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(mcs51);      break;
2501      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(mcs51);         break;
2502      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mcs51);   break;
2503      case CPUINFO_PTR_BURN:                     info->burn = NULL;                     break;
2504      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8051);            break;
2498      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mcs51);            break;
2499      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(mcs51);         break;
2500      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(mcs51);      break;
2501      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(mcs51);         break;
2502      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mcs51);   break;
2503      case CPUINFO_FCT_BURN:                     info->burn = NULL;                     break;
2504      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8051);            break;
25052505      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &mcs51_state->icount;            break;
25062506
2507      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = NULL;   break;
2508      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = NULL;   break;
2509      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map8 = NULL;   break;
2507      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = NULL;   break;
2508      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = NULL;   break;
2509      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map8 = NULL;   break;
25102510
25112511      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8051");               break;
25122512      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "MCS-51");               break;
r3957r3958
25542554{
25552555   switch (state)
25562556   {
2557      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
2557      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
25582558      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8031");               break;
25592559      default:                              CPU_GET_INFO_CALL(mcs51);               break;
25602560   }
r3957r3958
25652565{
25662566   switch (state)
25672567   {
2568      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_12bit);   break;
2569      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
2568      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_12bit);   break;
2569      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
25702570      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8051");               break;
25712571      default:                              CPU_GET_INFO_CALL(mcs51);               break;
25722572   }
r3957r3958
25772577{
25782578   switch (state)
25792579   {
2580      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2581      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2582      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
2580      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2581      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2582      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
25832583      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8032");               break;
25842584      default:                              CPU_GET_INFO_CALL(mcs51);               break;
25852585   }
r3957r3958
25892589{
25902590   switch (state)
25912591   {
2592      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2593      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_13bit);   break;
2594      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2595      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
2592      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2593      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_13bit);   break;
2594      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2595      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
25962596      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8052");               break;
25972597      default:                              CPU_GET_INFO_CALL(mcs51);               break;
25982598   }
r3957r3958
26022602{
26032603   switch (state)
26042604   {
2605      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_12bit);   break;
2606      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
2605      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_12bit);   break;
2606      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
26072607      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8751");               break;
26082608      default:                              CPU_GET_INFO_CALL(mcs51);               break;
26092609   }
r3957r3958
26132613{
26142614   switch (state)
26152615   {
2616      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2617      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_13bit);   break;
2618      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2619      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
2616      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8052);         break;
2617      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(program_13bit);   break;
2618      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);   break;
2619      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8052);            break;
26202620      case CPUINFO_STR_NAME:                     strcpy(info->s, "I8752");               break;
26212621      default:                              CPU_GET_INFO_CALL(mcs51);               break;
26222622   }
r3957r3958
26322632     * of i80c52 with 128 bytes internal ram */
26332633   switch (state)
26342634   {
2635      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c31);         break;
2636      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = NULL;   break;
2637      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
2638      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
2635      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c31);         break;
2636      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = NULL;   break;
2637      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);   break;
2638      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
26392639      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80C31");               break;
26402640      default:                              CPU_GET_INFO_CALL(i8031);               break;
26412641   }
r3957r3958
26452645{
26462646   switch (state)
26472647   {
2648      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
2649      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
2648      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
2649      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
26502650      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80C51");               break;
26512651      default:                              CPU_GET_INFO_CALL(i8051);               break;
26522652   }
r3957r3958
26562656{
26572657   switch (state)
26582658   {
2659      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
2660      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
2659      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
2660      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
26612661      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80C32");               break;
26622662      default:                              CPU_GET_INFO_CALL(i8032);               break;
26632663   }
r3957r3958
26672667{
26682668   switch (state)
26692669   {
2670      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
2670      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
26712671      case CPUINFO_STR_NAME:                     strcpy(info->s, "I80C52");               break;
2672      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
2672      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
26732673      default:                              CPU_GET_INFO_CALL(i8052);               break;
26742674   }
26752675}
r3957r3958
26782678{
26792679   switch (state)
26802680   {
2681      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
2681      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
26822682      case CPUINFO_STR_NAME:                     strcpy(info->s, "I87C51");               break;
2683      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
2683      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
26842684      default:                              CPU_GET_INFO_CALL(i8751);               break;
26852685   }
26862686}
r3957r3958
26892689{
26902690   switch (state)
26912691   {
2692      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
2692      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c52);         break;
26932693      case CPUINFO_STR_NAME:                     strcpy(info->s, "I87C52");               break;
2694      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
2694      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c52);         break;
26952695      default:                              CPU_GET_INFO_CALL(i8752);               break;
26962696   }
26972697}
r3957r3958
27042704{
27052705   switch (state)
27062706   {
2707      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
2707      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i80c51);         break;
27082708      case CPUINFO_STR_NAME:                     strcpy(info->s, "AT89C4051");            break;
2709      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
2709      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i80c51);         break;
27102710      default:                              CPU_GET_INFO_CALL(i8051);               break;
27112711   }
27122712}
r3957r3958
27152715{
27162716   switch (state)
27172717   {
2718      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ds5002fp);      break;
2718      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ds5002fp);      break;
27192719      case CPUINFO_STR_NAME:                     strcpy(info->s, "DS5002FP");            break;
27202720      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Dallas");               break;
27212721      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
27222722      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
27232723      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Manuel Abadia"); break;
2724      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ds5002fp);         break;
2724      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ds5002fp);         break;
27252725      default:                              CPU_GET_INFO_CALL(i8051);               break;
27262726   }
27272727}
src/emu/cpu/mcs51/mcs51.h
r3957r3958
9898
9999/* variants with no internal rom and 128 byte internal memory */
100100CPU_GET_INFO( i8031 );
101#define CPU_I8031 CPU_GET_INFO_NAME( i8031 )
101102
102103/* variants with no internal rom and 256 byte internal memory */
103104CPU_GET_INFO( i8032 );
105#define CPU_I8032 CPU_GET_INFO_NAME( i8032 )
104106
105107/* variants 4k internal rom and 128 byte internal memory */
106108CPU_GET_INFO( i8051 );
107109CPU_GET_INFO( i8751 );
108110
111#define CPU_I8051 CPU_GET_INFO_NAME( i8051 )
112#define CPU_I8751 CPU_GET_INFO_NAME( i8751 )
113
109114/* variants 8k internal rom and 256 byte internal memory and more registers */
110115CPU_GET_INFO( i8052 );
111116CPU_GET_INFO( i8752 );
112117
118#define CPU_I8052 CPU_GET_INFO_NAME( i8052 )
119#define CPU_I8752 CPU_GET_INFO_NAME( i8752 )
120
113121/* cmos variants */
114122CPU_GET_INFO( i80c31 );
115123CPU_GET_INFO( i80c51 );
116124CPU_GET_INFO( i87c51 );
117125
126#define CPU_I80C31 CPU_GET_INFO_NAME( i80c31 )
127#define CPU_I80C32 CPU_GET_INFO_NAME( i80c32 )
128#define CPU_I80C51 CPU_GET_INFO_NAME( i80c51 )
129
118130CPU_GET_INFO( i80c32 );
119131CPU_GET_INFO( i80c52 );
120132CPU_GET_INFO( i87c52 );
121133
134#define CPU_I80C52 CPU_GET_INFO_NAME( i80c52 )
135#define CPU_I87C51 CPU_GET_INFO_NAME( i87c51 )
136#define CPU_I87C52 CPU_GET_INFO_NAME( i87c52 )
137
122138/* 4k internal perom and 128 internal ram and 2 analog comparators */
123139CPU_GET_INFO( at89c4051 );
140#define CPU_AT89C4051 CPU_GET_INFO_NAME( at89c4051 )
124141
125142/*
126143 * The DS5002FP has 2 16 bits data address buses (the byte-wide bus and the expanded bus). The exact memory position accessed depends on the
r3957r3958
139156 */
140157
141158CPU_GET_INFO( ds5002fp );
159#define CPU_DS5002FP CPU_GET_INFO_NAME( ds5002fp )
142160
143161
144162/****************************************************************************
src/emu/cpu/i386/i386.h
r3957r3958
11#pragma once
22
3#ifndef __I386_H__
4#define __I386_H__
3#ifndef __I386INTF_H__
4#define __I386INTF_H__
55
6#include "cpuintrf.h"
7
8#define I386OP(XX)      i386_##XX
9#define I486OP(XX)      i486_##XX
10#define PENTIUMOP(XX)   pentium_##XX
11#define MMXOP(XX)      mmx_##XX
12
136#define INPUT_LINE_A20      1
147
15extern int i386_dasm_one(char *buffer, UINT32 pc, const UINT8 *oprom, int mode);
8#include "cpuintrf.h"
169
17typedef enum { ES, CS, SS, DS, FS, GS } SREGS;
10// mingw has this defined for 32-bit compiles
11#undef i386
1812
19#ifdef LSB_FIRST
20typedef enum
21{
22   AL = 0,
23   AH = 1,
24   CL = 4,
25   CH = 5,
26   DL = 8,
27   DH = 9,
28   BL = 12,
29   BH = 13
30} BREGS;
31#else
32typedef enum
33{
34   AL = 3,
35   AH = 2,
36   CL = 7,
37   CH = 6,
38   DL = 11,
39   DH = 10,
40   BL = 15,
41   BH = 14
42} BREGS;
43#endif
13CPU_GET_INFO( i386 );
14CPU_GET_INFO( i486 );
15CPU_GET_INFO( pentium );
16CPU_GET_INFO( mediagx );
4417
45#ifdef LSB_FIRST
46typedef enum
47{
48   AX = 0,
49   CX = 2,
50   DX = 4,
51   BX = 6,
52   SP = 8,
53   BP = 10,
54   SI = 12,
55   DI = 14
56} WREGS;
57#else
58typedef enum
59{
60   AX = 1,
61   CX = 3,
62   DX = 5,
63   BX = 7,
64   SP = 9,
65   BP = 11,
66   SI = 13,
67   DI = 15
68} WREGS;
69#endif
18#define CPU_I386 CPU_GET_INFO_NAME( i386 )
19#define CPU_I486 CPU_GET_INFO_NAME( i486 )
20#define CPU_PENTIUM CPU_GET_INFO_NAME( pentium )
21#define CPU_MEDIAGX CPU_GET_INFO_NAME( mediagx )
7022
71typedef enum { EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI } DREGS;
7223
73enum
74{
75   I386_PC = 0,
7624
77   /* 8-bit registers */
78   I386_AL,
79   I386_AH,
80   I386_BL,
81   I386_BH,
82   I386_CL,
83   I386_CH,
84   I386_DL,
85   I386_DH,
86
87   /* 16-bit registers */
88   I386_AX,
89   I386_BX,
90   I386_CX,
91   I386_DX,
92   I386_BP,
93   I386_SP,
94   I386_SI,
95   I386_DI,
96   I386_IP,
97
98   /* 32-bit registers */
99   I386_EAX,
100   I386_ECX,
101   I386_EDX,
102   I386_EBX,
103   I386_EBP,
104   I386_ESP,
105   I386_ESI,
106   I386_EDI,
107   I386_EIP,
108
109   /* segment registers */
110   I386_CS,
111   I386_CS_BASE,
112   I386_CS_LIMIT,
113   I386_CS_FLAGS,
114   I386_SS,
115   I386_SS_BASE,
116   I386_SS_LIMIT,
117   I386_SS_FLAGS,
118   I386_DS,
119   I386_DS_BASE,
120   I386_DS_LIMIT,
121   I386_DS_FLAGS,
122   I386_ES,
123   I386_ES_BASE,
124   I386_ES_LIMIT,
125   I386_ES_FLAGS,
126   I386_FS,
127   I386_FS_BASE,
128   I386_FS_LIMIT,
129   I386_FS_FLAGS,
130   I386_GS,
131   I386_GS_BASE,
132   I386_GS_LIMIT,
133   I386_GS_FLAGS,
134
135   /* other */
136   I386_EFLAGS,
137
138   I386_CR0,
139   I386_CR1,
140   I386_CR2,
141   I386_CR3,
142
143   I386_DR0,
144   I386_DR1,
145   I386_DR2,
146   I386_DR3,
147   I386_DR4,
148   I386_DR5,
149   I386_DR6,
150   I386_DR7,
151
152   I386_TR6,
153   I386_TR7,
154
155   I386_GDTR_BASE,
156   I386_GDTR_LIMIT,
157   I386_IDTR_BASE,
158   I386_IDTR_LIMIT,
159   I386_TR,
160   I386_TR_BASE,
161   I386_TR_LIMIT,
162   I386_TR_FLAGS,
163   I386_LDTR,
164   I386_LDTR_BASE,
165   I386_LDTR_LIMIT,
166   I386_LDTR_FLAGS,
167
168   X87_CTRL,
169   X87_STATUS,
170   X87_ST0,
171   X87_ST1,
172   X87_ST2,
173   X87_ST3,
174   X87_ST4,
175   X87_ST5,
176   X87_ST6,
177   X87_ST7,
178};
179
180typedef struct {
181   UINT16 selector;
182   UINT16 flags;
183   UINT32 base;
184   UINT32 limit;
185   int d;      // Operand size
186} I386_SREG;
187
188typedef struct {
189   UINT32 base;
190   UINT16 limit;
191} I386_SYS_TABLE;
192
193typedef struct {
194   UINT16 segment;
195   UINT16 flags;
196   UINT32 base;
197   UINT32 limit;
198} I386_SEG_DESC;
199
200typedef union {
201   UINT32 d[8];
202   UINT16 w[16];
203   UINT8 b[32];
204} I386_GPR;
205
206typedef union {
207   UINT64 i;
208   double f;
209} X87_REG;
210
211typedef struct _i386_state i386_state;
212struct _i386_state
213{
214   I386_GPR reg;
215   I386_SREG sreg[6];
216   UINT32 eip;
217   UINT32 pc;
218   UINT32 prev_eip;
219   UINT32 eflags;
220   UINT8 CF;
221   UINT8 DF;
222   UINT8 SF;
223   UINT8 OF;
224   UINT8 ZF;
225   UINT8 PF;
226   UINT8 AF;
227   UINT8 IF;
228   UINT8 TF;
229
230   UINT8 performed_intersegment_jump;
231
232   UINT32 cr[4];      // Control registers
233   UINT32 dr[8];      // Debug registers
234   UINT32 tr[8];      // Test registers
235
236   I386_SYS_TABLE gdtr;   // Global Descriptor Table Register
237   I386_SYS_TABLE idtr;   // Interrupt Descriptor Table Register
238   I386_SEG_DESC task;      // Task register
239   I386_SEG_DESC ldtr;      // Local Descriptor Table Register
240
241   int halted;
242
243   int operand_size;
244   int address_size;
245
246   int segment_prefix;
247   int segment_override;
248
249   int cycles;
250   int base_cycles;
251   UINT8 opcode;
252
253   UINT8 irq_state;
254   cpu_irq_callback irq_callback;
255   const device_config *device;
256   const address_space *program;
257   const address_space *io;
258   UINT32 a20_mask;
259
260   int cpuid_max_input_value_eax;
261   UINT32 cpuid_id0, cpuid_id1, cpuid_id2;
262   UINT32 cpu_version;
263   UINT32 feature_flags;
264   UINT64 tsc;
265
266   // FPU
267   X87_REG fpu_reg[8];
268   UINT16 fpu_control_word;
269   UINT16 fpu_status_word;
270   UINT16 fpu_tag_word;
271   UINT64 fpu_data_ptr;
272   UINT64 fpu_inst_ptr;
273   UINT16 fpu_opcode;
274   int fpu_top;
275
276   void (*opcode_table1_16[256])(i386_state *cpustate);
277   void (*opcode_table1_32[256])(i386_state *cpustate);
278   void (*opcode_table2_16[256])(i386_state *cpustate);
279   void (*opcode_table2_32[256])(i386_state *cpustate);
280
281   UINT8 *cycle_table_pm;
282   UINT8 *cycle_table_rm;
283};
284
285
286extern int i386_parity_table[256];
287
288#define PROTECTED_MODE      (cpustate->cr[0] & 0x1)
289#define STACK_32BIT         (cpustate->sreg[SS].d)
290#define V8086_MODE         (cpustate->eflags & 0x00020000)
291
292#define SetOF_Add32(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x80000000) ? 1: 0)
293#define SetOF_Add16(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x8000) ? 1 : 0)
294#define SetOF_Add8(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x80) ? 1 : 0)
295
296#define SetOF_Sub32(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x80000000) ? 1 : 0)
297#define SetOF_Sub16(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x8000) ? 1 : 0)
298#define SetOF_Sub8(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x80) ? 1 : 0)
299
300#define SetCF8(x)         {cpustate->CF = ((x) & 0x100) ? 1 : 0; }
301#define SetCF16(x)         {cpustate->CF = ((x) & 0x10000) ? 1 : 0; }
302#define SetCF32(x)         {cpustate->CF = ((x) & (((UINT64)1) << 32)) ? 1 : 0; }
303
304#define SetSF(x)         (cpustate->SF = (x))
305#define SetZF(x)         (cpustate->ZF = (x))
306#define SetAF(x,y,z)      (cpustate->AF = (((x) ^ ((y) ^ (z))) & 0x10) ? 1 : 0)
307#define SetPF(x)         (cpustate->PF = i386_parity_table[(x) & 0xFF])
308
309#define SetSZPF8(x)         {cpustate->ZF = ((UINT8)(x)==0);  cpustate->SF = ((x)&0x80) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
310#define SetSZPF16(x)      {cpustate->ZF = ((UINT16)(x)==0);  cpustate->SF = ((x)&0x8000) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
311#define SetSZPF32(x)      {cpustate->ZF = ((UINT32)(x)==0);  cpustate->SF = ((x)&0x80000000) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
312
313/***********************************************************************************/
314
315typedef struct {
316   struct {
317      int b;
318      int w;
319      int d;
320   } reg;
321   struct {
322      int b;
323      int w;
324      int d;
325   } rm;
326} MODRM_TABLE;
327
328extern MODRM_TABLE i386_MODRM_table[256];
329
330#define REG8(x)         (cpustate->reg.b[x])
331#define REG16(x)      (cpustate->reg.w[x])
332#define REG32(x)      (cpustate->reg.d[x])
333
334#define LOAD_REG8(x)   (REG8(i386_MODRM_table[x].reg.b))
335#define LOAD_REG16(x)   (REG16(i386_MODRM_table[x].reg.w))
336#define LOAD_REG32(x)   (REG32(i386_MODRM_table[x].reg.d))
337#define LOAD_RM8(x)      (REG8(i386_MODRM_table[x].rm.b))
338#define LOAD_RM16(x)   (REG16(i386_MODRM_table[x].rm.w))
339#define LOAD_RM32(x)   (REG32(i386_MODRM_table[x].rm.d))
340
341#define STORE_REG8(x, value)   (REG8(i386_MODRM_table[x].reg.b) = value)
342#define STORE_REG16(x, value)   (REG16(i386_MODRM_table[x].reg.w) = value)
343#define STORE_REG32(x, value)   (REG32(i386_MODRM_table[x].reg.d) = value)
344#define STORE_RM8(x, value)      (REG8(i386_MODRM_table[x].rm.b) = value)
345#define STORE_RM16(x, value)   (REG16(i386_MODRM_table[x].rm.w) = value)
346#define STORE_RM32(x, value)   (REG32(i386_MODRM_table[x].rm.d) = value)
347
348/***********************************************************************************/
349
350INLINE UINT32 i386_translate(i386_state *cpustate, int segment, UINT32 ip)
351{
352   // TODO: segment limit
353   return cpustate->sreg[segment].base + ip;
354}
355
356INLINE int translate_address(i386_state *cpustate, UINT32 *address)
357{
358   UINT32 a = *address;
359   UINT32 pdbr = cpustate->cr[3] & 0xfffff000;
360   UINT32 directory = (a >> 22) & 0x3ff;
361   UINT32 table = (a >> 12) & 0x3ff;
362   UINT32 offset = a & 0xfff;
363
364   // TODO: 4MB pages
365   UINT32 page_dir = memory_read_dword_32le(cpustate->program, pdbr + directory * 4);
366   UINT32 page_entry = memory_read_dword_32le(cpustate->program, (page_dir & 0xfffff000) + (table * 4));
367
368   *address = (page_entry & 0xfffff000) | offset;
369   return 1;
370}
371
372INLINE void CHANGE_PC(i386_state *cpustate, UINT32 pc)
373{
374   UINT32 address;
375   cpustate->pc = i386_translate(cpustate, CS, pc );
376
377   address = cpustate->pc;
378
379   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
380   {
381      translate_address(cpustate,&address);
382   }
383}
384
385INLINE void NEAR_BRANCH(i386_state *cpustate, INT32 offs)
386{
387   UINT32 address;
388   /* TODO: limit */
389   cpustate->eip += offs;
390   cpustate->pc += offs;
391
392   address = cpustate->pc;
393
394   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
395   {
396      translate_address(cpustate,&address);
397   }
398}
399
400INLINE UINT8 FETCH(i386_state *cpustate)
401{
402   UINT8 value;
403   UINT32 address = cpustate->pc;
404
405   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
406   {
407      translate_address(cpustate,&address);
408   }
409
410   value = memory_decrypted_read_byte(cpustate->program, address & cpustate->a20_mask);
411   cpustate->eip++;
412   cpustate->pc++;
413   return value;
414}
415INLINE UINT16 FETCH16(i386_state *cpustate)
416{
417   UINT16 value;
418   UINT32 address = cpustate->pc;
419
420   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
421   {
422      translate_address(cpustate,&address);
423   }
424
425   if( address & 0x1 ) {      /* Unaligned read */
426      address &= cpustate->a20_mask;
427      value = (memory_decrypted_read_byte(cpustate->program, address+0) << 0) |
428            (memory_decrypted_read_byte(cpustate->program, address+1) << 8);
429   } else {
430      address &= cpustate->a20_mask;
431      value = memory_decrypted_read_word(cpustate->program, address);
432   }
433   cpustate->eip += 2;
434   cpustate->pc += 2;
435   return value;
436}
437INLINE UINT32 FETCH32(i386_state *cpustate)
438{
439   UINT32 value;
440   UINT32 address = cpustate->pc;
441
442   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
443   {
444      translate_address(cpustate,&address);
445   }
446
447   if( cpustate->pc & 0x3 ) {      /* Unaligned read */
448      address &= cpustate->a20_mask;
449      value = (memory_decrypted_read_byte(cpustate->program, address+0) << 0) |
450            (memory_decrypted_read_byte(cpustate->program, address+1) << 8) |
451            (memory_decrypted_read_byte(cpustate->program, address+2) << 16) |
452            (memory_decrypted_read_byte(cpustate->program, address+3) << 24);
453   } else {
454      address &= cpustate->a20_mask;
455      value = memory_decrypted_read_dword(cpustate->program, address);
456   }
457   cpustate->eip += 4;
458   cpustate->pc += 4;
459   return value;
460}
461
462INLINE UINT8 READ8(i386_state *cpustate,UINT32 ea)
463{
464   UINT32 address = ea;
465
466   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
467   {
468      translate_address(cpustate,&address);
469   }
470
471   address &= cpustate->a20_mask;
472   return memory_read_byte_32le(cpustate->program, address);
473}
474INLINE UINT16 READ16(i386_state *cpustate,UINT32 ea)
475{
476   UINT16 value;
477   UINT32 address = ea;
478
479   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
480   {
481      translate_address(cpustate,&address);
482   }
483
484   address &= cpustate->a20_mask;
485   if( ea & 0x1 ) {      /* Unaligned read */
486      value = (memory_read_byte_32le( cpustate->program, address+0 ) << 0) |
487            (memory_read_byte_32le( cpustate->program, address+1 ) << 8);
488   } else {
489      value = memory_read_word_32le( cpustate->program, address );
490   }
491   return value;
492}
493INLINE UINT32 READ32(i386_state *cpustate,UINT32 ea)
494{
495   UINT32 value;
496   UINT32 address = ea;
497
498   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
499   {
500      translate_address(cpustate,&address);
501   }
502
503   address &= cpustate->a20_mask;
504   if( ea & 0x3 ) {      /* Unaligned read */
505      value = (memory_read_byte_32le( cpustate->program, address+0 ) << 0) |
506            (memory_read_byte_32le( cpustate->program, address+1 ) << 8) |
507            (memory_read_byte_32le( cpustate->program, address+2 ) << 16) |
508            (memory_read_byte_32le( cpustate->program, address+3 ) << 24);
509   } else {
510      value = memory_read_dword_32le( cpustate->program, address );
511   }
512   return value;
513}
514
515INLINE UINT64 READ64(i386_state *cpustate,UINT32 ea)
516{
517   UINT64 value;
518   UINT32 address = ea;
519
520   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
521   {
522      translate_address(cpustate,&address);
523   }
524
525   address &= cpustate->a20_mask;
526   if( ea & 0x7 ) {      /* Unaligned read */
527      value = (((UINT64) memory_read_byte_32le( cpustate->program, address+0 )) << 0) |
528            (((UINT64) memory_read_byte_32le( cpustate->program, address+1 )) << 8) |
529            (((UINT64) memory_read_byte_32le( cpustate->program, address+2 )) << 16) |
530            (((UINT64) memory_read_byte_32le( cpustate->program, address+3 )) << 24) |
531            (((UINT64) memory_read_byte_32le( cpustate->program, address+4 )) << 32) |
532            (((UINT64) memory_read_byte_32le( cpustate->program, address+5 )) << 40) |
533            (((UINT64) memory_read_byte_32le( cpustate->program, address+6 )) << 48) |
534            (((UINT64) memory_read_byte_32le( cpustate->program, address+7 )) << 56);
535   } else {
536      value = (((UINT64) memory_read_dword_32le( cpustate->program, address+0 )) << 0) |
537            (((UINT64) memory_read_dword_32le( cpustate->program, address+4 )) << 32);
538   }
539   return value;
540}
541
542INLINE void WRITE8(i386_state *cpustate,UINT32 ea, UINT8 value)
543{
544   UINT32 address = ea;
545
546   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
547   {
548      translate_address(cpustate,&address);
549   }
550
551   address &= cpustate->a20_mask;
552   memory_write_byte_32le(cpustate->program, address, value);
553}
554INLINE void WRITE16(i386_state *cpustate,UINT32 ea, UINT16 value)
555{
556   UINT32 address = ea;
557
558   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
559   {
560      translate_address(cpustate,&address);
561   }
562
563   address &= cpustate->a20_mask;
564   if( ea & 0x1 ) {      /* Unaligned write */
565      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
566      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
567   } else {
568      memory_write_word_32le(cpustate->program, address, value);
569   }
570}
571INLINE void WRITE32(i386_state *cpustate,UINT32 ea, UINT32 value)
572{
573   UINT32 address = ea;
574
575   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
576   {
577      translate_address(cpustate,&address);
578   }
579
580   ea &= cpustate->a20_mask;
581   if( ea & 0x3 ) {      /* Unaligned write */
582      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
583      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
584      memory_write_byte_32le( cpustate->program, address+2, (value >> 16) & 0xff );
585      memory_write_byte_32le( cpustate->program, address+3, (value >> 24) & 0xff );
586   } else {
587      memory_write_dword_32le(cpustate->program, address, value);
588   }
589}
590
591INLINE void WRITE64(i386_state *cpustate,UINT32 ea, UINT64 value)
592{
593   UINT32 address = ea;
594
595   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
596   {
597      translate_address(cpustate,&address);
598   }
599
600   ea &= cpustate->a20_mask;
601   if( ea & 0x7 ) {      /* Unaligned write */
602      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
603      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
604      memory_write_byte_32le( cpustate->program, address+2, (value >> 16) & 0xff );
605      memory_write_byte_32le( cpustate->program, address+3, (value >> 24) & 0xff );
606      memory_write_byte_32le( cpustate->program, address+4, (value >> 32) & 0xff );
607      memory_write_byte_32le( cpustate->program, address+5, (value >> 40) & 0xff );
608      memory_write_byte_32le( cpustate->program, address+6, (value >> 48) & 0xff );
609      memory_write_byte_32le( cpustate->program, address+7, (value >> 56) & 0xff );
610   } else {
611      memory_write_dword_32le(cpustate->program, address+0, value & 0xffffffff);
612      memory_write_dword_32le(cpustate->program, address+4, (value >> 32) & 0xffffffff);
613   }
614}
615
616/***********************************************************************************/
617
618INLINE UINT8 OR8(i386_state *cpustate,UINT8 dst, UINT8 src)
619{
620   UINT8 res = dst | src;
621   cpustate->CF = cpustate->OF = 0;
622   SetSZPF8(res);
623   return res;
624}
625INLINE UINT16 OR16(i386_state *cpustate,UINT16 dst, UINT16 src)
626{
627   UINT16 res = dst | src;
628   cpustate->CF = cpustate->OF = 0;
629   SetSZPF16(res);
630   return res;
631}
632INLINE UINT32 OR32(i386_state *cpustate,UINT32 dst, UINT32 src)
633{
634   UINT32 res = dst | src;
635   cpustate->CF = cpustate->OF = 0;
636   SetSZPF32(res);
637   return res;
638}
639
640INLINE UINT8 AND8(i386_state *cpustate,UINT8 dst, UINT8 src)
641{
642   UINT8 res = dst & src;
643   cpustate->CF = cpustate->OF = 0;
644   SetSZPF8(res);
645   return res;
646}
647INLINE UINT16 AND16(i386_state *cpustate,UINT16 dst, UINT16 src)
648{
649   UINT16 res = dst & src;
650   cpustate->CF = cpustate->OF = 0;
651   SetSZPF16(res);
652   return res;
653}
654INLINE UINT32 AND32(i386_state *cpustate,UINT32 dst, UINT32 src)
655{
656   UINT32 res = dst & src;
657   cpustate->CF = cpustate->OF = 0;
658   SetSZPF32(res);
659   return res;
660}
661
662INLINE UINT8 XOR8(i386_state *cpustate,UINT8 dst, UINT8 src)
663{
664   UINT8 res = dst ^ src;
665   cpustate->CF = cpustate->OF = 0;
666   SetSZPF8(res);
667   return res;
668}
669INLINE UINT16 XOR16(i386_state *cpustate,UINT16 dst, UINT16 src)
670{
671   UINT16 res = dst ^ src;
672   cpustate->CF = cpustate->OF = 0;
673   SetSZPF16(res);
674   return res;
675}
676INLINE UINT32 XOR32(i386_state *cpustate,UINT32 dst, UINT32 src)
677{
678   UINT32 res = dst ^ src;
679   cpustate->CF = cpustate->OF = 0;
680   SetSZPF32(res);
681   return res;
682}
683
684INLINE UINT8 SUB8(i386_state *cpustate,UINT8 dst, UINT8 src)
685{
686   UINT16 res = (UINT16)dst - (UINT16)src;
687   SetCF8(res);
688   SetOF_Sub8(res,src,dst);
689   SetAF(res,src,dst);
690   SetSZPF8(res);
691   return (UINT8)res;
692}
693INLINE UINT16 SUB16(i386_state *cpustate,UINT16 dst, UINT16 src)
694{
695   UINT32 res = (UINT32)dst - (UINT32)src;
696   SetCF16(res);
697   SetOF_Sub16(res,src,dst);
698   SetAF(res,src,dst);
699   SetSZPF16(res);
700   return (UINT16)res;
701}
702INLINE UINT32 SUB32(i386_state *cpustate,UINT32 dst, UINT32 src)
703{
704   UINT64 res = (UINT64)dst - (UINT64)src;
705   SetCF32(res);
706   SetOF_Sub32(res,src,dst);
707   SetAF(res,src,dst);
708   SetSZPF32(res);
709   return (UINT32)res;
710}
711
712INLINE UINT8 ADD8(i386_state *cpustate,UINT8 dst, UINT8 src)
713{
714   UINT16 res = (UINT16)dst + (UINT16)src;
715   SetCF8(res);
716   SetOF_Add8(res,src,dst);
717   SetAF(res,src,dst);
718   SetSZPF8(res);
719   return (UINT8)res;
720}
721INLINE UINT16 ADD16(i386_state *cpustate,UINT16 dst, UINT16 src)
722{
723   UINT32 res = (UINT32)dst + (UINT32)src;
724   SetCF16(res);
725   SetOF_Add16(res,src,dst);
726   SetAF(res,src,dst);
727   SetSZPF16(res);
728   return (UINT16)res;
729}
730INLINE UINT32 ADD32(i386_state *cpustate,UINT32 dst, UINT32 src)
731{
732   UINT64 res = (UINT64)dst + (UINT64)src;
733   SetCF32(res);
734   SetOF_Add32(res,src,dst);
735   SetAF(res,src,dst);
736   SetSZPF32(res);
737   return (UINT32)res;
738}
739
740INLINE UINT8 INC8(i386_state *cpustate,UINT8 dst)
741{
742   UINT16 res = (UINT16)dst + 1;
743   SetOF_Add8(res,1,dst);
744   SetAF(res,1,dst);
745   SetSZPF8(res);
746   return (UINT8)res;
747}
748INLINE UINT16 INC16(i386_state *cpustate,UINT16 dst)
749{
750   UINT32 res = (UINT32)dst + 1;
751   SetOF_Add16(res,1,dst);
752   SetAF(res,1,dst);
753   SetSZPF16(res);
754   return (UINT16)res;
755}
756INLINE UINT32 INC32(i386_state *cpustate,UINT32 dst)
757{
758   UINT64 res = (UINT64)dst + 1;
759   SetOF_Add32(res,1,dst);
760   SetAF(res,1,dst);
761   SetSZPF32(res);
762   return (UINT32)res;
763}
764
765INLINE UINT8 DEC8(i386_state *cpustate,UINT8 dst)
766{
767   UINT16 res = (UINT16)dst - 1;
768   SetOF_Sub8(res,1,dst);
769   SetAF(res,1,dst);
770   SetSZPF8(res);
771   return (UINT8)res;
772}
773INLINE UINT16 DEC16(i386_state *cpustate,UINT16 dst)
774{
775   UINT32 res = (UINT32)dst - 1;
776   SetOF_Sub16(res,1,dst);
777   SetAF(res,1,dst);
778   SetSZPF16(res);
779   return (UINT16)res;
780}
781INLINE UINT32 DEC32(i386_state *cpustate,UINT32 dst)
782{
783   UINT64 res = (UINT64)dst - 1;
784   SetOF_Sub32(res,1,dst);
785   SetAF(res,1,dst);
786   SetSZPF32(res);
787   return (UINT32)res;
788}
789
790
791
792INLINE void PUSH16(i386_state *cpustate,UINT16 value)
793{
794   UINT32 ea;
795   if( STACK_32BIT ) {
796      REG32(ESP) -= 2;
797      ea = i386_translate(cpustate, SS, REG32(ESP) );
798      WRITE16(cpustate, ea, value );
799   } else {
800      REG16(SP) -= 2;
801      ea = i386_translate(cpustate, SS, REG16(SP) );
802      WRITE16(cpustate, ea, value );
803   }
804}
805INLINE void PUSH32(i386_state *cpustate,UINT32 value)
806{
807   UINT32 ea;
808   if( STACK_32BIT ) {
809      REG32(ESP) -= 4;
810      ea = i386_translate(cpustate, SS, REG32(ESP) );
811      WRITE32(cpustate, ea, value );
812   } else {
813      REG16(SP) -= 4;
814      ea = i386_translate(cpustate, SS, REG16(SP) );
815      WRITE32(cpustate, ea, value );
816   }
817}
818INLINE void PUSH8(i386_state *cpustate,UINT8 value)
819{
820   if( cpustate->operand_size ) {
821      PUSH32(cpustate,(INT32)(INT8)value);
822   } else {
823      PUSH16(cpustate,(INT16)(INT8)value);
824   }
825}
826
827INLINE UINT8 POP8(i386_state *cpustate)
828{
829   UINT8 value;
830   UINT32 ea;
831   if( STACK_32BIT ) {
832      ea = i386_translate(cpustate, SS, REG32(ESP) );
833      value = READ8(cpustate, ea );
834      REG32(ESP) += 1;
835   } else {
836      ea = i386_translate(cpustate, SS, REG16(SP) );
837      value = READ8(cpustate, ea );
838      REG16(SP) += 1;
839   }
840   return value;
841}
842INLINE UINT16 POP16(i386_state *cpustate)
843{
844   UINT16 value;
845   UINT32 ea;
846   if( STACK_32BIT ) {
847      ea = i386_translate(cpustate, SS, REG32(ESP) );
848      value = READ16(cpustate, ea );
849      REG32(ESP) += 2;
850   } else {
851      ea = i386_translate(cpustate, SS, REG16(SP) );
852      value = READ16(cpustate, ea );
853      REG16(SP) += 2;
854   }
855   return value;
856}
857INLINE UINT32 POP32(i386_state *cpustate)
858{
859   UINT32 value;
860   UINT32 ea;
861   if( STACK_32BIT ) {
862      ea = i386_translate(cpustate, SS, REG32(ESP) );
863      value = READ32(cpustate, ea );
864      REG32(ESP) += 4;
865   } else {
866      ea = i386_translate(cpustate, SS, REG16(SP) );
867      value = READ32(cpustate, ea );
868      REG16(SP) += 4;
869   }
870   return value;
871}
872
873INLINE void BUMP_SI(i386_state *cpustate,int adjustment)
874{
875   if ( cpustate->address_size )
876      REG32(ESI) += ((cpustate->DF) ? -adjustment : +adjustment);
877   else
878      REG16(SI) += ((cpustate->DF) ? -adjustment : +adjustment);
879}
880
881INLINE void BUMP_DI(i386_state *cpustate,int adjustment)
882{
883   if ( cpustate->address_size )
884      REG32(EDI) += ((cpustate->DF) ? -adjustment : +adjustment);
885   else
886      REG16(DI) += ((cpustate->DF) ? -adjustment : +adjustment);
887}
888
889
890
891/***********************************************************************************/
892
893#define READPORT8(port)                (memory_read_byte_32le(cpustate->io, port))
894#define READPORT16(port)             (memory_read_word_32le(cpustate->io, port))
895#define READPORT32(port)             (memory_read_dword_32le(cpustate->io, port))
896#define WRITEPORT8(port, value)      (memory_write_byte_32le(cpustate->io, port, value))
897#define WRITEPORT16(port, value)   (memory_write_word_32le(cpustate->io, port, value))
898#define WRITEPORT32(port, value)   (memory_write_dword_32le(cpustate->io, port, value))
899
900#endif /* __I386_H__ */
25#endif /* __I386INTF_H__ */
src/emu/cpu/i386/i386priv.h
r0r3958
1#pragma once
2
3#ifndef __I386_H__
4#define __I386_H__
5
6#include "cpuintrf.h"
7
8#define I386OP(XX)      i386_##XX
9#define I486OP(XX)      i486_##XX
10#define PENTIUMOP(XX)   pentium_##XX
11#define MMXOP(XX)      mmx_##XX
12
13extern int i386_dasm_one(char *buffer, UINT32 pc, const UINT8 *oprom, int mode);
14
15typedef enum { ES, CS, SS, DS, FS, GS } SREGS;
16
17#ifdef LSB_FIRST
18typedef enum
19{
20   AL = 0,
21   AH = 1,
22   CL = 4,
23   CH = 5,
24   DL = 8,
25   DH = 9,
26   BL = 12,
27   BH = 13
28} BREGS;
29#else
30typedef enum
31{
32   AL = 3,
33   AH = 2,
34   CL = 7,
35   CH = 6,
36   DL = 11,
37   DH = 10,
38   BL = 15,
39   BH = 14
40} BREGS;
41#endif
42
43#ifdef LSB_FIRST
44typedef enum
45{
46   AX = 0,
47   CX = 2,
48   DX = 4,
49   BX = 6,
50   SP = 8,
51   BP = 10,
52   SI = 12,
53   DI = 14
54} WREGS;
55#else
56typedef enum
57{
58   AX = 1,
59   CX = 3,
60   DX = 5,
61   BX = 7,
62   SP = 9,
63   BP = 11,
64   SI = 13,
65   DI = 15
66} WREGS;
67#endif
68
69typedef enum { EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI } DREGS;
70
71enum
72{
73   I386_PC = 0,
74
75   /* 8-bit registers */
76   I386_AL,
77   I386_AH,
78   I386_BL,
79   I386_BH,
80   I386_CL,
81   I386_CH,
82   I386_DL,
83   I386_DH,
84
85   /* 16-bit registers */
86   I386_AX,
87   I386_BX,
88   I386_CX,
89   I386_DX,
90   I386_BP,
91   I386_SP,
92   I386_SI,
93   I386_DI,
94   I386_IP,
95
96   /* 32-bit registers */
97   I386_EAX,
98   I386_ECX,
99   I386_EDX,
100   I386_EBX,
101   I386_EBP,
102   I386_ESP,
103   I386_ESI,
104   I386_EDI,
105   I386_EIP,
106
107   /* segment registers */
108   I386_CS,
109   I386_CS_BASE,
110   I386_CS_LIMIT,
111   I386_CS_FLAGS,
112   I386_SS,
113   I386_SS_BASE,
114   I386_SS_LIMIT,
115   I386_SS_FLAGS,
116   I386_DS,
117   I386_DS_BASE,
118   I386_DS_LIMIT,
119   I386_DS_FLAGS,
120   I386_ES,
121   I386_ES_BASE,
122   I386_ES_LIMIT,
123   I386_ES_FLAGS,
124   I386_FS,
125   I386_FS_BASE,
126   I386_FS_LIMIT,
127   I386_FS_FLAGS,
128   I386_GS,
129   I386_GS_BASE,
130   I386_GS_LIMIT,
131   I386_GS_FLAGS,
132
133   /* other */
134   I386_EFLAGS,
135
136   I386_CR0,
137   I386_CR1,
138   I386_CR2,
139   I386_CR3,
140
141   I386_DR0,
142   I386_DR1,
143   I386_DR2,
144   I386_DR3,
145   I386_DR4,
146   I386_DR5,
147   I386_DR6,
148   I386_DR7,
149
150   I386_TR6,
151   I386_TR7,
152
153   I386_GDTR_BASE,
154   I386_GDTR_LIMIT,
155   I386_IDTR_BASE,
156   I386_IDTR_LIMIT,
157   I386_TR,
158   I386_TR_BASE,
159   I386_TR_LIMIT,
160   I386_TR_FLAGS,
161   I386_LDTR,
162   I386_LDTR_BASE,
163   I386_LDTR_LIMIT,
164   I386_LDTR_FLAGS,
165
166   X87_CTRL,
167   X87_STATUS,
168   X87_ST0,
169   X87_ST1,
170   X87_ST2,
171   X87_ST3,
172   X87_ST4,
173   X87_ST5,
174   X87_ST6,
175   X87_ST7,
176};
177
178typedef struct {
179   UINT16 selector;
180   UINT16 flags;
181   UINT32 base;
182   UINT32 limit;
183   int d;      // Operand size
184} I386_SREG;
185
186typedef struct {
187   UINT32 base;
188   UINT16 limit;
189} I386_SYS_TABLE;
190
191typedef struct {
192   UINT16 segment;
193   UINT16 flags;
194   UINT32 base;
195   UINT32 limit;
196} I386_SEG_DESC;
197
198typedef union {
199   UINT32 d[8];
200   UINT16 w[16];
201   UINT8 b[32];
202} I386_GPR;
203
204typedef union {
205   UINT64 i;
206   double f;
207} X87_REG;
208
209typedef struct _i386_state i386_state;
210struct _i386_state
211{
212   I386_GPR reg;
213   I386_SREG sreg[6];
214   UINT32 eip;
215   UINT32 pc;
216   UINT32 prev_eip;
217   UINT32 eflags;
218   UINT8 CF;
219   UINT8 DF;
220   UINT8 SF;
221   UINT8 OF;
222   UINT8 ZF;
223   UINT8 PF;
224   UINT8 AF;
225   UINT8 IF;
226   UINT8 TF;
227
228   UINT8 performed_intersegment_jump;
229
230   UINT32 cr[4];      // Control registers
231   UINT32 dr[8];      // Debug registers
232   UINT32 tr[8];      // Test registers
233
234   I386_SYS_TABLE gdtr;   // Global Descriptor Table Register
235   I386_SYS_TABLE idtr;   // Interrupt Descriptor Table Register
236   I386_SEG_DESC task;      // Task register
237   I386_SEG_DESC ldtr;      // Local Descriptor Table Register
238
239   int halted;
240
241   int operand_size;
242   int address_size;
243
244   int segment_prefix;
245   int segment_override;
246
247   int cycles;
248   int base_cycles;
249   UINT8 opcode;
250
251   UINT8 irq_state;
252   cpu_irq_callback irq_callback;
253   const device_config *device;
254   const address_space *program;
255   const address_space *io;
256   UINT32 a20_mask;
257
258   int cpuid_max_input_value_eax;
259   UINT32 cpuid_id0, cpuid_id1, cpuid_id2;
260   UINT32 cpu_version;
261   UINT32 feature_flags;
262   UINT64 tsc;
263
264   // FPU
265   X87_REG fpu_reg[8];
266   UINT16 fpu_control_word;
267   UINT16 fpu_status_word;
268   UINT16 fpu_tag_word;
269   UINT64 fpu_data_ptr;
270   UINT64 fpu_inst_ptr;
271   UINT16 fpu_opcode;
272   int fpu_top;
273
274   void (*opcode_table1_16[256])(i386_state *cpustate);
275   void (*opcode_table1_32[256])(i386_state *cpustate);
276   void (*opcode_table2_16[256])(i386_state *cpustate);
277   void (*opcode_table2_32[256])(i386_state *cpustate);
278
279   UINT8 *cycle_table_pm;
280   UINT8 *cycle_table_rm;
281};
282
283
284extern int i386_parity_table[256];
285
286#define PROTECTED_MODE      (cpustate->cr[0] & 0x1)
287#define STACK_32BIT         (cpustate->sreg[SS].d)
288#define V8086_MODE         (cpustate->eflags & 0x00020000)
289
290#define SetOF_Add32(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x80000000) ? 1: 0)
291#define SetOF_Add16(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x8000) ? 1 : 0)
292#define SetOF_Add8(r,s,d)   (cpustate->OF = (((r) ^ (s)) & ((r) ^ (d)) & 0x80) ? 1 : 0)
293
294#define SetOF_Sub32(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x80000000) ? 1 : 0)
295#define SetOF_Sub16(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x8000) ? 1 : 0)
296#define SetOF_Sub8(r,s,d)   (cpustate->OF = (((d) ^ (s)) & ((d) ^ (r)) & 0x80) ? 1 : 0)
297
298#define SetCF8(x)         {cpustate->CF = ((x) & 0x100) ? 1 : 0; }
299#define SetCF16(x)         {cpustate->CF = ((x) & 0x10000) ? 1 : 0; }
300#define SetCF32(x)         {cpustate->CF = ((x) & (((UINT64)1) << 32)) ? 1 : 0; }
301
302#define SetSF(x)         (cpustate->SF = (x))
303#define SetZF(x)         (cpustate->ZF = (x))
304#define SetAF(x,y,z)      (cpustate->AF = (((x) ^ ((y) ^ (z))) & 0x10) ? 1 : 0)
305#define SetPF(x)         (cpustate->PF = i386_parity_table[(x) & 0xFF])
306
307#define SetSZPF8(x)         {cpustate->ZF = ((UINT8)(x)==0);  cpustate->SF = ((x)&0x80) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
308#define SetSZPF16(x)      {cpustate->ZF = ((UINT16)(x)==0);  cpustate->SF = ((x)&0x8000) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
309#define SetSZPF32(x)      {cpustate->ZF = ((UINT32)(x)==0);  cpustate->SF = ((x)&0x80000000) ? 1 : 0; cpustate->PF = i386_parity_table[x & 0xFF]; }
310
311/***********************************************************************************/
312
313typedef struct {
314   struct {
315      int b;
316      int w;
317      int d;
318   } reg;
319   struct {
320      int b;
321      int w;
322      int d;
323   } rm;
324} MODRM_TABLE;
325
326extern MODRM_TABLE i386_MODRM_table[256];
327
328#define REG8(x)         (cpustate->reg.b[x])
329#define REG16(x)      (cpustate->reg.w[x])
330#define REG32(x)      (cpustate->reg.d[x])
331
332#define LOAD_REG8(x)   (REG8(i386_MODRM_table[x].reg.b))
333#define LOAD_REG16(x)   (REG16(i386_MODRM_table[x].reg.w))
334#define LOAD_REG32(x)   (REG32(i386_MODRM_table[x].reg.d))
335#define LOAD_RM8(x)      (REG8(i386_MODRM_table[x].rm.b))
336#define LOAD_RM16(x)   (REG16(i386_MODRM_table[x].rm.w))
337#define LOAD_RM32(x)   (REG32(i386_MODRM_table[x].rm.d))
338
339#define STORE_REG8(x, value)   (REG8(i386_MODRM_table[x].reg.b) = value)
340#define STORE_REG16(x, value)   (REG16(i386_MODRM_table[x].reg.w) = value)
341#define STORE_REG32(x, value)   (REG32(i386_MODRM_table[x].reg.d) = value)
342#define STORE_RM8(x, value)      (REG8(i386_MODRM_table[x].rm.b) = value)
343#define STORE_RM16(x, value)   (REG16(i386_MODRM_table[x].rm.w) = value)
344#define STORE_RM32(x, value)   (REG32(i386_MODRM_table[x].rm.d) = value)
345
346/***********************************************************************************/
347
348INLINE UINT32 i386_translate(i386_state *cpustate, int segment, UINT32 ip)
349{
350   // TODO: segment limit
351   return cpustate->sreg[segment].base + ip;
352}
353
354INLINE int translate_address(i386_state *cpustate, UINT32 *address)
355{
356   UINT32 a = *address;
357   UINT32 pdbr = cpustate->cr[3] & 0xfffff000;
358   UINT32 directory = (a >> 22) & 0x3ff;
359   UINT32 table = (a >> 12) & 0x3ff;
360   UINT32 offset = a & 0xfff;
361
362   // TODO: 4MB pages
363   UINT32 page_dir = memory_read_dword_32le(cpustate->program, pdbr + directory * 4);
364   UINT32 page_entry = memory_read_dword_32le(cpustate->program, (page_dir & 0xfffff000) + (table * 4));
365
366   *address = (page_entry & 0xfffff000) | offset;
367   return 1;
368}
369
370INLINE void CHANGE_PC(i386_state *cpustate, UINT32 pc)
371{
372   UINT32 address;
373   cpustate->pc = i386_translate(cpustate, CS, pc );
374
375   address = cpustate->pc;
376
377   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
378   {
379      translate_address(cpustate,&address);
380   }
381}
382
383INLINE void NEAR_BRANCH(i386_state *cpustate, INT32 offs)
384{
385   UINT32 address;
386   /* TODO: limit */
387   cpustate->eip += offs;
388   cpustate->pc += offs;
389
390   address = cpustate->pc;
391
392   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
393   {
394      translate_address(cpustate,&address);
395   }
396}
397
398INLINE UINT8 FETCH(i386_state *cpustate)
399{
400   UINT8 value;
401   UINT32 address = cpustate->pc;
402
403   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
404   {
405      translate_address(cpustate,&address);
406   }
407
408   value = memory_decrypted_read_byte(cpustate->program, address & cpustate->a20_mask);
409   cpustate->eip++;
410   cpustate->pc++;
411   return value;
412}
413INLINE UINT16 FETCH16(i386_state *cpustate)
414{
415   UINT16 value;
416   UINT32 address = cpustate->pc;
417
418   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
419   {
420      translate_address(cpustate,&address);
421   }
422
423   if( address & 0x1 ) {      /* Unaligned read */
424      address &= cpustate->a20_mask;
425      value = (memory_decrypted_read_byte(cpustate->program, address+0) << 0) |
426            (memory_decrypted_read_byte(cpustate->program, address+1) << 8);
427   } else {
428      address &= cpustate->a20_mask;
429      value = memory_decrypted_read_word(cpustate->program, address);
430   }
431   cpustate->eip += 2;
432   cpustate->pc += 2;
433   return value;
434}
435INLINE UINT32 FETCH32(i386_state *cpustate)
436{
437   UINT32 value;
438   UINT32 address = cpustate->pc;
439
440   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
441   {
442      translate_address(cpustate,&address);
443   }
444
445   if( cpustate->pc & 0x3 ) {      /* Unaligned read */
446      address &= cpustate->a20_mask;
447      value = (memory_decrypted_read_byte(cpustate->program, address+0) << 0) |
448            (memory_decrypted_read_byte(cpustate->program, address+1) << 8) |
449            (memory_decrypted_read_byte(cpustate->program, address+2) << 16) |
450            (memory_decrypted_read_byte(cpustate->program, address+3) << 24);
451   } else {
452      address &= cpustate->a20_mask;
453      value = memory_decrypted_read_dword(cpustate->program, address);
454   }
455   cpustate->eip += 4;
456   cpustate->pc += 4;
457   return value;
458}
459
460INLINE UINT8 READ8(i386_state *cpustate,UINT32 ea)
461{
462   UINT32 address = ea;
463
464   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
465   {
466      translate_address(cpustate,&address);
467   }
468
469   address &= cpustate->a20_mask;
470   return memory_read_byte_32le(cpustate->program, address);
471}
472INLINE UINT16 READ16(i386_state *cpustate,UINT32 ea)
473{
474   UINT16 value;
475   UINT32 address = ea;
476
477   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
478   {
479      translate_address(cpustate,&address);
480   }
481
482   address &= cpustate->a20_mask;
483   if( ea & 0x1 ) {      /* Unaligned read */
484      value = (memory_read_byte_32le( cpustate->program, address+0 ) << 0) |
485            (memory_read_byte_32le( cpustate->program, address+1 ) << 8);
486   } else {
487      value = memory_read_word_32le( cpustate->program, address );
488   }
489   return value;
490}
491INLINE UINT32 READ32(i386_state *cpustate,UINT32 ea)
492{
493   UINT32 value;
494   UINT32 address = ea;
495
496   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
497   {
498      translate_address(cpustate,&address);
499   }
500
501   address &= cpustate->a20_mask;
502   if( ea & 0x3 ) {      /* Unaligned read */
503      value = (memory_read_byte_32le( cpustate->program, address+0 ) << 0) |
504            (memory_read_byte_32le( cpustate->program, address+1 ) << 8) |
505            (memory_read_byte_32le( cpustate->program, address+2 ) << 16) |
506            (memory_read_byte_32le( cpustate->program, address+3 ) << 24);
507   } else {
508      value = memory_read_dword_32le( cpustate->program, address );
509   }
510   return value;
511}
512
513INLINE UINT64 READ64(i386_state *cpustate,UINT32 ea)
514{
515   UINT64 value;
516   UINT32 address = ea;
517
518   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
519   {
520      translate_address(cpustate,&address);
521   }
522
523   address &= cpustate->a20_mask;
524   if( ea & 0x7 ) {      /* Unaligned read */
525      value = (((UINT64) memory_read_byte_32le( cpustate->program, address+0 )) << 0) |
526            (((UINT64) memory_read_byte_32le( cpustate->program, address+1 )) << 8) |
527            (((UINT64) memory_read_byte_32le( cpustate->program, address+2 )) << 16) |
528            (((UINT64) memory_read_byte_32le( cpustate->program, address+3 )) << 24) |
529            (((UINT64) memory_read_byte_32le( cpustate->program, address+4 )) << 32) |
530            (((UINT64) memory_read_byte_32le( cpustate->program, address+5 )) << 40) |
531            (((UINT64) memory_read_byte_32le( cpustate->program, address+6 )) << 48) |
532            (((UINT64) memory_read_byte_32le( cpustate->program, address+7 )) << 56);
533   } else {
534      value = (((UINT64) memory_read_dword_32le( cpustate->program, address+0 )) << 0) |
535            (((UINT64) memory_read_dword_32le( cpustate->program, address+4 )) << 32);
536   }
537   return value;
538}
539
540INLINE void WRITE8(i386_state *cpustate,UINT32 ea, UINT8 value)
541{
542   UINT32 address = ea;
543
544   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
545   {
546      translate_address(cpustate,&address);
547   }
548
549   address &= cpustate->a20_mask;
550   memory_write_byte_32le(cpustate->program, address, value);
551}
552INLINE void WRITE16(i386_state *cpustate,UINT32 ea, UINT16 value)
553{
554   UINT32 address = ea;
555
556   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
557   {
558      translate_address(cpustate,&address);
559   }
560
561   address &= cpustate->a20_mask;
562   if( ea & 0x1 ) {      /* Unaligned write */
563      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
564      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
565   } else {
566      memory_write_word_32le(cpustate->program, address, value);
567   }
568}
569INLINE void WRITE32(i386_state *cpustate,UINT32 ea, UINT32 value)
570{
571   UINT32 address = ea;
572
573   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
574   {
575      translate_address(cpustate,&address);
576   }
577
578   ea &= cpustate->a20_mask;
579   if( ea & 0x3 ) {      /* Unaligned write */
580      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
581      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
582      memory_write_byte_32le( cpustate->program, address+2, (value >> 16) & 0xff );
583      memory_write_byte_32le( cpustate->program, address+3, (value >> 24) & 0xff );
584   } else {
585      memory_write_dword_32le(cpustate->program, address, value);
586   }
587}
588
589INLINE void WRITE64(i386_state *cpustate,UINT32 ea, UINT64 value)
590{
591   UINT32 address = ea;
592
593   if (cpustate->cr[0] & 0x80000000)      // page translation enabled
594   {
595      translate_address(cpustate,&address);
596   }
597
598   ea &= cpustate->a20_mask;
599   if( ea & 0x7 ) {      /* Unaligned write */
600      memory_write_byte_32le( cpustate->program, address+0, value & 0xff );
601      memory_write_byte_32le( cpustate->program, address+1, (value >> 8) & 0xff );
602      memory_write_byte_32le( cpustate->program, address+2, (value >> 16) & 0xff );
603      memory_write_byte_32le( cpustate->program, address+3, (value >> 24) & 0xff );
604      memory_write_byte_32le( cpustate->program, address+4, (value >> 32) & 0xff );
605      memory_write_byte_32le( cpustate->program, address+5, (value >> 40) & 0xff );
606      memory_write_byte_32le( cpustate->program, address+6, (value >> 48) & 0xff );
607      memory_write_byte_32le( cpustate->program, address+7, (value >> 56) & 0xff );
608   } else {
609      memory_write_dword_32le(cpustate->program, address+0, value & 0xffffffff);
610      memory_write_dword_32le(cpustate->program, address+4, (value >> 32) & 0xffffffff);
611   }
612}
613
614/***********************************************************************************/
615
616INLINE UINT8 OR8(i386_state *cpustate,UINT8 dst, UINT8 src)
617{
618   UINT8 res = dst | src;
619   cpustate->CF = cpustate->OF = 0;
620   SetSZPF8(res);
621   return res;
622}
623INLINE UINT16 OR16(i386_state *cpustate,UINT16 dst, UINT16 src)
624{
625   UINT16 res = dst | src;
626   cpustate->CF = cpustate->OF = 0;
627   SetSZPF16(res);
628   return res;
629}
630INLINE UINT32 OR32(i386_state *cpustate,UINT32 dst, UINT32 src)
631{
632   UINT32 res = dst | src;
633   cpustate->CF = cpustate->OF = 0;
634   SetSZPF32(res);
635   return res;
636}
637
638INLINE UINT8 AND8(i386_state *cpustate,UINT8 dst, UINT8 src)
639{
640   UINT8 res = dst & src;
641   cpustate->CF = cpustate->OF = 0;
642   SetSZPF8(res);
643   return res;
644}
645INLINE UINT16 AND16(i386_state *cpustate,UINT16 dst, UINT16 src)
646{
647   UINT16 res = dst & src;
648   cpustate->CF = cpustate->OF = 0;
649   SetSZPF16(res);
650   return res;
651}
652INLINE UINT32 AND32(i386_state *cpustate,UINT32 dst, UINT32 src)
653{
654   UINT32 res = dst & src;
655   cpustate->CF = cpustate->OF = 0;
656   SetSZPF32(res);
657   return res;
658}
659
660INLINE UINT8 XOR8(i386_state *cpustate,UINT8 dst, UINT8 src)
661{
662   UINT8 res = dst ^ src;
663   cpustate->CF = cpustate->OF = 0;
664   SetSZPF8(res);
665   return res;
666}
667INLINE UINT16 XOR16(i386_state *cpustate,UINT16 dst, UINT16 src)
668{
669   UINT16 res = dst ^ src;
670   cpustate->CF = cpustate->OF = 0;
671   SetSZPF16(res);
672   return res;
673}
674INLINE UINT32 XOR32(i386_state *cpustate,UINT32 dst, UINT32 src)
675{
676   UINT32 res = dst ^ src;
677   cpustate->CF = cpustate->OF = 0;
678   SetSZPF32(res);
679   return res;
680}
681
682INLINE UINT8 SUB8(i386_state *cpustate,UINT8 dst, UINT8 src)
683{
684   UINT16 res = (UINT16)dst - (UINT16)src;
685   SetCF8(res);
686   SetOF_Sub8(res,src,dst);
687   SetAF(res,src,dst);
688   SetSZPF8(res);
689   return (UINT8)res;
690}
691INLINE UINT16 SUB16(i386_state *cpustate,UINT16 dst, UINT16 src)
692{
693   UINT32 res = (UINT32)dst - (UINT32)src;
694   SetCF16(res);
695   SetOF_Sub16(res,src,dst);
696   SetAF(res,src,dst);
697   SetSZPF16(res);
698   return (UINT16)res;
699}
700INLINE UINT32 SUB32(i386_state *cpustate,UINT32 dst, UINT32 src)
701{
702   UINT64 res = (UINT64)dst - (UINT64)src;
703   SetCF32(res);
704   SetOF_Sub32(res,src,dst);
705   SetAF(res,src,dst);
706   SetSZPF32(res);
707   return (UINT32)res;
708}
709
710INLINE UINT8 ADD8(i386_state *cpustate,UINT8 dst, UINT8 src)
711{
712   UINT16 res = (UINT16)dst + (UINT16)src;
713   SetCF8(res);
714   SetOF_Add8(res,src,dst);
715   SetAF(res,src,dst);
716   SetSZPF8(res);
717   return (UINT8)res;
718}
719INLINE UINT16 ADD16(i386_state *cpustate,UINT16 dst, UINT16 src)
720{
721   UINT32 res = (UINT32)dst + (UINT32)src;
722   SetCF16(res);
723   SetOF_Add16(res,src,dst);
724   SetAF(res,src,dst);
725   SetSZPF16(res);
726   return (UINT16)res;
727}
728INLINE UINT32 ADD32(i386_state *cpustate,UINT32 dst, UINT32 src)
729{
730   UINT64 res = (UINT64)dst + (UINT64)src;
731   SetCF32(res);
732   SetOF_Add32(res,src,dst);
733   SetAF(res,src,dst);
734   SetSZPF32(res);
735   return (UINT32)res;
736}
737
738INLINE UINT8 INC8(i386_state *cpustate,UINT8 dst)
739{
740   UINT16 res = (UINT16)dst + 1;
741   SetOF_Add8(res,1,dst);
742   SetAF(res,1,dst);
743   SetSZPF8(res);
744   return (UINT8)res;
745}
746INLINE UINT16 INC16(i386_state *cpustate,UINT16 dst)
747{
748   UINT32 res = (UINT32)dst + 1;
749   SetOF_Add16(res,1,dst);
750   SetAF(res,1,dst);
751   SetSZPF16(res);
752   return (UINT16)res;
753}
754INLINE UINT32 INC32(i386_state *cpustate,UINT32 dst)
755{
756   UINT64 res = (UINT64)dst + 1;
757   SetOF_Add32(res,1,dst);
758   SetAF(res,1,dst);
759   SetSZPF32(res);
760   return (UINT32)res;
761}
762
763INLINE UINT8 DEC8(i386_state *cpustate,UINT8 dst)
764{
765   UINT16 res = (UINT16)dst - 1;
766   SetOF_Sub8(res,1,dst);
767   SetAF(res,1,dst);
768   SetSZPF8(res);
769   return (UINT8)res;
770}
771INLINE UINT16 DEC16(i386_state *cpustate,UINT16 dst)
772{
773   UINT32 res = (UINT32)dst - 1;
774   SetOF_Sub16(res,1,dst);
775   SetAF(res,1,dst);
776   SetSZPF16(res);
777   return (UINT16)res;
778}
779INLINE UINT32 DEC32(i386_state *cpustate,UINT32 dst)
780{
781   UINT64 res = (UINT64)dst - 1;
782   SetOF_Sub32(res,1,dst);
783   SetAF(res,1,dst);
784   SetSZPF32(res);
785   return (UINT32)res;
786}
787
788
789
790INLINE void PUSH16(i386_state *cpustate,UINT16 value)
791{
792   UINT32 ea;
793   if( STACK_32BIT ) {
794      REG32(ESP) -= 2;
795      ea = i386_translate(cpustate, SS, REG32(ESP) );
796      WRITE16(cpustate, ea, value );
797   } else {
798      REG16(SP) -= 2;
799      ea = i386_translate(cpustate, SS, REG16(SP) );
800      WRITE16(cpustate, ea, value );
801   }
802}
803INLINE void PUSH32(i386_state *cpustate,UINT32 value)
804{
805   UINT32 ea;
806   if( STACK_32BIT ) {
807      REG32(ESP) -= 4;
808      ea = i386_translate(cpustate, SS, REG32(ESP) );
809      WRITE32(cpustate, ea, value );
810   } else {
811      REG16(SP) -= 4;
812      ea = i386_translate(cpustate, SS, REG16(SP) );
813      WRITE32(cpustate, ea, value );
814   }
815}
816INLINE void PUSH8(i386_state *cpustate,UINT8 value)
817{
818   if( cpustate->operand_size ) {
819      PUSH32(cpustate,(INT32)(INT8)value);
820   } else {
821      PUSH16(cpustate,(INT16)(INT8)value);
822   }
823}
824
825INLINE UINT8 POP8(i386_state *cpustate)
826{
827   UINT8 value;
828   UINT32 ea;
829   if( STACK_32BIT ) {
830      ea = i386_translate(cpustate, SS, REG32(ESP) );
831      value = READ8(cpustate, ea );
832      REG32(ESP) += 1;
833   } else {
834      ea = i386_translate(cpustate, SS, REG16(SP) );
835      value = READ8(cpustate, ea );
836      REG16(SP) += 1;
837   }
838   return value;
839}
840INLINE UINT16 POP16(i386_state *cpustate)
841{
842   UINT16 value;
843   UINT32 ea;
844   if( STACK_32BIT ) {
845      ea = i386_translate(cpustate, SS, REG32(ESP) );
846      value = READ16(cpustate, ea );
847      REG32(ESP) += 2;
848   } else {
849      ea = i386_translate(cpustate, SS, REG16(SP) );
850      value = READ16(cpustate, ea );
851      REG16(SP) += 2;
852   }
853   return value;
854}
855INLINE UINT32 POP32(i386_state *cpustate)
856{
857   UINT32 value;
858   UINT32 ea;
859   if( STACK_32BIT ) {
860      ea = i386_translate(cpustate, SS, REG32(ESP) );
861      value = READ32(cpustate, ea );
862      REG32(ESP) += 4;
863   } else {
864      ea = i386_translate(cpustate, SS, REG16(SP) );
865      value = READ32(cpustate, ea );
866      REG16(SP) += 4;
867   }
868   return value;
869}
870
871INLINE void BUMP_SI(i386_state *cpustate,int adjustment)
872{
873   if ( cpustate->address_size )
874      REG32(ESI) += ((cpustate->DF) ? -adjustment : +adjustment);
875   else
876      REG16(SI) += ((cpustate->DF) ? -adjustment : +adjustment);
877}
878
879INLINE void BUMP_DI(i386_state *cpustate,int adjustment)
880{
881   if ( cpustate->address_size )
882      REG32(EDI) += ((cpustate->DF) ? -adjustment : +adjustment);
883   else
884      REG16(DI) += ((cpustate->DF) ? -adjustment : +adjustment);
885}
886
887
888
889/***********************************************************************************/
890
891#define READPORT8(port)                (memory_read_byte_32le(cpustate->io, port))
892#define READPORT16(port)             (memory_read_word_32le(cpustate->io, port))
893#define READPORT32(port)             (memory_read_dword_32le(cpustate->io, port))
894#define WRITEPORT8(port, value)      (memory_write_byte_32le(cpustate->io, port, value))
895#define WRITEPORT16(port, value)   (memory_write_word_32le(cpustate->io, port, value))
896#define WRITEPORT32(port, value)   (memory_write_dword_32le(cpustate->io, port, value))
897
898#endif /* __I386_H__ */
src/emu/cpu/i386/i386.c
r3957r3958
1111*/
1212
1313#include "debugger.h"
14#include "i386priv.h"
1415#include "i386.h"
15#include "i386intf.h"
1616
1717#include "debug/debugcpu.h"
1818
r3957r3958
862862      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
863863      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
864864
865      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
866      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
867      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
868      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
869      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 12;               break;
870      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
871      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
872      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
873      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
874      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 32;               break;
875      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
865      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
866      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
867      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
868      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 32;               break;
869      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = 12;               break;
870      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
871      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
872      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
873      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
874      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 32;               break;
875      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
876876
877877      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
878878
r3957r3958
959959      case CPUINFO_INT_REGISTER + I386_LDTR_FLAGS:   info->i = cpustate->ldtr.flags;               break;
960960
961961      /* --- the following bits of info are returned as pointers to data or functions --- */
962      case CPUINFO_PTR_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(i386);         break;
963      case CPUINFO_PTR_INIT:                        info->init = CPU_INIT_NAME(i386);               break;
964      case CPUINFO_PTR_RESET:                        info->reset = CPU_RESET_NAME(i386);            break;
965      case CPUINFO_PTR_EXECUTE:                     info->execute = CPU_EXECUTE_NAME(i386);         break;
966      case CPUINFO_PTR_BURN:                        info->burn = NULL;                  break;
962      case CPUINFO_FCT_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(i386);         break;
963      case CPUINFO_FCT_INIT:                        info->init = CPU_INIT_NAME(i386);               break;
964      case CPUINFO_FCT_RESET:                        info->reset = CPU_RESET_NAME(i386);            break;
965      case CPUINFO_FCT_EXECUTE:                     info->execute = CPU_EXECUTE_NAME(i386);         break;
966      case CPUINFO_FCT_BURN:                        info->burn = NULL;                  break;
967967      case CPUINFO_PTR_INSTRUCTION_COUNTER:          info->icount = &cpustate->cycles;            break;
968      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(i386);   break;
969      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i386);         break;
970      case CPUINFO_PTR_DEBUG_INIT:               info->debug_init = CPU_DEBUG_INIT_NAME(i386);    break;
968      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(i386);   break;
969      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i386);         break;
970      case CPUINFO_FCT_DEBUG_INIT:               info->debug_init = CPU_DEBUG_INIT_NAME(i386);    break;
971971
972972      /* --- the following bits of info are returned as NULL-terminated strings --- */
973973      case CPUINFO_STR_NAME:                     strcpy(info->s, "I386");            break;
r3957r3958
11381138   i386_state *cpustate = (device != NULL) ? device->token : NULL;
11391139   switch (state)
11401140   {
1141      case CPUINFO_PTR_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(i486);break;
1142      case CPUINFO_PTR_INIT:                        info->init = CPU_INIT_NAME(i486);      break;
1143      case CPUINFO_PTR_RESET:                        info->reset = CPU_RESET_NAME(i486);      break;
1144      case CPUINFO_PTR_EXIT:                        info->exit = CPU_EXIT_NAME(i486);      break;
1141      case CPUINFO_FCT_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(i486);break;
1142      case CPUINFO_FCT_INIT:                        info->init = CPU_INIT_NAME(i486);      break;
1143      case CPUINFO_FCT_RESET:                        info->reset = CPU_RESET_NAME(i486);      break;
1144      case CPUINFO_FCT_EXIT:                        info->exit = CPU_EXIT_NAME(i486);      break;
11451145
11461146      case CPUINFO_INT_REGISTER + X87_CTRL:         info->i = cpustate->fpu_control_word;         break;
11471147      case CPUINFO_INT_REGISTER + X87_STATUS:         info->i = cpustate->fpu_status_word;         break;
r3957r3958
12711271   i386_state *cpustate = (device != NULL) ? device->token : NULL;
12721272   switch (state)
12731273   {
1274      case CPUINFO_PTR_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(pentium);   break;
1275      case CPUINFO_PTR_INIT:                        info->init = CPU_INIT_NAME(pentium);   break;
1276      case CPUINFO_PTR_RESET:                        info->reset = CPU_RESET_NAME(pentium);   break;
1277      case CPUINFO_PTR_EXIT:                        info->exit = CPU_EXIT_NAME(pentium);   break;
1274      case CPUINFO_FCT_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(pentium);   break;
1275      case CPUINFO_FCT_INIT:                        info->init = CPU_INIT_NAME(pentium);   break;
1276      case CPUINFO_FCT_RESET:                        info->reset = CPU_RESET_NAME(pentium);   break;
1277      case CPUINFO_FCT_EXIT:                        info->exit = CPU_EXIT_NAME(pentium);   break;
12781278
12791279      case CPUINFO_INT_REGISTER + X87_CTRL:         info->i = cpustate->fpu_control_word;         break;
12801280      case CPUINFO_INT_REGISTER + X87_STATUS:         info->i = cpustate->fpu_status_word;         break;
r3957r3958
14041404   i386_state *cpustate = (device != NULL) ? device->token : NULL;
14051405   switch (state)
14061406   {
1407      case CPUINFO_PTR_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(mediagx);   break;
1408      case CPUINFO_PTR_INIT:                        info->init = CPU_INIT_NAME(mediagx);   break;
1409      case CPUINFO_PTR_RESET:                        info->reset = CPU_RESET_NAME(mediagx);   break;
1410      case CPUINFO_PTR_EXIT:                        info->exit = CPU_EXIT_NAME(mediagx);   break;
1407      case CPUINFO_FCT_SET_INFO:                     info->setinfo = CPU_SET_INFO_NAME(mediagx);   break;
1408      case CPUINFO_FCT_INIT:                        info->init = CPU_INIT_NAME(mediagx);   break;
1409      case CPUINFO_FCT_RESET:                        info->reset = CPU_RESET_NAME(mediagx);   break;
1410      case CPUINFO_FCT_EXIT:                        info->exit = CPU_EXIT_NAME(mediagx);   break;
14111411
14121412      case CPUINFO_INT_REGISTER + X87_CTRL:         info->i = cpustate->fpu_control_word;         break;
14131413      case CPUINFO_INT_REGISTER + X87_STATUS:         info->i = cpustate->fpu_status_word;         break;
src/emu/cpu/mc68hc11/mc68hc11.h
r3957r3958
88offs_t hc11_disasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
99
1010CPU_GET_INFO( mc68hc11 );
11#define CPU_MC68HC11 CPU_GET_INFO_NAME( mc68hc11 )
1112
1213
1314#define MC68HC11_IO_PORTA         0x00
src/emu/cpu/mc68hc11/mc68hc11.c
r3957r3958
425425      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
426426      case CPUINFO_INT_MAX_CYCLES:               info->i = 41;                     break;
427427
428      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
429      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
430      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
431      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
432      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
433      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
434      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
435      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;               break;
436      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
428      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
429      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
430      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
431      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
432      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
433      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
434      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
435      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 8;               break;
436      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
437437
438438      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
439439
r3957r3958
448448      case CPUINFO_INT_REGISTER + HC11_IY:         info->i = cpustate->iy;                  break;
449449
450450      /* --- the following bits of info are returned as pointers to data or functions --- */
451      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mc68hc11);      break;
452      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(hc11);               break;
453      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(hc11);            break;
454      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(hc11);               break;
455      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hc11);         break;
456      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
457      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = hc11_disasm;      break;
451      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mc68hc11);      break;
452      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(hc11);               break;
453      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(hc11);            break;
454      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(hc11);               break;
455      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hc11);         break;
456      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
457      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = hc11_disasm;      break;
458458      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
459459
460460      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/adsp2100/adsp2100.h
r3957r3958
1515
1616
1717/***************************************************************************
18    GLOBAL CONSTANTS
18    TYPE DEFINITIONS
1919***************************************************************************/
2020
2121/* transmit and receive data callbacks types */
r3957r3958
2323typedef void  (*adsp21xx_tx_func)(const device_config *device, int port, INT32 data);
2424typedef void  (*adsp21xx_timer_func)(const device_config *device, int enable);
2525
26typedef struct _adsp21xx_config adsp21xx_config;
27struct _adsp21xx_config
28{
29   adsp21xx_rx_func      rx;            /* callback for serial receive */
30   adsp21xx_tx_func      tx;            /* callback for serial transmit */
31   adsp21xx_timer_func      timer;         /* callback for timer fired */
32};
2633
34
35
2736/***************************************************************************
2837    REGISTER ENUMERATION
2938***************************************************************************/
3039
3140enum
3241{
33   ADSP2100_PC=1,
42   ADSP2100_PC,
3443   ADSP2100_AX0, ADSP2100_AX1, ADSP2100_AY0, ADSP2100_AY1, ADSP2100_AR, ADSP2100_AF,
3544   ADSP2100_MX0, ADSP2100_MX1, ADSP2100_MY0, ADSP2100_MY1, ADSP2100_MR0, ADSP2100_MR1, ADSP2100_MR2, ADSP2100_MF,
3645   ADSP2100_SI, ADSP2100_SE, ADSP2100_SB, ADSP2100_SR0, ADSP2100_SR1,
r3957r3958
4352   ADSP2100_FLAGIN, ADSP2100_FLAGOUT, ADSP2100_FL0, ADSP2100_FL1, ADSP2100_FL2,
4453   ADSP2100_AX0_SEC, ADSP2100_AX1_SEC, ADSP2100_AY0_SEC, ADSP2100_AY1_SEC, ADSP2100_AR_SEC, ADSP2100_AF_SEC,
4554   ADSP2100_MX0_SEC, ADSP2100_MX1_SEC, ADSP2100_MY0_SEC, ADSP2100_MY1_SEC, ADSP2100_MR0_SEC, ADSP2100_MR1_SEC, ADSP2100_MR2_SEC, ADSP2100_MF_SEC,
46   ADSP2100_SI_SEC, ADSP2100_SE_SEC, ADSP2100_SB_SEC, ADSP2100_SR0_SEC, ADSP2100_SR1_SEC
47};
55   ADSP2100_SI_SEC, ADSP2100_SE_SEC, ADSP2100_SB_SEC, ADSP2100_SR0_SEC, ADSP2100_SR1_SEC,
4856
49enum
50{
51   CPUINFO_PTR_ADSP2100_RX_HANDLER = CPUINFO_PTR_CPU_SPECIFIC,
52   CPUINFO_PTR_ADSP2100_TX_HANDLER,
53   CPUINFO_PTR_ADSP2100_TIMER_HANDLER
57   ADSP2100_GENPC = REG_GENPC,
58   ADSP2100_GENSP = REG_GENSP,
59   ADSP2100_GENPCBASE = REG_GENPCBASE
5460};
5561
5662
63
5764/***************************************************************************
5865    PUBLIC FUNCTIONS
5966***************************************************************************/
r3957r3958
6572#define ADSP2100_IRQ2      2      /* IRQ2 */
6673#define ADSP2100_IRQ3      3      /* IRQ3 */
6774
68#if (HAS_ADSP2100)
69extern CPU_GET_INFO( adsp2100 );
70#endif
75CPU_GET_INFO( adsp2100 );
76#define CPU_ADSP2100 CPU_GET_INFO_NAME( adsp2100 )
7177
78
7279/**************************************************************************
7380 * ADSP2101 section
7481 **************************************************************************/
r3957r3958
8289#define ADSP2101_SPORT0_TX   4      /* SPORT0 transmit IRQ */
8390#define ADSP2101_TIMER      5      /* internal timer IRQ */
8491
85#if (HAS_ADSP2101)
86extern CPU_GET_INFO( adsp2101 );
87#endif
92CPU_GET_INFO( adsp2101 );
93#define CPU_ADSP2101 CPU_GET_INFO_NAME( adsp2101 )
8894
89#if (HAS_ADSP2104)
95
9096/**************************************************************************
9197 * ADSP2104 section
9298 **************************************************************************/
r3957r3958
100106#define ADSP2104_SPORT0_TX   4      /* SPORT0 transmit IRQ */
101107#define ADSP2104_TIMER      5      /* internal timer IRQ */
102108
103extern CPU_GET_INFO( adsp2104 );
104extern void adsp2104_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
105#endif /* (HAS_ADSP2104) */
109CPU_GET_INFO( adsp2104 );
110#define CPU_ADSP2104 CPU_GET_INFO_NAME( adsp2104 )
106111
107#if (HAS_ADSP2105)
112void adsp2104_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
113
114
108115/**************************************************************************
109116 * ADSP2105 section
110117 **************************************************************************/
r3957r3958
116123#define ADSP2105_IRQ2      2      /* IRQ2 */
117124#define ADSP2105_TIMER      5      /* internal timer IRQ */
118125
119extern CPU_GET_INFO( adsp2105 );
120extern void adsp2105_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
121#endif /* (HAS_ADSP2105) */
126CPU_GET_INFO( adsp2105 );
127#define CPU_ADSP2105 CPU_GET_INFO_NAME( adsp2105 )
122128
123#if (HAS_ADSP2115)
129void adsp2105_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
130
131
124132/**************************************************************************
125133 * ADSP2115 section
126134 **************************************************************************/
r3957r3958
134142#define ADSP2115_SPORT0_TX   4      /* SPORT0 transmit IRQ */
135143#define ADSP2115_TIMER      5      /* internal timer IRQ */
136144
137extern CPU_GET_INFO( adsp2115 );
138extern void adsp2115_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
139#endif /* (HAS_ADSP2115) */
145CPU_GET_INFO( adsp2115 );
146#define CPU_ADSP2115 CPU_GET_INFO_NAME( adsp2115 )
140147
141#if (HAS_ADSP2181)
148void adsp2115_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
149
150
142151/**************************************************************************
143152 * ADSP2181 section
144153 **************************************************************************/
r3957r3958
155164#define ADSP2181_IRQL1      7      /* IRQL1 */
156165#define ADSP2181_IRQL2      8      /* IRQL2 */
157166
158extern CPU_GET_INFO( adsp2181 );
159extern void adsp2181_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
160extern void adsp2181_idma_addr_w(const device_config *device, UINT16 data);
161extern UINT16 adsp2181_idma_addr_r(const device_config *device);
162extern void adsp2181_idma_data_w(const device_config *device, UINT16 data);
163extern UINT16 adsp2181_idma_data_r(const device_config *device);
164#endif /* (HAS_ADSP2181) */
167CPU_GET_INFO( adsp2181 );
168#define CPU_ADSP2181 CPU_GET_INFO_NAME( adsp2181 )
165169
170void adsp2181_load_boot_data(UINT8 *srcdata, UINT32 *dstdata);
171void adsp2181_idma_addr_w(const device_config *device, UINT16 data);
172UINT16 adsp2181_idma_addr_r(const device_config *device);
173void adsp2181_idma_data_w(const device_config *device, UINT16 data);
174UINT16 adsp2181_idma_data_r(const device_config *device);
166175
167INLINE void adsp21xx_set_rx_handler(const device_config *device, adsp21xx_rx_func handler)
168{
169   cpu_set_info_fct(device, CPUINFO_PTR_ADSP2100_RX_HANDLER, (genf *)handler);
170}
171176
172INLINE void adsp21xx_set_tx_handler(const device_config *device, adsp21xx_tx_func handler)
173{
174   cpu_set_info_fct(device, CPUINFO_PTR_ADSP2100_TX_HANDLER, (genf *)handler);
175}
176
177INLINE void adsp21xx_set_timer_handler(const device_config *device, adsp21xx_timer_func handler)
178{
179   cpu_set_info_fct(device, CPUINFO_PTR_ADSP2100_TIMER_HANDLER, (genf *)handler);
180}
181
182
183177#endif /* __ADSP2100_H__ */
src/emu/cpu/adsp2100/2100ops.c
r3957r3958
8181#define MSTAT_GOMODE   0x40         /* go mode enable */
8282
8383/* you must call this in order to change MSTAT */
84INLINE void set_mstat(adsp2100_state *adsp, int new_value)
84INLINE void update_mstat(adsp2100_state *adsp)
8585{
86   if ((new_value ^ adsp->mstat) & MSTAT_BANK)
86   if ((adsp->mstat ^ adsp->mstat_prev) & MSTAT_BANK)
8787   {
8888      ADSPCORE temp = adsp->core;
8989      adsp->core = adsp->alt;
9090      adsp->alt = temp;
9191   }
92   if ((new_value ^ adsp->mstat) & MSTAT_TIMER)
92   if ((adsp->mstat ^ adsp->mstat_prev) & MSTAT_TIMER)
9393      if (adsp->timer_fired != NULL)
94         (*adsp->timer_fired)(adsp->device, (new_value & MSTAT_TIMER) != 0);
95   if (new_value & MSTAT_STICKYV)
94         (*adsp->timer_fired)(adsp->device, (adsp->mstat & MSTAT_TIMER) != 0);
95   if (adsp->mstat & MSTAT_STICKYV)
9696      adsp->astat_clear = ~(CFLAG | NFLAG | ZFLAG);
9797   else
9898      adsp->astat_clear = ~(CFLAG | VFLAG | NFLAG | ZFLAG);
99   adsp->mstat = new_value;
99   adsp->mstat_prev = adsp->mstat;
100100}
101101
102102
r3957r3958
291291      if (adsp->stat_sp == 0)
292292         adsp->sstat |= STATUS_EMPTY;
293293   }
294   set_mstat(adsp, adsp->stat_stack[adsp->stat_sp][0]);
294   adsp->mstat = adsp->stat_stack[adsp->stat_sp][0];
295   update_mstat(adsp);
295296   adsp->imask = adsp->stat_stack[adsp->stat_sp][1];
296297   adsp->astat = adsp->stat_stack[adsp->stat_sp][2];
297298    check_irqs(adsp);
r3957r3958
322323    register writing
323324===========================================================================*/
324325
326INLINE void update_i(adsp2100_state *adsp, int which)
327{
328   adsp->base[which] = adsp->i[which] & adsp->lmask[which];
329}
330
331INLINE void update_l(adsp2100_state *adsp, int which)
332{
333   adsp->lmask[which] = mask_table[adsp->l[which] & 0x3fff];
334   adsp->base[which] = adsp->i[which] & adsp->lmask[which];
335}
336
325337static void wr_inval(adsp2100_state *adsp, INT32 val) { logerror( "ADSP %04x: Writing to an invalid register!\n", adsp->ppc ); }
326338static void wr_ax0(adsp2100_state *adsp, INT32 val)   { adsp->core.ax0.s = val; }
327339static void wr_ax1(adsp2100_state *adsp, INT32 val)   { adsp->core.ax1.s = val; }
r3957r3958
339351static void wr_mr2(adsp2100_state *adsp, INT32 val)   { adsp->core.mr.mrx.mr2.s = (INT8)val; }
340352static void wr_sr0(adsp2100_state *adsp, INT32 val)   { adsp->core.sr.srx.sr0.s = val; }
341353static void wr_sr1(adsp2100_state *adsp, INT32 val)   { adsp->core.sr.srx.sr1.s = val; }
342static void wr_i0(adsp2100_state *adsp, INT32 val)    { adsp->i[0] = val & 0x3fff; adsp->base[0] = val & adsp->lmask[0]; }
343static void wr_i1(adsp2100_state *adsp, INT32 val)    { adsp->i[1] = val & 0x3fff; adsp->base[1] = val & adsp->lmask[1]; }
344static void wr_i2(adsp2100_state *adsp, INT32 val)    { adsp->i[2] = val & 0x3fff; adsp->base[2] = val & adsp->lmask[2]; }
345static void wr_i3(adsp2100_state *adsp, INT32 val)    { adsp->i[3] = val & 0x3fff; adsp->base[3] = val & adsp->lmask[3]; }
346static void wr_i4(adsp2100_state *adsp, INT32 val)    { adsp->i[4] = val & 0x3fff; adsp->base[4] = val & adsp->lmask[4]; }
347static void wr_i5(adsp2100_state *adsp, INT32 val)    { adsp->i[5] = val & 0x3fff; adsp->base[5] = val & adsp->lmask[5]; }
348static void wr_i6(adsp2100_state *adsp, INT32 val)    { adsp->i[6] = val & 0x3fff; adsp->base[6] = val & adsp->lmask[6]; }
349static void wr_i7(adsp2100_state *adsp, INT32 val)    { adsp->i[7] = val & 0x3fff; adsp->base[7] = val & adsp->lmask[7]; }
354static void wr_i0(adsp2100_state *adsp, INT32 val)    { adsp->i[0] = val & 0x3fff; update_i(adsp, 0); }
355static void wr_i1(adsp2100_state *adsp, INT32 val)    { adsp->i[1] = val & 0x3fff; update_i(adsp, 1); }
356static void wr_i2(adsp2100_state *adsp, INT32 val)    { adsp->i[2] = val & 0x3fff; update_i(adsp, 2); }
357static void wr_i3(adsp2100_state *adsp, INT32 val)    { adsp->i[3] = val & 0x3fff; update_i(adsp, 3); }
358static void wr_i4(adsp2100_state *adsp, INT32 val)    { adsp->i[4] = val & 0x3fff; update_i(adsp, 4); }
359static void wr_i5(adsp2100_state *adsp, INT32 val)    { adsp->i[5] = val & 0x3fff; update_i(adsp, 5); }
360static void wr_i6(adsp2100_state *adsp, INT32 val)    { adsp->i[6] = val & 0x3fff; update_i(adsp, 6); }
361static void wr_i7(adsp2100_state *adsp, INT32 val)    { adsp->i[7] = val & 0x3fff; update_i(adsp, 7); }
350362static void wr_m0(adsp2100_state *adsp, INT32 val)    { adsp->m[0] = (INT32)(val << 18) >> 18; }
351363static void wr_m1(adsp2100_state *adsp, INT32 val)    { adsp->m[1] = (INT32)(val << 18) >> 18; }
352364static void wr_m2(adsp2100_state *adsp, INT32 val)    { adsp->m[2] = (INT32)(val << 18) >> 18; }
r3957r3958
355367static void wr_m5(adsp2100_state *adsp, INT32 val)    { adsp->m[5] = (INT32)(val << 18) >> 18; }
356368static void wr_m6(adsp2100_state *adsp, INT32 val)    { adsp->m[6] = (INT32)(val << 18) >> 18; }
357369static void wr_m7(adsp2100_state *adsp, INT32 val)    { adsp->m[7] = (INT32)(val << 18) >> 18; }
358static void wr_l0(adsp2100_state *adsp, INT32 val)    { adsp->l[0] = val & 0x3fff; adsp->lmask[0] = mask_table[val & 0x3fff]; adsp->base[0] = adsp->i[0] & adsp->lmask[0]; }
359static void wr_l1(adsp2100_state *adsp, INT32 val)    { adsp->l[1] = val & 0x3fff; adsp->lmask[1] = mask_table[val & 0x3fff]; adsp->base[1] = adsp->i[1] & adsp->lmask[1]; }
360static void wr_l2(adsp2100_state *adsp, INT32 val)    { adsp->l[2] = val & 0x3fff; adsp->lmask[2] = mask_table[val & 0x3fff]; adsp->base[2] = adsp->i[2] & adsp->lmask[2]; }
361static void wr_l3(adsp2100_state *adsp, INT32 val)    { adsp->l[3] = val & 0x3fff; adsp->lmask[3] = mask_table[val & 0x3fff]; adsp->base[3] = adsp->i[3] & adsp->lmask[3]; }
362static void wr_l4(adsp2100_state *adsp, INT32 val)    { adsp->l[4] = val & 0x3fff; adsp->lmask[4] = mask_table[val & 0x3fff]; adsp->base[4] = adsp->i[4] & adsp->lmask[4]; }
363static void wr_l5(adsp2100_state *adsp, INT32 val)    { adsp->l[5] = val & 0x3fff; adsp->lmask[5] = mask_table[val & 0x3fff]; adsp->base[5] = adsp->i[5] & adsp->lmask[5]; }
364static void wr_l6(adsp2100_state *adsp, INT32 val)    { adsp->l[6] = val & 0x3fff; adsp->lmask[6] = mask_table[val & 0x3fff]; adsp->base[6] = adsp->i[6] & adsp->lmask[6]; }
365static void wr_l7(adsp2100_state *adsp, INT32 val)    { adsp->l[7] = val & 0x3fff; adsp->lmask[7] = mask_table[val & 0x3fff]; adsp->base[7] = adsp->i[7] & adsp->lmask[7]; }
370static void wr_l0(adsp2100_state *adsp, INT32 val)    { adsp->l[0] = val & 0x3fff; update_l(adsp, 0); }
371static void wr_l1(adsp2100_state *adsp, INT32 val)    { adsp->l[1] = val & 0x3fff; update_l(adsp, 1); }
372static void wr_l2(adsp2100_state *adsp, INT32 val)    { adsp->l[2] = val & 0x3fff; update_l(adsp, 2); }
373static void wr_l3(adsp2100_state *adsp, INT32 val)    { adsp->l[3] = val & 0x3fff; update_l(adsp, 3); }
374static void wr_l4(adsp2100_state *adsp, INT32 val)    { adsp->l[4] = val & 0x3fff; update_l(adsp, 4); }
375static void wr_l5(adsp2100_state *adsp, INT32 val)    { adsp->l[5] = val & 0x3fff; update_l(adsp, 5); }
376static void wr_l6(adsp2100_state *adsp, INT32 val)    { adsp->l[6] = val & 0x3fff; update_l(adsp, 6); }
377static void wr_l7(adsp2100_state *adsp, INT32 val)    { adsp->l[7] = val & 0x3fff; update_l(adsp, 7); }
366378static void wr_astat(adsp2100_state *adsp, INT32 val) { adsp->astat = val & 0x00ff; }
367static void wr_mstat(adsp2100_state *adsp, INT32 val) { set_mstat(adsp, val & adsp->mstat_mask); }
368static void wr_sstat(adsp2100_state *adsp, INT32 val) { adsp->sstat = val & 0x00ff; }
379static void wr_mstat(adsp2100_state *adsp, INT32 val) { adsp->mstat = val & adsp->mstat_mask; update_mstat(adsp); }
369380static void wr_imask(adsp2100_state *adsp, INT32 val) { adsp->imask = val & adsp->imask_mask; check_irqs(adsp); }
370381static void wr_icntl(adsp2100_state *adsp, INT32 val) { adsp->icntl = val & 0x001f; check_irqs(adsp); }
371382static void wr_cntr(adsp2100_state *adsp, INT32 val)  { cntr_stack_push(adsp); adsp->cntr = val & 0x3fff; }
r3957r3958
374385static void wr_ifc(adsp2100_state *adsp, INT32 val)
375386{
376387   adsp->ifc = val;
377#if (HAS_ADSP2181)
378388   if (adsp->chip_type >= CHIP_TYPE_ADSP2181)
379389   {
380390      /* clear timer */
r3957r3958
395405      if (val & 0x8000) adsp->irq_latch[ADSP2181_IRQ2] = 1;
396406   }
397407   else
398#endif
399408   {
400409      /* clear timer */
401410      if (val & 0x002) adsp->irq_latch[ADSP2101_IRQ0] = 0;
src/emu/cpu/adsp2100/adsp2100.c
r3957r3958
211211   UINT32      astat;
212212   UINT32      sstat;
213213   UINT32      mstat;
214   UINT32      mstat_prev;
214215   UINT32      astat_clear;
215216   UINT32      idle;
216217
r3957r3958
261262   adsp21xx_tx_func sport_tx_callback;
262263   adsp21xx_timer_func timer_fired;
263264
264   /* Memory spaces */
265   /* memory spaces */
265266    const address_space *program;
266267    const address_space *data;
267268    const address_space *io;
269    cpu_state_table state;
268270
269271} adsp2100_state;
270272
r3957r3958
283285#endif
284286
285287
288
286289/***************************************************************************
290    CPU STATE DESCRIPTION
291***************************************************************************/
292
293#define ADSP21XX_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
294   CPU_STATE_ENTRY(ADSP2100_##_name, #_name, _format, adsp2100_state, _member, _datamask, ~0, _flags)
295
296#define ADSP21XX_STATE_ENTRY_MASK(_name, _format, _member, _datamask, _flags, _validmask) \
297   CPU_STATE_ENTRY(ADSP2100_##_name, #_name, _format, adsp2100_state, _member, _datamask, _validmask, _flags)
298
299static const cpu_state_entry state_array[] =
300{
301   ADSP21XX_STATE_ENTRY(PC,  "%04X", pc, 0xffff, 0)
302   ADSP21XX_STATE_ENTRY(GENPC, "%04X", pc, 0xffff, CPUSTATE_NOSHOW)
303   ADSP21XX_STATE_ENTRY(GENPCBASE, "%04X", ppc, 0xffff, CPUSTATE_NOSHOW)
304
305   ADSP21XX_STATE_ENTRY(AX0, "%04X", core.ax0.u, 0xffff, 0)
306   ADSP21XX_STATE_ENTRY(AX1, "%04X", core.ax1.u, 0xffff, 0)
307   ADSP21XX_STATE_ENTRY(AY0, "%04X", core.ay0.u, 0xffff, 0)
308   ADSP21XX_STATE_ENTRY(AY1, "%04X", core.ay1.u, 0xffff, 0)
309   ADSP21XX_STATE_ENTRY(AR,  "%04X", core.ar.u, 0xffff, 0)
310   ADSP21XX_STATE_ENTRY(AF,  "%04X", core.af.u, 0xffff, 0)
311
312   ADSP21XX_STATE_ENTRY(MX0, "%04X", core.mx0.u, 0xffff, 0)
313   ADSP21XX_STATE_ENTRY(MX1, "%04X", core.mx1.u, 0xffff, 0)
314   ADSP21XX_STATE_ENTRY(MY0, "%04X", core.my0.u, 0xffff, 0)
315   ADSP21XX_STATE_ENTRY(MY1, "%04X", core.my1.u, 0xffff, 0)
316   ADSP21XX_STATE_ENTRY(MR0, "%04X", core.mr.mrx.mr0.u, 0xffff, 0)
317   ADSP21XX_STATE_ENTRY(MR1, "%04X", core.mr.mrx.mr1.u, 0xffff, 0)
318   ADSP21XX_STATE_ENTRY(MR2, "%02X", core.mr.mrx.mr2.u, 0xff, CPUSTATE_IMPORT_SEXT)
319   ADSP21XX_STATE_ENTRY(MF,  "%04X", core.mf.u, 0xffff, 0)
320
321   ADSP21XX_STATE_ENTRY(SI,  "%04X", core.si.u, 0xffff, 0)
322   ADSP21XX_STATE_ENTRY(SE,  "%02X", core.se.u, 0xff, CPUSTATE_IMPORT_SEXT)
323   ADSP21XX_STATE_ENTRY(SB,  "%02X", core.sb.u, 0x1f, CPUSTATE_IMPORT_SEXT)
324   ADSP21XX_STATE_ENTRY(SR0, "%04X", core.sr.srx.sr0.u, 0xffff, 0)
325   ADSP21XX_STATE_ENTRY(SR1, "%04X", core.sr.srx.sr0.u, 0xffff, 0)
326
327   ADSP21XX_STATE_ENTRY(AX0_SEC, "%04X", alt.ax0.u, 0xffff, 0)
328   ADSP21XX_STATE_ENTRY(AX1_SEC, "%04X", alt.ax1.u, 0xffff, 0)
329   ADSP21XX_STATE_ENTRY(AY0_SEC, "%04X", alt.ay0.u, 0xffff, 0)
330   ADSP21XX_STATE_ENTRY(AY1_SEC, "%04X", alt.ay1.u, 0xffff, 0)
331   ADSP21XX_STATE_ENTRY(AR_SEC,  "%04X", alt.ar.u, 0xffff, 0)
332   ADSP21XX_STATE_ENTRY(AF_SEC,  "%04X", alt.af.u, 0xffff, 0)
333
334   ADSP21XX_STATE_ENTRY(MX0_SEC, "%04X", alt.mx0.u, 0xffff, 0)
335   ADSP21XX_STATE_ENTRY(MX1_SEC, "%04X", alt.mx1.u, 0xffff, 0)
336   ADSP21XX_STATE_ENTRY(MY0_SEC, "%04X", alt.my0.u, 0xffff, 0)
337   ADSP21XX_STATE_ENTRY(MY1_SEC, "%04X", alt.my1.u, 0xffff, 0)
338   ADSP21XX_STATE_ENTRY(MR0_SEC, "%04X", alt.mr.mrx.mr0.u, 0xffff, 0)
339   ADSP21XX_STATE_ENTRY(MR1_SEC, "%04X", alt.mr.mrx.mr1.u, 0xffff, 0)
340   ADSP21XX_STATE_ENTRY(MR2_SEC, "%02X", alt.mr.mrx.mr2.u, 0xff, CPUSTATE_IMPORT_SEXT)
341   ADSP21XX_STATE_ENTRY(MF_SEC,  "%04X", alt.mf.u, 0xffff, 0)
342
343   ADSP21XX_STATE_ENTRY(SI_SEC,  "%04X", alt.si.u, 0xffff, 0)
344   ADSP21XX_STATE_ENTRY(SE_SEC,  "%02X", alt.se.u, 0xff, CPUSTATE_IMPORT_SEXT)
345   ADSP21XX_STATE_ENTRY(SB_SEC,  "%02X", alt.sb.u, 0x1f, CPUSTATE_IMPORT_SEXT)
346   ADSP21XX_STATE_ENTRY(SR0_SEC, "%04X", alt.sr.srx.sr0.u, 0xffff, 0)
347   ADSP21XX_STATE_ENTRY(SR1_SEC, "%04X", alt.sr.srx.sr0.u, 0xffff, 0)
348
349   ADSP21XX_STATE_ENTRY(I0, "%04X", i[0], 0x3fff, CPUSTATE_IMPORT)
350   ADSP21XX_STATE_ENTRY(I1, "%04X", i[1], 0x3fff, CPUSTATE_IMPORT)
351   ADSP21XX_STATE_ENTRY(I2, "%04X", i[2], 0x3fff, CPUSTATE_IMPORT)
352   ADSP21XX_STATE_ENTRY(I3, "%04X", i[3], 0x3fff, CPUSTATE_IMPORT)
353   ADSP21XX_STATE_ENTRY(I4, "%04X", i[4], 0x3fff, CPUSTATE_IMPORT)
354   ADSP21XX_STATE_ENTRY(I5, "%04X", i[5], 0x3fff, CPUSTATE_IMPORT)
355   ADSP21XX_STATE_ENTRY(I6, "%04X", i[6], 0x3fff, CPUSTATE_IMPORT)
356   ADSP21XX_STATE_ENTRY(I7, "%04X", i[7], 0x3fff, CPUSTATE_IMPORT)
357
358   ADSP21XX_STATE_ENTRY(L0, "%04X", l[0], 0x3fff, CPUSTATE_IMPORT)
359   ADSP21XX_STATE_ENTRY(L1, "%04X", l[1], 0x3fff, CPUSTATE_IMPORT)
360   ADSP21XX_STATE_ENTRY(L2, "%04X", l[2], 0x3fff, CPUSTATE_IMPORT)
361   ADSP21XX_STATE_ENTRY(L3, "%04X", l[3], 0x3fff, CPUSTATE_IMPORT)
362   ADSP21XX_STATE_ENTRY(L4, "%04X", l[4], 0x3fff, CPUSTATE_IMPORT)
363   ADSP21XX_STATE_ENTRY(L5, "%04X", l[5], 0x3fff, CPUSTATE_IMPORT)
364   ADSP21XX_STATE_ENTRY(L6, "%04X", l[6], 0x3fff, CPUSTATE_IMPORT)
365   ADSP21XX_STATE_ENTRY(L7, "%04X", l[7], 0x3fff, CPUSTATE_IMPORT)
366
367   ADSP21XX_STATE_ENTRY(M0, "%04X", m[0], 0x3fff, CPUSTATE_IMPORT_SEXT)
368   ADSP21XX_STATE_ENTRY(M1, "%04X", m[1], 0x3fff, CPUSTATE_IMPORT_SEXT)
369   ADSP21XX_STATE_ENTRY(M2, "%04X", m[2], 0x3fff, CPUSTATE_IMPORT_SEXT)
370   ADSP21XX_STATE_ENTRY(M3, "%04X", m[3], 0x3fff, CPUSTATE_IMPORT_SEXT)
371   ADSP21XX_STATE_ENTRY(M4, "%04X", m[4], 0x3fff, CPUSTATE_IMPORT_SEXT)
372   ADSP21XX_STATE_ENTRY(M5, "%04X", m[5], 0x3fff, CPUSTATE_IMPORT_SEXT)
373   ADSP21XX_STATE_ENTRY(M6, "%04X", m[6], 0x3fff, CPUSTATE_IMPORT_SEXT)
374   ADSP21XX_STATE_ENTRY(M7, "%04X", m[7], 0x3fff, CPUSTATE_IMPORT_SEXT)
375
376   ADSP21XX_STATE_ENTRY(PX, "%02X", px, 0xff, 0)
377   ADSP21XX_STATE_ENTRY(CNTR, "%04X", cntr, 0x3fff, 0)
378   ADSP21XX_STATE_ENTRY(ASTAT, "%02X", astat, 0xff, 0)
379   ADSP21XX_STATE_ENTRY(SSTAT, "%02X", sstat, 0xff, 0)
380   ADSP21XX_STATE_ENTRY_MASK(MSTAT, "%01X", mstat, 0x0f, CPUSTATE_IMPORT,  (1 << CHIP_TYPE_ADSP2100))
381   ADSP21XX_STATE_ENTRY_MASK(MSTAT, "%02X", mstat, 0x7f, CPUSTATE_IMPORT, ~(1 << CHIP_TYPE_ADSP2100))
382
383   ADSP21XX_STATE_ENTRY(PCSP,   "%02X", pc_sp, 0xff, 0)
384   ADSP21XX_STATE_ENTRY(GENSP,  "%02X", pc_sp, 0xff, CPUSTATE_NOSHOW)
385   ADSP21XX_STATE_ENTRY(CNTRSP, "%01X", cntr_sp, 0xf, 0)
386   ADSP21XX_STATE_ENTRY(STATSP, "%01X", stat_sp, 0xf, 0)
387   ADSP21XX_STATE_ENTRY(LOOPSP, "%01X", loop_sp, 0xf, 0)
388
389   ADSP21XX_STATE_ENTRY_MASK(IMASK, "%01X", imask, 0x00f, CPUSTATE_IMPORT,  (1 << CHIP_TYPE_ADSP2100))
390   ADSP21XX_STATE_ENTRY_MASK(IMASK, "%02X", imask, 0x03f, CPUSTATE_IMPORT, ~((1 << CHIP_TYPE_ADSP2100) | (1 << CHIP_TYPE_ADSP2181)))
391   ADSP21XX_STATE_ENTRY_MASK(IMASK, "%03X", imask, 0x3ff, CPUSTATE_IMPORT,  (1 << CHIP_TYPE_ADSP2181))
392   ADSP21XX_STATE_ENTRY(ICNTL, "%02X", icntl, 0x1f, CPUSTATE_IMPORT)
393   ADSP21XX_STATE_ENTRY(IRQSTATE0, "%1u", irq_state[0], 0x1, CPUSTATE_IMPORT)
394   ADSP21XX_STATE_ENTRY(IRQSTATE1, "%1u", irq_state[1], 0x1, CPUSTATE_IMPORT)
395   ADSP21XX_STATE_ENTRY(IRQSTATE2, "%1u", irq_state[2], 0x1, CPUSTATE_IMPORT)
396   ADSP21XX_STATE_ENTRY_MASK(IRQSTATE3, "%1u", irq_state[3], 0x1, CPUSTATE_IMPORT, (1 << CHIP_TYPE_ADSP2100))
397
398   ADSP21XX_STATE_ENTRY(FLAGIN, "%1u", flagin, 0x1, 0)
399   ADSP21XX_STATE_ENTRY(FLAGOUT, "%1u", flagout, 0x1, 0)
400   ADSP21XX_STATE_ENTRY(FL0, "%1u", fl0, 0x1, 0)
401   ADSP21XX_STATE_ENTRY(FL1, "%1u", fl1, 0x1, 0)
402   ADSP21XX_STATE_ENTRY(FL2, "%1u", fl2, 0x1, 0)
403};
404
405static const cpu_state_table state_table_template =
406{
407   NULL,                  /* pointer to the base of state (offsets are relative to this) */
408   0,                     /* subtype this table refers to */
409   ARRAY_LENGTH(state_array),   /* number of entries */
410   state_array               /* array of entries */
411};
412
413
414
415/***************************************************************************
287416    PRIVATE FUNCTION PROTOTYPES
288417***************************************************************************/
289418
r3957r3958
419548{
420549   UINT8 check;
421550
422#if (HAS_ADSP2181)
423551   if (adsp->chip_type >= CHIP_TYPE_ADSP2181)
424552   {
425553      /* check IRQ2 */
r3957r3958
469597      if (check && adsp2181_generate_irq(adsp, ADSP2181_TIMER, 9))
470598         return;
471599   }
472   else
473#endif
474   if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
600   else if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
475601   {
476602      /* check IRQ2 */
477603      check = (adsp->icntl & 4) ? adsp->irq_latch[ADSP2101_IRQ2] : adsp->irq_state[ADSP2101_IRQ2];
r3957r3958
544670    INITIALIZATION AND SHUTDOWN
545671***************************************************************************/
546672
547static adsp2100_state *adsp21xx_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
673static adsp2100_state *adsp21xx_init(const device_config *device, cpu_irq_callback irqcallback, int chiptype)
548674{
675   const adsp21xx_config *config = device->static_config;
549676   adsp2100_state *adsp = device->token;
550677
551678   /* create the tables */
r3957r3958
553680      fatalerror("creating adsp2100 tables failed");
554681
555682   /* set the IRQ callback */
683   adsp->chip_type = chiptype;
556684   adsp->irq_callback = irqcallback;
557   adsp->device = device;
558685
686   /* fetch device parameters */
687   adsp->device = device;
559688   adsp->program = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
560689   adsp->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
561690   adsp->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
562691
692   /* copy function pointers from the config */
693   if (config != NULL)
694   {
695      adsp->sport_rx_callback = config->rx;
696      adsp->sport_tx_callback = config->tx;
697      adsp->timer_fired = config->timer;
698   }
563699
700   /* set up the state table */
701   adsp->state = state_table_template;
702   adsp->state.baseptr = adsp;
703   adsp->state.subtypemask = 1 << chiptype;
564704
565705   /* set up ALU register pointers */
566706   adsp->alu_xregs[0] = &adsp->core.ax0;
r3957r3958
653793   state_save_register_device_item(device, 0, adsp->astat);
654794   state_save_register_device_item(device, 0, adsp->sstat);
655795   state_save_register_device_item(device, 0, adsp->mstat);
796   state_save_register_device_item(device, 0, adsp->mstat_prev);
656797   state_save_register_device_item(device, 0, adsp->astat_clear);
657798   state_save_register_device_item(device, 0, adsp->idle);
658799
r3957r3958
734875   adsp->mstat = 0;
735876   adsp->sstat = 0x55;
736877   adsp->idle = 0;
878   update_mstat(adsp);
737879
738880   /* reset stacks */
739881   adsp->pc_sp = 0;
r3957r3958
8921034
8931035   check_irqs(adsp);
8941036
895   /* reset the core */
896   set_mstat(adsp, adsp->mstat);
897
8981037   /* count cycles and interrupt cycles */
8991038   adsp->icount = cycles;
9001039
r3957r3958
10861225            break;
10871226         case 0x0c:
10881227            /* 00001100 xxxxxxxx xxxxxxxx  mode control */
1089            temp = adsp->mstat;
10901228            if (adsp->chip_type >= CHIP_TYPE_ADSP2101)
10911229            {
1092               if (op & 0x000008) temp = (temp & ~MSTAT_GOMODE) | ((op << 5) & MSTAT_GOMODE);
1093               if (op & 0x002000) temp = (temp & ~MSTAT_INTEGER) | ((op >> 8) & MSTAT_INTEGER);
1094               if (op & 0x008000) temp = (temp & ~MSTAT_TIMER) | ((op >> 9) & MSTAT_TIMER);
1230               if (op & 0x000008) adsp->mstat = (adsp->mstat & ~MSTAT_GOMODE) | ((op << 5) & MSTAT_GOMODE);
1231               if (op & 0x002000) adsp->mstat = (adsp->mstat & ~MSTAT_INTEGER) | ((op >> 8) & MSTAT_INTEGER);
1232               if (op & 0x008000) adsp->mstat = (adsp->mstat & ~MSTAT_TIMER) | ((op >> 9) & MSTAT_TIMER);
10951233            }
1096            if (op & 0x000020) temp = (temp & ~MSTAT_BANK) | ((op >> 4) & MSTAT_BANK);
1097            if (op & 0x000080) temp = (temp & ~MSTAT_REVERSE) | ((op >> 5) & MSTAT_REVERSE);
1098            if (op & 0x000200) temp = (temp & ~MSTAT_STICKYV) | ((op >> 6) & MSTAT_STICKYV);
1099            if (op & 0x000800) temp = (temp & ~MSTAT_SATURATE) | ((op >> 7) & MSTAT_SATURATE);
1100            set_mstat(adsp, temp);
1234            if (op & 0x000020) adsp->mstat = (adsp->mstat & ~MSTAT_BANK) | ((op >> 4) & MSTAT_BANK);
1235            if (op & 0x000080) adsp->mstat = (adsp->mstat & ~MSTAT_REVERSE) | ((op >> 5) & MSTAT_REVERSE);
1236            if (op & 0x000200) adsp->mstat = (adsp->mstat & ~MSTAT_STICKYV) | ((op >> 6) & MSTAT_STICKYV);
1237            if (op & 0x000800) adsp->mstat = (adsp->mstat & ~MSTAT_SATURATE) | ((op >> 7) & MSTAT_SATURATE);
1238            update_mstat(adsp);
11011239            break;
11021240         case 0x0d:
11031241            /* 00001101 0000xxxx xxxxxxxx  internal data move */
r3957r3958
16411779
16421780
16431781
1644/**************************************************************************
1645 * Generic set_info
1646 **************************************************************************/
1782/***************************************************************************
1783    STATE HANDLING CALLBACKS
1784***************************************************************************/
16471785
1648static CPU_SET_INFO( adsp21xx )
1786static CPU_IMPORT_STATE( adsp21xx )
16491787{
16501788   adsp2100_state *adsp = device->token;
1651   switch (state)
1789   switch (entry->index)
16521790   {
1653      /* --- the following bits of info are set as 64-bit signed integers --- */
1654      case CPUINFO_INT_PC:
1655      case CPUINFO_INT_REGISTER + ADSP2100_PC:      adsp->pc = info->i;               break;
1791      case ADSP2100_MSTAT:
1792         update_mstat(adsp);
1793         break;
16561794
1657      case CPUINFO_INT_REGISTER + ADSP2100_AX0:      wr_ax0(adsp, info->i);            break;
1658      case CPUINFO_INT_REGISTER + ADSP2100_AX1:      wr_ax1(adsp, info->i);            break;
1659      case CPUINFO_INT_REGISTER + ADSP2100_AY0:      wr_ay0(adsp, info->i);            break;
1660      case CPUINFO_INT_REGISTER + ADSP2100_AY1:      wr_ay1(adsp, info->i);            break;
1661      case CPUINFO_INT_REGISTER + ADSP2100_AR:      wr_ar(adsp, info->i);            break;
1662      case CPUINFO_INT_REGISTER + ADSP2100_AF:      adsp->core.af.u = info->i;         break;
1795      case ADSP2100_IMASK:
1796      case ADSP2100_ICNTL:
1797      case ADSP2100_IRQSTATE0:
1798      case ADSP2100_IRQSTATE1:
1799      case ADSP2100_IRQSTATE2:
1800      case ADSP2100_IRQSTATE3:
1801         check_irqs(adsp);
1802         break;
16631803
1664      case CPUINFO_INT_REGISTER + ADSP2100_MX0:      wr_mx0(adsp, info->i);            break;
1665      case CPUINFO_INT_REGISTER + ADSP2100_MX1:      wr_mx1(adsp, info->i);            break;
1666      case CPUINFO_INT_REGISTER + ADSP2100_MY0:      wr_my0(adsp, info->i);            break;
1667      case CPUINFO_INT_REGISTER + ADSP2100_MY1:      wr_my1(adsp, info->i);            break;
1668      case CPUINFO_INT_REGISTER + ADSP2100_MR0:      wr_mr0(adsp, info->i);            break;
1669      case CPUINFO_INT_REGISTER + ADSP2100_MR1:      wr_mr1(adsp, info->i);            break;
1670      case CPUINFO_INT_REGISTER + ADSP2100_MR2:      wr_mr2(adsp, info->i);            break;
1671      case CPUINFO_INT_REGISTER + ADSP2100_MF:      adsp->core.mf.u = info->i;         break;
1804      case ADSP2100_I0:
1805      case ADSP2100_I1:
1806      case ADSP2100_I2:
1807      case ADSP2100_I3:
1808      case ADSP2100_I4:
1809      case ADSP2100_I5:
1810      case ADSP2100_I6:
1811      case ADSP2100_I7:
1812         update_i(adsp, entry->index - ADSP2100_I0);
1813         break;
16721814
1673      case CPUINFO_INT_REGISTER + ADSP2100_SI:      wr_si(adsp, info->i);            break;
1674      case CPUINFO_INT_REGISTER + ADSP2100_SE:      wr_se(adsp, info->i);            break;
1675      case CPUINFO_INT_REGISTER + ADSP2100_SB:      wr_sb(adsp, info->i);            break;
1676      case CPUINFO_INT_REGISTER + ADSP2100_SR0:      wr_sr0(adsp, info->i);            break;
1677      case CPUINFO_INT_REGISTER + ADSP2100_SR1:      wr_sr1(adsp, info->i);            break;
1815      case ADSP2100_L0:
1816      case ADSP2100_L1:
1817      case ADSP2100_L2:
1818      case ADSP2100_L3:
1819      case ADSP2100_L4:
1820      case ADSP2100_L5:
1821      case ADSP2100_L6:
1822      case ADSP2100_L7:
1823         update_l(adsp, entry->index - ADSP2100_L0);
1824         break;
16781825
1679      case CPUINFO_INT_REGISTER + ADSP2100_AX0_SEC:   adsp->alt.ax0.s = info->i;         break;
1680      case CPUINFO_INT_REGISTER + ADSP2100_AX1_SEC:   adsp->alt.ax1.s = info->i;         break;
1681      case CPUINFO_INT_REGISTER + ADSP2100_AY0_SEC:   adsp->alt.ay0.s = info->i;         break;
1682      case CPUINFO_INT_REGISTER + ADSP2100_AY1_SEC:   adsp->alt.ay1.s = info->i;         break;
1683      case CPUINFO_INT_REGISTER + ADSP2100_AR_SEC:   adsp->alt.ar.s = info->i;         break;
1684      case CPUINFO_INT_REGISTER + ADSP2100_AF_SEC:   adsp->alt.af.u = info->i;         break;
1826      default:
1827         fatalerror("CPU_IMPORT_STATE(adsp21xx) called for unexpected value\n");
1828         break;
1829   }
1830}
16851831
1686      case CPUINFO_INT_REGISTER + ADSP2100_MX0_SEC:   adsp->alt.mx0.s = info->i;         break;
1687      case CPUINFO_INT_REGISTER + ADSP2100_MX1_SEC:   adsp->alt.mx1.s = info->i;         break;
1688      case CPUINFO_INT_REGISTER + ADSP2100_MY0_SEC:   adsp->alt.my0.s = info->i;         break;
1689      case CPUINFO_INT_REGISTER + ADSP2100_MY1_SEC:   adsp->alt.my1.s = info->i;         break;
1690      case CPUINFO_INT_REGISTER + ADSP2100_MR0_SEC:   adsp->alt.mr.mrx.mr0.s = info->i;   break;
1691      case CPUINFO_INT_REGISTER + ADSP2100_MR1_SEC:   adsp->alt.mr.mrx.mr1.s = info->i; adsp->alt.mr.mrx.mr2.s = (INT16)info->i >> 15; break;
1692      case CPUINFO_INT_REGISTER + ADSP2100_MR2_SEC:   adsp->alt.mr.mrx.mr2.s = (INT8)info->i; break;
1693      case CPUINFO_INT_REGISTER + ADSP2100_MF_SEC:   adsp->alt.mf.u = info->i;         break;
16941832
1695      case CPUINFO_INT_REGISTER + ADSP2100_SI_SEC:   adsp->alt.si.s = info->i;         break;
1696      case CPUINFO_INT_REGISTER + ADSP2100_SE_SEC:   adsp->alt.se.s = (INT8)info->i;      break;
1697      case CPUINFO_INT_REGISTER + ADSP2100_SB_SEC:   adsp->alt.sb.s = (INT32)(info->i << 27) >> 27; break;
1698      case CPUINFO_INT_REGISTER + ADSP2100_SR0_SEC:   adsp->alt.sr.srx.sr0.s = info->i;   break;
1699      case CPUINFO_INT_REGISTER + ADSP2100_SR1_SEC:   adsp->alt.sr.srx.sr1.s = info->i;   break;
17001833
1701      case CPUINFO_INT_REGISTER + ADSP2100_I0:      wr_i0(adsp, info->i);             break;
1702      case CPUINFO_INT_REGISTER + ADSP2100_I1:      wr_i1(adsp, info->i);             break;
1703      case CPUINFO_INT_REGISTER + ADSP2100_I2:      wr_i2(adsp, info->i);             break;
1704      case CPUINFO_INT_REGISTER + ADSP2100_I3:      wr_i3(adsp, info->i);             break;
1705      case CPUINFO_INT_REGISTER + ADSP2100_I4:      wr_i4(adsp, info->i);             break;
1706      case CPUINFO_INT_REGISTER + ADSP2100_I5:      wr_i5(adsp, info->i);             break;
1707      case CPUINFO_INT_REGISTER + ADSP2100_I6:      wr_i6(adsp, info->i);             break;
1708      case CPUINFO_INT_REGISTER + ADSP2100_I7:      wr_i7(adsp, info->i);             break;
1834/**************************************************************************
1835 * Generic set_info
1836 **************************************************************************/
17091837
1710      case CPUINFO_INT_REGISTER + ADSP2100_L0:      wr_l0(adsp, info->i);             break;
1711      case CPUINFO_INT_REGISTER + ADSP2100_L1:      wr_l1(adsp, info->i);             break;
1712      case CPUINFO_INT_REGISTER + ADSP2100_L2:      wr_l2(adsp, info->i);             break;
1713      case CPUINFO_INT_REGISTER + ADSP2100_L3:      wr_l3(adsp, info->i);             break;
1714      case CPUINFO_INT_REGISTER + ADSP2100_L4:      wr_l4(adsp, info->i);             break;
1715      case CPUINFO_INT_REGISTER + ADSP2100_L5:      wr_l5(adsp, info->i);             break;
1716      case CPUINFO_INT_REGISTER + ADSP2100_L6:      wr_l6(adsp, info->i);             break;
1717      case CPUINFO_INT_REGISTER + ADSP2100_L7:      wr_l7(adsp, info->i);             break;
1718
1719      case CPUINFO_INT_REGISTER + ADSP2100_M0:      wr_m0(adsp, info->i);             break;
1720      case CPUINFO_INT_REGISTER + ADSP2100_M1:      wr_m1(adsp, info->i);             break;
1721      case CPUINFO_INT_REGISTER + ADSP2100_M2:      wr_m2(adsp, info->i);             break;
1722      case CPUINFO_INT_REGISTER + ADSP2100_M3:      wr_m3(adsp, info->i);             break;
1723      case CPUINFO_INT_REGISTER + ADSP2100_M4:      wr_m4(adsp, info->i);             break;
1724      case CPUINFO_INT_REGISTER + ADSP2100_M5:      wr_m5(adsp, info->i);             break;
1725      case CPUINFO_INT_REGISTER + ADSP2100_M6:      wr_m6(adsp, info->i);             break;
1726      case CPUINFO_INT_REGISTER + ADSP2100_M7:      wr_m7(adsp, info->i);             break;
1727
1728      case CPUINFO_INT_REGISTER + ADSP2100_PX:      wr_px(adsp, info->i);             break;
1729      case CPUINFO_INT_REGISTER + ADSP2100_CNTR:      adsp->cntr = info->i;             break;
1730      case CPUINFO_INT_REGISTER + ADSP2100_ASTAT:      wr_astat(adsp, info->i);          break;
1731      case CPUINFO_INT_REGISTER + ADSP2100_SSTAT:      wr_sstat(adsp, info->i);          break;
1732      case CPUINFO_INT_REGISTER + ADSP2100_MSTAT:      wr_mstat(adsp, info->i);          break;
1733
1734      case CPUINFO_INT_SP:
1735      case CPUINFO_INT_REGISTER + ADSP2100_PCSP:      adsp->pc_sp = info->i;             break;
1736      case CPUINFO_INT_REGISTER + ADSP2100_CNTRSP:   adsp->cntr_sp = info->i;          break;
1737      case CPUINFO_INT_REGISTER + ADSP2100_STATSP:   adsp->stat_sp = info->i;          break;
1738      case CPUINFO_INT_REGISTER + ADSP2100_LOOPSP:   adsp->loop_sp = info->i;          break;
1739
1740      case CPUINFO_INT_REGISTER + ADSP2100_IMASK:      wr_imask(adsp, info->i);          break;
1741      case CPUINFO_INT_REGISTER + ADSP2100_ICNTL:      wr_icntl(adsp, info->i);          break;
1742      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE0:   adsp->irq_state[0] = info->i;       break;
1743      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE1:   adsp->irq_state[1] = info->i;       break;
1744      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE2:   adsp->irq_state[2] = info->i;       break;
1745      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE3:   adsp->irq_state[3] = info->i;       break;
1746
1747      case CPUINFO_INT_REGISTER + ADSP2100_FLAGIN:   adsp->flagin = info->i;          break;
1748      case CPUINFO_INT_REGISTER + ADSP2100_FLAGOUT:   adsp->flagout = info->i;          break;
1749      case CPUINFO_INT_REGISTER + ADSP2100_FL0:      adsp->fl0 = info->i;             break;
1750      case CPUINFO_INT_REGISTER + ADSP2100_FL1:      adsp->fl1 = info->i;             break;
1751      case CPUINFO_INT_REGISTER + ADSP2100_FL2:       adsp->fl2 = info->i;             break;
1838static CPU_SET_INFO( adsp21xx )
1839{
1840   adsp2100_state *adsp = device->token;
1841   switch (state)
1842   {
1843      /* --- the following bits of info are set as 64-bit signed integers --- */
1844      case CPUINFO_INT_INPUT_STATE + 0:
1845      case CPUINFO_INT_INPUT_STATE + 1:
1846      case CPUINFO_INT_INPUT_STATE + 2:
1847      case CPUINFO_INT_INPUT_STATE + 3:
1848      case CPUINFO_INT_INPUT_STATE + 4:
1849      case CPUINFO_INT_INPUT_STATE + 5:
1850      case CPUINFO_INT_INPUT_STATE + 6:
1851      case CPUINFO_INT_INPUT_STATE + 7:
1852      case CPUINFO_INT_INPUT_STATE + 8:
1853      case CPUINFO_INT_INPUT_STATE + 9:
1854         set_irq_line(adsp, state - CPUINFO_INT_INPUT_STATE, info->i);
1855         break;
17521856   }
17531857}
17541858
r3957r3958
17671871      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(adsp2100_state);      break;
17681872      case CPUINFO_INT_INPUT_LINES:               /* set per CPU */                  break;
17691873      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
1770      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
1874      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;         break;
17711875      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
17721876      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
17731877      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 4;                     break;
r3957r3958
17751879      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
17761880      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
17771881
1778      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1779      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 14;               break;
1780      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;               break;
1781      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;               break;
1782      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 14;               break;
1783      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;               break;
1784      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1785      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1786      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1882      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 32;                     break;
1883      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:       info->i = 14;                     break;
1884      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:       info->i = -2;                     break;
1885      case CPUINFO_INT_DATABUS_WIDTH_DATA:         info->i = 16;                     break;
1886      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:          info->i = 14;                     break;
1887      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:          info->i = -1;                     break;
17871888
1788      case CPUINFO_INT_PREVIOUSPC:               info->i = adsp->ppc;               break;
1789      case CPUINFO_INT_PC:
1790      case CPUINFO_INT_REGISTER + ADSP2100_PC:      info->i = adsp->pc;                  break;
1889      case CPUINFO_INT_INPUT_STATE + 0:
1890      case CPUINFO_INT_INPUT_STATE + 1:
1891      case CPUINFO_INT_INPUT_STATE + 2:
1892      case CPUINFO_INT_INPUT_STATE + 3:
1893      case CPUINFO_INT_INPUT_STATE + 4:
1894      case CPUINFO_INT_INPUT_STATE + 5:
1895      case CPUINFO_INT_INPUT_STATE + 6:
1896      case CPUINFO_INT_INPUT_STATE + 7:
1897      case CPUINFO_INT_INPUT_STATE + 8:
1898      case CPUINFO_INT_INPUT_STATE + 9:
1899         info->i = adsp->irq_state[state - CPUINFO_INT_INPUT_STATE];
1900         break;
17911901
1792      case CPUINFO_INT_REGISTER + ADSP2100_AX0:      info->i = adsp->core.ax0.u;            break;
1793      case CPUINFO_INT_REGISTER + ADSP2100_AX1:      info->i = adsp->core.ax1.u;            break;
1794      case CPUINFO_INT_REGISTER + ADSP2100_AY0:      info->i = adsp->core.ay0.u;            break;
1795      case CPUINFO_INT_REGISTER + ADSP2100_AY1:      info->i = adsp->core.ay1.u;            break;
1796      case CPUINFO_INT_REGISTER + ADSP2100_AR:      info->i = adsp->core.ar.u;            break;
1797      case CPUINFO_INT_REGISTER + ADSP2100_AF:      info->i = adsp->core.af.u;            break;
1902      /* --- the following bits of info are returned as pointers to functions --- */
1903      case CPUINFO_FCT_SET_INFO:      info->setinfo = CPU_SET_INFO_NAME(adsp21xx);         break;
1904      case CPUINFO_FCT_INIT:         /* set per CPU */                              break;
1905      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(adsp21xx);               break;
1906      case CPUINFO_FCT_EXIT:         info->exit = CPU_EXIT_NAME(adsp21xx);               break;
1907      case CPUINFO_FCT_EXECUTE:      info->execute = CPU_EXECUTE_NAME(adsp21xx);            break;
1908      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(adsp21xx);      break;
1909      case CPUINFO_FCT_IMPORT_STATE:   info->import_state = CPU_IMPORT_STATE_NAME(adsp21xx);   break;
17981910
1799      case CPUINFO_INT_REGISTER + ADSP2100_MX0:      info->i = adsp->core.mx0.u;            break;
1800      case CPUINFO_INT_REGISTER + ADSP2100_MX1:      info->i = adsp->core.mx1.u;            break;
1801      case CPUINFO_INT_REGISTER + ADSP2100_MY0:      info->i = adsp->core.my0.u;            break;
1802      case CPUINFO_INT_REGISTER + ADSP2100_MY1:      info->i = adsp->core.my1.u;            break;
1803      case CPUINFO_INT_REGISTER + ADSP2100_MR0:      info->i = adsp->core.mr.mrx.mr0.u;      break;
1804      case CPUINFO_INT_REGISTER + ADSP2100_MR1:      info->i = adsp->core.mr.mrx.mr1.u;      break;
1805      case CPUINFO_INT_REGISTER + ADSP2100_MR2:      info->i = adsp->core.mr.mrx.mr2.u;      break;
1806      case CPUINFO_INT_REGISTER + ADSP2100_MF:      info->i = adsp->core.mf.u;            break;
1807
1808      case CPUINFO_INT_REGISTER + ADSP2100_SI:      info->i = adsp->core.si.u;            break;
1809      case CPUINFO_INT_REGISTER + ADSP2100_SE:      info->i = adsp->core.se.u;            break;
1810      case CPUINFO_INT_REGISTER + ADSP2100_SB:      info->i = adsp->core.sb.u;            break;
1811      case CPUINFO_INT_REGISTER + ADSP2100_SR0:      info->i = adsp->core.sr.srx.sr0.u;      break;
1812      case CPUINFO_INT_REGISTER + ADSP2100_SR1:      info->i = adsp->core.sr.srx.sr1.u;      break;
1813
1814      case CPUINFO_INT_REGISTER + ADSP2100_AX0_SEC:   info->i = adsp->alt.ax0.u;            break;
1815      case CPUINFO_INT_REGISTER + ADSP2100_AX1_SEC:   info->i = adsp->alt.ax1.u;            break;
1816      case CPUINFO_INT_REGISTER + ADSP2100_AY0_SEC:   info->i = adsp->alt.ay0.u;            break;
1817      case CPUINFO_INT_REGISTER + ADSP2100_AY1_SEC:   info->i = adsp->alt.ay1.u;            break;
1818      case CPUINFO_INT_REGISTER + ADSP2100_AR_SEC:   info->i = adsp->alt.ar.u;            break;
1819      case CPUINFO_INT_REGISTER + ADSP2100_AF_SEC:   info->i = adsp->alt.af.u;            break;
1820
1821      case CPUINFO_INT_REGISTER + ADSP2100_MX0_SEC:   info->i = adsp->alt.mx0.u;            break;
1822      case CPUINFO_INT_REGISTER + ADSP2100_MX1_SEC:   info->i = adsp->alt.mx1.u;            break;
1823      case CPUINFO_INT_REGISTER + ADSP2100_MY0_SEC:   info->i = adsp->alt.my0.u;            break;
1824      case CPUINFO_INT_REGISTER + ADSP2100_MY1_SEC:   info->i = adsp->alt.my1.u;            break;
1825      case CPUINFO_INT_REGISTER + ADSP2100_MR0_SEC:   info->i = adsp->alt.mr.mrx.mr0.u;      break;
1826      case CPUINFO_INT_REGISTER + ADSP2100_MR1_SEC:   info->i = adsp->alt.mr.mrx.mr1.u;      break;
1827      case CPUINFO_INT_REGISTER + ADSP2100_MR2_SEC:   info->i = adsp->alt.mr.mrx.mr2.u;      break;
1828      case CPUINFO_INT_REGISTER + ADSP2100_MF_SEC:   info->i = adsp->alt.mf.u;            break;
1829
1830      case CPUINFO_INT_REGISTER + ADSP2100_SI_SEC:   info->i = adsp->alt.si.u;            break;
1831      case CPUINFO_INT_REGISTER + ADSP2100_SE_SEC:   info->i = adsp->alt.se.u;            break;
1832      case CPUINFO_INT_REGISTER + ADSP2100_SB_SEC:   info->i = adsp->alt.sb.u;            break;
1833      case CPUINFO_INT_REGISTER + ADSP2100_SR0_SEC:   info->i = adsp->alt.sr.srx.sr0.u;      break;
1834      case CPUINFO_INT_REGISTER + ADSP2100_SR1_SEC:   info->i = adsp->alt.sr.srx.sr1.u;      break;
1835
1836      case CPUINFO_INT_REGISTER + ADSP2100_I0:      info->i = adsp->i[0];               break;
1837      case CPUINFO_INT_REGISTER + ADSP2100_I1:      info->i = adsp->i[1];               break;
1838      case CPUINFO_INT_REGISTER + ADSP2100_I2:      info->i = adsp->i[2];               break;
1839      case CPUINFO_INT_REGISTER + ADSP2100_I3:      info->i = adsp->i[3];               break;
1840      case CPUINFO_INT_REGISTER + ADSP2100_I4:      info->i = adsp->i[4];               break;
1841      case CPUINFO_INT_REGISTER + ADSP2100_I5:      info->i = adsp->i[5];               break;
1842      case CPUINFO_INT_REGISTER + ADSP2100_I6:      info->i = adsp->i[6];               break;
1843      case CPUINFO_INT_REGISTER + ADSP2100_I7:      info->i = adsp->i[7];               break;
1844
1845      case CPUINFO_INT_REGISTER + ADSP2100_L0:      info->i = adsp->l[0];               break;
1846      case CPUINFO_INT_REGISTER + ADSP2100_L1:      info->i = adsp->l[1];               break;
1847      case CPUINFO_INT_REGISTER + ADSP2100_L2:      info->i = adsp->l[2];               break;
1848      case CPUINFO_INT_REGISTER + ADSP2100_L3:      info->i = adsp->l[3];               break;
1849      case CPUINFO_INT_REGISTER + ADSP2100_L4:      info->i = adsp->l[4];               break;
1850      case CPUINFO_INT_REGISTER + ADSP2100_L5:      info->i = adsp->l[5];               break;
1851      case CPUINFO_INT_REGISTER + ADSP2100_L6:      info->i = adsp->l[6];               break;
1852      case CPUINFO_INT_REGISTER + ADSP2100_L7:      info->i = adsp->l[7];               break;
1853
1854      case CPUINFO_INT_REGISTER + ADSP2100_M0:      info->i = adsp->m[0];               break;
1855      case CPUINFO_INT_REGISTER + ADSP2100_M1:      info->i = adsp->m[1];               break;
1856      case CPUINFO_INT_REGISTER + ADSP2100_M2:      info->i = adsp->m[2];               break;
1857      case CPUINFO_INT_REGISTER + ADSP2100_M3:      info->i = adsp->m[3];               break;
1858      case CPUINFO_INT_REGISTER + ADSP2100_M4:      info->i = adsp->m[4];               break;
1859      case CPUINFO_INT_REGISTER + ADSP2100_M5:      info->i = adsp->m[5];               break;
1860      case CPUINFO_INT_REGISTER + ADSP2100_M6:      info->i = adsp->m[6];               break;
1861      case CPUINFO_INT_REGISTER + ADSP2100_M7:      info->i = adsp->m[7];               break;
1862
1863      case CPUINFO_INT_REGISTER + ADSP2100_PX:      info->i = adsp->px;                  break;
1864      case CPUINFO_INT_REGISTER + ADSP2100_CNTR:      info->i = adsp->cntr;               break;
1865      case CPUINFO_INT_REGISTER + ADSP2100_ASTAT:      info->i = adsp->astat;               break;
1866      case CPUINFO_INT_REGISTER + ADSP2100_SSTAT:      info->i = adsp->sstat;               break;
1867      case CPUINFO_INT_REGISTER + ADSP2100_MSTAT:      info->i = adsp->mstat;               break;
1868
1869      case CPUINFO_INT_SP:
1870      case CPUINFO_INT_REGISTER + ADSP2100_PCSP:      info->i = adsp->pc_sp;               break;
1871      case CPUINFO_INT_REGISTER + ADSP2100_CNTRSP:   info->i = adsp->cntr_sp;            break;
1872      case CPUINFO_INT_REGISTER + ADSP2100_STATSP:   info->i = adsp->stat_sp;            break;
1873      case CPUINFO_INT_REGISTER + ADSP2100_LOOPSP:   info->i = adsp->loop_sp;            break;
1874
1875      case CPUINFO_INT_REGISTER + ADSP2100_IMASK:      info->i = adsp->imask;               break;
1876      case CPUINFO_INT_REGISTER + ADSP2100_ICNTL:      info->i = adsp->icntl;               break;
1877      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE0:   info->i = adsp->irq_state[0];         break;
1878      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE1:   info->i = adsp->irq_state[1];         break;
1879      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE2:   info->i = adsp->irq_state[2];         break;
1880      case CPUINFO_INT_REGISTER + ADSP2100_IRQSTATE3:   info->i = adsp->irq_state[3];         break;
1881
1882      case CPUINFO_INT_REGISTER + ADSP2100_FLAGIN:   info->i = adsp->flagin;               break;
1883      case CPUINFO_INT_REGISTER + ADSP2100_FLAGOUT:   info->i = adsp->flagout;            break;
1884      case CPUINFO_INT_REGISTER + ADSP2100_FL0:      info->i = adsp->fl0;               break;
1885      case CPUINFO_INT_REGISTER + ADSP2100_FL1:      info->i = adsp->fl1;               break;
1886      case CPUINFO_INT_REGISTER + ADSP2100_FL2:      info->i = adsp->fl2;               break;
1887
1888      /* --- the following bits of info are returned as pointers to data or functions --- */
1889      case CPUINFO_PTR_SET_INFO:                  /* set per CPU */                  break;
1890      case CPUINFO_PTR_INIT:                     /* set per CPU */                  break;
1891      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(adsp21xx);         break;
1892      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(adsp21xx);            break;
1893      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(adsp21xx);      break;
1894      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1895      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(adsp21xx);      break;
1911      /* --- the following bits of info are returned as pointers --- */
18961912      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &adsp->icount;         break;
1913      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &adsp->state;      break;
18971914
18981915      /* --- the following bits of info are returned as NULL-terminated strings --- */
18991916      case CPUINFO_STR_NAME:                     /* set per CPU */                  break;
r3957r3958
19131930            adsp->astat & 0x02 ? 'N':'.',
19141931            adsp->astat & 0x01 ? 'Z':'.');
19151932         break;
1916
1917      case CPUINFO_STR_REGISTER + ADSP2100_PC:        sprintf(info->s, "PC:  %04X", adsp->pc); break;
1918
1919      case CPUINFO_STR_REGISTER + ADSP2100_AX0:      sprintf(info->s, "AX0: %04X", adsp->core.ax0.u); break;
1920      case CPUINFO_STR_REGISTER + ADSP2100_AX1:      sprintf(info->s, "AX1: %04X", adsp->core.ax1.u); break;
1921      case CPUINFO_STR_REGISTER + ADSP2100_AY0:      sprintf(info->s, "AY0: %04X", adsp->core.ay0.u); break;
1922      case CPUINFO_STR_REGISTER + ADSP2100_AY1:      sprintf(info->s, "AY1: %04X", adsp->core.ay1.u); break;
1923      case CPUINFO_STR_REGISTER + ADSP2100_AR:      sprintf(info->s, "AR:  %04X", adsp->core.ar.u); break;
1924      case CPUINFO_STR_REGISTER + ADSP2100_AF:      sprintf(info->s, "AF:  %04X", adsp->core.af.u); break;
1925
1926      case CPUINFO_STR_REGISTER + ADSP2100_MX0:       sprintf(info->s, "MX0: %04X", adsp->core.mx0.u); break;
1927      case CPUINFO_STR_REGISTER + ADSP2100_MX1:       sprintf(info->s, "MX1: %04X", adsp->core.mx1.u); break;
1928      case CPUINFO_STR_REGISTER + ADSP2100_MY0:       sprintf(info->s, "MY0: %04X", adsp->core.my0.u); break;
1929      case CPUINFO_STR_REGISTER + ADSP2100_MY1:       sprintf(info->s, "MY1: %04X", adsp->core.my1.u); break;
1930      case CPUINFO_STR_REGISTER + ADSP2100_MR0:       sprintf(info->s, "MR0: %04X", adsp->core.mr.mrx.mr0.u); break;
1931      case CPUINFO_STR_REGISTER + ADSP2100_MR1:      sprintf(info->s, "MR1: %04X", adsp->core.mr.mrx.mr1.u); break;
1932      case CPUINFO_STR_REGISTER + ADSP2100_MR2:       sprintf(info->s, "MR2: %02X", adsp->core.mr.mrx.mr2.u & 0x00ff); break;
1933      case CPUINFO_STR_REGISTER + ADSP2100_MF:      sprintf(info->s, "MF:  %04X", adsp->core.mf.u); break;
1934
1935      case CPUINFO_STR_REGISTER + ADSP2100_SI:      sprintf(info->s, "SI:  %04X", adsp->core.si.u); break;
1936      case CPUINFO_STR_REGISTER + ADSP2100_SE:      sprintf(info->s, "SE:  %02X  ", adsp->core.se.u & 0x00ff); break;
1937      case CPUINFO_STR_REGISTER + ADSP2100_SB:      sprintf(info->s, "SB:  %02X  ", adsp->core.sb.u & 0x001f); break;
1938      case CPUINFO_STR_REGISTER + ADSP2100_SR0:       sprintf(info->s, "SR0: %04X", adsp->core.sr.srx.sr0.u); break;
1939      case CPUINFO_STR_REGISTER + ADSP2100_SR1:      sprintf(info->s, "SR1: %04X", adsp->core.sr.srx.sr1.u); break;
1940
1941      case CPUINFO_STR_REGISTER + ADSP2100_AX0_SEC:   sprintf(info->s, "AX0_SEC: %04X", adsp->alt.ax0.u); break;
1942      case CPUINFO_STR_REGISTER + ADSP2100_AX1_SEC:   sprintf(info->s, "AX1_SEC: %04X", adsp->alt.ax1.u); break;
1943      case CPUINFO_STR_REGISTER + ADSP2100_AY0_SEC:   sprintf(info->s, "AY0_SEC: %04X", adsp->alt.ay0.u); break;
1944      case CPUINFO_STR_REGISTER + ADSP2100_AY1_SEC:   sprintf(info->s, "AY1_SEC: %04X", adsp->alt.ay1.u); break;
1945      case CPUINFO_STR_REGISTER + ADSP2100_AR_SEC:   sprintf(info->s, "AR_SEC:  %04X", adsp->alt.ar.u); break;
1946      case CPUINFO_STR_REGISTER + ADSP2100_AF_SEC:   sprintf(info->s, "AF_SEC:  %04X", adsp->alt.af.u); break;
1947
1948      case CPUINFO_STR_REGISTER + ADSP2100_MX0_SEC:   sprintf(info->s, "MX0_SEC: %04X", adsp->alt.mx0.u); break;
1949      case CPUINFO_STR_REGISTER + ADSP2100_MX1_SEC:    sprintf(info->s, "MX1_SEC: %04X", adsp->alt.mx1.u); break;
1950      case CPUINFO_STR_REGISTER + ADSP2100_MY0_SEC:    sprintf(info->s, "MY0_SEC: %04X", adsp->alt.my0.u); break;
1951      case CPUINFO_STR_REGISTER + ADSP2100_MY1_SEC:    sprintf(info->s, "MY1_SEC: %04X", adsp->alt.my1.u); break;
1952      case CPUINFO_STR_REGISTER + ADSP2100_MR0_SEC:    sprintf(info->s, "MR0_SEC: %04X", adsp->alt.mr.mrx.mr0.u); break;
1953      case CPUINFO_STR_REGISTER + ADSP2100_MR1_SEC:   sprintf(info->s, "MR1_SEC: %04X", adsp->alt.mr.mrx.mr1.u); break;
1954      case CPUINFO_STR_REGISTER + ADSP2100_MR2_SEC:    sprintf(info->s, "MR2_SEC: %02X", adsp->alt.mr.mrx.mr2.u & 0x00ff); break;
1955      case CPUINFO_STR_REGISTER + ADSP2100_MF_SEC:   sprintf(info->s, "MF_SEC:  %04X", adsp->alt.mf.u); break;
1956
1957      case CPUINFO_STR_REGISTER + ADSP2100_SI_SEC:   sprintf(info->s, "SI_SEC:  %04X", adsp->alt.si.u); break;
1958      case CPUINFO_STR_REGISTER + ADSP2100_SE_SEC:   sprintf(info->s, "SE_SEC:  %02X  ", adsp->alt.se.u & 0x00ff); break;
1959      case CPUINFO_STR_REGISTER + ADSP2100_SB_SEC:   sprintf(info->s, "SB_SEC:  %02X  ", adsp->alt.sb.u & 0x001f); break;
1960      case CPUINFO_STR_REGISTER + ADSP2100_SR0_SEC:    sprintf(info->s, "SR0_SEC: %04X", adsp->alt.sr.srx.sr0.u); break;
1961      case CPUINFO_STR_REGISTER + ADSP2100_SR1_SEC:   sprintf(info->s, "SR1_SEC: %04X", adsp->alt.sr.srx.sr1.u); break;
1962
1963      case CPUINFO_STR_REGISTER + ADSP2100_I0:      sprintf(info->s, "I0:  %04X", adsp->i[0]); break;
1964      case CPUINFO_STR_REGISTER + ADSP2100_I1:      sprintf(info->s, "I1:  %04X", adsp->i[1]); break;
1965      case CPUINFO_STR_REGISTER + ADSP2100_I2:      sprintf(info->s, "I2:  %04X", adsp->i[2]); break;
1966      case CPUINFO_STR_REGISTER + ADSP2100_I3:      sprintf(info->s, "I3:  %04X", adsp->i[3]); break;
1967      case CPUINFO_STR_REGISTER + ADSP2100_I4:      sprintf(info->s, "I4:  %04X", adsp->i[4]); break;
1968      case CPUINFO_STR_REGISTER + ADSP2100_I5:      sprintf(info->s, "I5:  %04X", adsp->i[5]); break;
1969      case CPUINFO_STR_REGISTER + ADSP2100_I6:      sprintf(info->s, "I6:  %04X", adsp->i[6]); break;
1970      case CPUINFO_STR_REGISTER + ADSP2100_I7:      sprintf(info->s, "I7:  %04X", adsp->i[7]); break;
1971
1972      case CPUINFO_STR_REGISTER + ADSP2100_L0:      sprintf(info->s, "L0:  %04X", adsp->l[0]); break;
1973      case CPUINFO_STR_REGISTER + ADSP2100_L1:      sprintf(info->s, "L1:  %04X", adsp->l[1]); break;
1974      case CPUINFO_STR_REGISTER + ADSP2100_L2:      sprintf(info->s, "L2:  %04X", adsp->l[2]); break;
1975      case CPUINFO_STR_REGISTER + ADSP2100_L3:      sprintf(info->s, "L3:  %04X", adsp->l[3]); break;
1976      case CPUINFO_STR_REGISTER + ADSP2100_L4:      sprintf(info->s, "L4:  %04X", adsp->l[4]); break;
1977      case CPUINFO_STR_REGISTER + ADSP2100_L5:      sprintf(info->s, "L5:  %04X", adsp->l[5]); break;
1978      case CPUINFO_STR_REGISTER + ADSP2100_L6:      sprintf(info->s, "L6:  %04X", adsp->l[6]); break;
1979      case CPUINFO_STR_REGISTER + ADSP2100_L7:      sprintf(info->s, "L7:  %04X", adsp->l[7]); break;
1980
1981      case CPUINFO_STR_REGISTER + ADSP2100_M0:      sprintf(info->s, "M0:  %04X", adsp->m[0]); break;
1982      case CPUINFO_STR_REGISTER + ADSP2100_M1:      sprintf(info->s, "M1:  %04X", adsp->m[1]); break;
1983      case CPUINFO_STR_REGISTER + ADSP2100_M2:      sprintf(info->s, "M2:  %04X", adsp->m[2]); break;
1984      case CPUINFO_STR_REGISTER + ADSP2100_M3:      sprintf(info->s, "M3:  %04X", adsp->m[3]); break;
1985      case CPUINFO_STR_REGISTER + ADSP2100_M4:      sprintf(info->s, "M4:  %04X", adsp->m[4]); break;
1986      case CPUINFO_STR_REGISTER + ADSP2100_M5:      sprintf(info->s, "M5:  %04X", adsp->m[5]); break;
1987      case CPUINFO_STR_REGISTER + ADSP2100_M6:      sprintf(info->s, "M6:  %04X", adsp->m[6]); break;
1988      case CPUINFO_STR_REGISTER + ADSP2100_M7:      sprintf(info->s, "M7:  %04X", adsp->m[7]); break;
1989
1990      case CPUINFO_STR_REGISTER + ADSP2100_PX:      sprintf(info->s, "PX:  %02X  ", adsp->px); break;
1991      case CPUINFO_STR_REGISTER + ADSP2100_CNTR:      sprintf(info->s, "CNTR:%04X", adsp->cntr); break;
1992      case CPUINFO_STR_REGISTER + ADSP2100_ASTAT:    sprintf(info->s, "ASTA:%02X  ", adsp->astat); break;
1993      case CPUINFO_STR_REGISTER + ADSP2100_SSTAT:    sprintf(info->s, "SSTA:%02X  ", adsp->sstat); break;
1994      case CPUINFO_STR_REGISTER + ADSP2100_MSTAT:    sprintf(info->s, "MSTA:%02X  ", adsp->mstat); break;
1995
1996      case CPUINFO_STR_REGISTER + ADSP2100_PCSP:       sprintf(info->s, "PCSP:%02X  ", adsp->pc_sp); break;
1997      case CPUINFO_STR_REGISTER + ADSP2100_CNTRSP:    sprintf(info->s, "CTSP:%01X   ", adsp->cntr_sp); break;
1998      case CPUINFO_STR_REGISTER + ADSP2100_STATSP:    sprintf(info->s, "STSP:%01X   ", adsp->stat_sp); break;
1999      case CPUINFO_STR_REGISTER + ADSP2100_LOOPSP:    sprintf(info->s, "LPSP:%01X   ", adsp->loop_sp); break;
2000
2001      case CPUINFO_STR_REGISTER + ADSP2100_IMASK:    sprintf(info->s, "IMSK:%03X  ", adsp->imask); break;
2002      case CPUINFO_STR_REGISTER + ADSP2100_ICNTL:    sprintf(info->s, "ICTL:%02X  ", adsp->icntl); break;
2003      case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE0:   sprintf(info->s, "IRQ0:%X   ", adsp->irq_state[0]); break;
2004      case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE1:   sprintf(info->s, "IRQ1:%X   ", adsp->irq_state[1]); break;
2005      case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE2:   sprintf(info->s, "IRQ2:%X   ", adsp->irq_state[2]); break;
2006      case CPUINFO_STR_REGISTER + ADSP2100_IRQSTATE3:   sprintf(info->s, "IRQ3:%X   ", adsp->irq_state[3]); break;
2007
2008      case CPUINFO_STR_REGISTER + ADSP2100_FLAGIN:    sprintf(info->s, "FI:  %X   ", adsp->flagin); break;
2009      case CPUINFO_STR_REGISTER + ADSP2100_FLAGOUT:    sprintf(info->s, "FO:  %X   ", adsp->flagout); break;
2010      case CPUINFO_STR_REGISTER + ADSP2100_FL0:       sprintf(info->s, "FL0: %X   ", adsp->fl0); break;
2011      case CPUINFO_STR_REGISTER + ADSP2100_FL1:       sprintf(info->s, "FL1: %X   ", adsp->fl1); break;
2012      case CPUINFO_STR_REGISTER + ADSP2100_FL2:       sprintf(info->s, "FL2: %X   ", adsp->fl2); break;
20131933   }
20141934}
20151935
2016#if (HAS_ADSP2104||HAS_ADSP2105||HAS_ADSP2115||HAS_ADSP2181)
20171936static void adsp21xx_load_boot_data(UINT8 *srcdata, UINT32 *dstdata)
20181937{
20191938   /* see how many words we need to copy */
r3957r3958
20251944      dstdata[i] = opcode;
20261945   }
20271946}
2028#endif
20291947
2030#if (HAS_ADSP2100)
1948
20311949/**************************************************************************
20321950 * ADSP2100 section
20331951 **************************************************************************/
20341952
20351953static CPU_INIT( adsp2100 )
20361954{
2037   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2038   adsp->chip_type = CHIP_TYPE_ADSP2100;
1955   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2100);
20391956   adsp->mstat_mask = 0x0f;
20401957   adsp->imask_mask = 0x0f;
20411958}
20421959
2043static CPU_SET_INFO( adsp2100 )
2044{
2045   adsp2100_state *adsp = device->token;
2046   switch (state)
2047   {
2048      /* --- the following bits of info are set as 64-bit signed integers --- */
2049      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ0:   set_irq_line(adsp, ADSP2100_IRQ0, info->i);   break;
2050      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ1:   set_irq_line(adsp, ADSP2100_IRQ1, info->i);   break;
2051      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ2:   set_irq_line(adsp, ADSP2100_IRQ2, info->i);   break;
2052      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ3:   set_irq_line(adsp, ADSP2100_IRQ3, info->i);   break;
2053
2054      default:
2055         CPU_SET_INFO_CALL(adsp21xx);
2056         break;
2057   }
2058}
2059
20601960CPU_GET_INFO( adsp2100 )
20611961{
2062   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
20631962   switch (state)
20641963   {
20651964      /* --- the following bits of info are returned as 64-bit signed integers --- */
2066      case CPUINFO_INT_INPUT_LINES:               info->i = 4;                        break;
2067      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ0:   info->i = adsp->irq_state[ADSP2100_IRQ0];    break;
2068      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ1:   info->i = adsp->irq_state[ADSP2100_IRQ1];    break;
2069      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ2:   info->i = adsp->irq_state[ADSP2100_IRQ2];    break;
2070      case CPUINFO_INT_INPUT_STATE + ADSP2100_IRQ3:   info->i = adsp->irq_state[ADSP2100_IRQ3];    break;
1965      case CPUINFO_INT_INPUT_LINES:               info->i = 4;                     break;
20711966
20721967      /* --- the following bits of info are returned as pointers to data or functions --- */
2073      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2100);               break;
2074      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2100);         break;
1968      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2100);               break;
20751969
20761970      /* --- the following bits of info are returned as NULL-terminated strings --- */
2077      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2100");            break;
1971      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2100");         break;
20781972
20791973      default:
20801974         CPU_GET_INFO_CALL(adsp21xx);
20811975         break;
20821976   }
20831977}
2084#endif
20851978
2086
2087#if (HAS_ADSP2101)
20881979/**************************************************************************
20891980 * ADSP2101 section
20901981 **************************************************************************/
20911982
20921983static CPU_INIT( adsp2101 )
20931984{
2094   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2095   adsp->chip_type = CHIP_TYPE_ADSP2101;
1985   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2101);
20961986   adsp->mstat_mask = 0x7f;
20971987   adsp->imask_mask = 0x3f;
20981988}
20991989
2100static CPU_SET_INFO( adsp2101 )
2101{
2102   adsp2100_state *adsp = device->token;
2103   switch (state)
2104   {
2105      /* --- the following bits of info are set as 64-bit signed integers --- */
2106      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ0:   set_irq_line(adsp, ADSP2101_IRQ0, info->i);         break;
2107      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ1:   set_irq_line(adsp, ADSP2101_IRQ1, info->i);         break;
2108      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ2:   set_irq_line(adsp, ADSP2101_IRQ2, info->i);         break;
2109      case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_RX:set_irq_line(adsp, ADSP2101_SPORT0_RX, info->i);    break;
2110      case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_TX:set_irq_line(adsp, ADSP2101_SPORT0_TX, info->i);    break;
2111      case CPUINFO_INT_INPUT_STATE + ADSP2101_TIMER:   set_irq_line(adsp, ADSP2101_TIMER, info->i);      break;
2112
2113      /* --- the following bits of info are set as pointers to data or functions --- */
2114      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp->sport_rx_callback = (adsp21xx_rx_func)info->f;      break;
2115      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp->sport_tx_callback = (adsp21xx_tx_func)info->f;      break;
2116      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp->timer_fired = (adsp21xx_timer_func)info->f;   break;
2117
2118      default:
2119         CPU_SET_INFO_CALL(adsp21xx);
2120         break;
2121   }
2122}
2123
21241990CPU_GET_INFO( adsp2101 )
21251991{
2126   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
21271992   switch (state)
21281993   {
21291994      /* --- the following bits of info are returned as 64-bit signed integers --- */
2130      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                           break;
2131      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ0:   info->i = adsp->irq_state[ADSP2101_IRQ0];       break;
2132      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ1:   info->i = adsp->irq_state[ADSP2101_IRQ1];       break;
2133      case CPUINFO_INT_INPUT_STATE + ADSP2101_IRQ2:   info->i = adsp->irq_state[ADSP2101_IRQ2];       break;
2134      case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_RX:info->i = adsp->irq_state[ADSP2101_SPORT0_RX];break;
2135      case CPUINFO_INT_INPUT_STATE + ADSP2101_SPORT0_TX:info->i = adsp->irq_state[ADSP2101_SPORT0_TX];break;
2136      case CPUINFO_INT_INPUT_STATE + ADSP2101_TIMER:   info->i = adsp->irq_state[ADSP2101_TIMER];       break;
1995      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                     break;
21371996
21381997      /* --- the following bits of info are returned as pointers to data or functions --- */
2139      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2101);                  break;
2140      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2101);            break;
1998      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2101);               break;
21411999
2142      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp->sport_rx_callback;      break;
2143      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp->sport_tx_callback;      break;
2144      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp->timer_fired;      break;
2145
21462000      /* --- the following bits of info are returned as NULL-terminated strings --- */
2147      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2101");               break;
2001      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2101");         break;
21482002
21492003      default:
21502004         CPU_GET_INFO_CALL(adsp21xx);
21512005         break;
21522006   }
21532007}
2154#endif
21552008
2156
2157#if (HAS_ADSP2104)
21582009/**************************************************************************
21592010 * ADSP2104 section
21602011 **************************************************************************/
21612012
21622013static CPU_INIT( adsp2104 )
21632014{
2164   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2165   adsp->chip_type = CHIP_TYPE_ADSP2104;
2015   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2104);
21662016   adsp->mstat_mask = 0x7f;
21672017   adsp->imask_mask = 0x3f;
21682018}
r3957r3958
21722022   adsp21xx_load_boot_data(srcdata, dstdata);
21732023}
21742024
2175static CPU_SET_INFO( adsp2104 )
2176{
2177   adsp2100_state *adsp = device->token;
2178   switch (state)
2179   {
2180      /* --- the following bits of info are set as 64-bit signed integers --- */
2181      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ0:   set_irq_line(adsp, ADSP2104_IRQ0, info->i);         break;
2182      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ1:   set_irq_line(adsp, ADSP2104_IRQ1, info->i);         break;
2183      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ2:   set_irq_line(adsp, ADSP2104_IRQ2, info->i);         break;
2184      case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_RX:set_irq_line(adsp, ADSP2104_SPORT0_RX, info->i);    break;
2185      case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_TX:set_irq_line(adsp, ADSP2104_SPORT0_TX, info->i);    break;
2186      case CPUINFO_INT_INPUT_STATE + ADSP2104_TIMER:   set_irq_line(adsp, ADSP2104_TIMER, info->i);      break;
2187
2188      /* --- the following bits of info are set as pointers to data or functions --- */
2189      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp->sport_rx_callback = (adsp21xx_rx_func)info->f;      break;
2190      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp->sport_tx_callback = (adsp21xx_tx_func)info->f;      break;
2191      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp->timer_fired = (adsp21xx_timer_func)info->f;   break;
2192
2193      default:
2194         CPU_SET_INFO_CALL(adsp21xx);
2195         break;
2196   }
2197}
2198
21992025CPU_GET_INFO( adsp2104 )
22002026{
2201   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
22022027   switch (state)
22032028   {
22042029      /* --- the following bits of info are returned as 64-bit signed integers --- */
2205      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                           break;
2206      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ0:   info->i = adsp->irq_state[ADSP2104_IRQ0];       break;
2207      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ1:   info->i = adsp->irq_state[ADSP2104_IRQ1];       break;
2208      case CPUINFO_INT_INPUT_STATE + ADSP2104_IRQ2:   info->i = adsp->irq_state[ADSP2104_IRQ2];       break;
2209      case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_RX:info->i = adsp->irq_state[ADSP2104_SPORT0_RX];break;
2210      case CPUINFO_INT_INPUT_STATE + ADSP2104_SPORT0_TX:info->i = adsp->irq_state[ADSP2104_SPORT0_TX];break;
2211      case CPUINFO_INT_INPUT_STATE + ADSP2104_TIMER:   info->i = adsp->irq_state[ADSP2104_TIMER];       break;
2030      case CPUINFO_INT_INPUT_LINES:               info->i = 6;                     break;
22122031
22132032      /* --- the following bits of info are returned as pointers to data or functions --- */
2214      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2104);                  break;
2215      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2104);            break;
2033      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2104);               break;
22162034
2217      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp->sport_rx_callback;      break;
2218      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp->sport_tx_callback;      break;
2219      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp->timer_fired;      break;
2220
22212035      /* --- the following bits of info are returned as NULL-terminated strings --- */
2222      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2104");               break;
2036      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2104");         break;
22232037
22242038      default:
22252039         CPU_GET_INFO_CALL(adsp21xx);
22262040         break;
22272041   }
22282042}
2229#endif
22302043
2231
2232#if (HAS_ADSP2105)
22332044/**************************************************************************
22342045 * ADSP2105 section
22352046 **************************************************************************/
22362047
22372048static CPU_INIT( adsp2105 )
22382049{
2239   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2240   adsp->chip_type = CHIP_TYPE_ADSP2105;
2050   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2105);
22412051   adsp->mstat_mask = 0x7f;
22422052   adsp->imask_mask = 0x3f;
22432053}
r3957r3958
22472057   adsp21xx_load_boot_data(srcdata, dstdata);
22482058}
22492059
2250static CPU_SET_INFO( adsp2105 )
2251{
2252   adsp2100_state *adsp = device->token;
2253   switch (state)
2254   {
2255      /* --- the following bits of info are set as 64-bit signed integers --- */
2256      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ0:   set_irq_line(adsp, ADSP2105_IRQ0, info->i);      break;
2257      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ1:   set_irq_line(adsp, ADSP2105_IRQ1, info->i);      break;
2258      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ2:   set_irq_line(adsp, ADSP2105_IRQ2, info->i);      break;
2259
2260      /* --- the following bits of info are set as pointers to data or functions --- */
2261      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp->sport_rx_callback = (adsp21xx_rx_func)info->f;   break;
2262      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp->sport_tx_callback = (adsp21xx_tx_func)info->f;   break;
2263      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp->timer_fired = (adsp21xx_timer_func)info->f;   break;
2264
2265      default:
2266         CPU_SET_INFO_CALL(adsp21xx);
2267         break;
2268   }
2269}
2270
22712060CPU_GET_INFO( adsp2105 )
22722061{
2273   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
22742062   switch (state)
22752063   {
22762064      /* --- the following bits of info are returned as 64-bit signed integers --- */
2277      case CPUINFO_INT_INPUT_LINES:               info->i = 3;                        break;
2278      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ0:   info->i = adsp->irq_state[ADSP2105_IRQ0];    break;
2279      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ1:   info->i = adsp->irq_state[ADSP2105_IRQ1];    break;
2280      case CPUINFO_INT_INPUT_STATE + ADSP2105_IRQ2:   info->i = adsp->irq_state[ADSP2105_IRQ2];    break;
2065      case CPUINFO_INT_INPUT_LINES:               info->i = 3;                     break;
22812066
22822067      /* --- the following bits of info are returned as pointers to data or functions --- */
2283      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2105);               break;
2284      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2105);         break;
2068      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2105);               break;
22852069
2286      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp->sport_rx_callback;   break;
2287      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp->sport_tx_callback;   break;
2288      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp->timer_fired;   break;
2289
22902070      /* --- the following bits of info are returned as NULL-terminated strings --- */
2291      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2105");            break;
2071      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2105");         break;
22922072
22932073      default:
22942074         CPU_GET_INFO_CALL(adsp21xx);
22952075         break;
22962076   }
22972077}
2298#endif
22992078
2300
2301#if (HAS_ADSP2115)
23022079/**************************************************************************
23032080 * ADSP2115 section
23042081 **************************************************************************/
23052082
23062083static CPU_INIT( adsp2115 )
23072084{
2308   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2309   adsp->chip_type = CHIP_TYPE_ADSP2115;
2085   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2115);
23102086   adsp->mstat_mask = 0x7f;
23112087   adsp->imask_mask = 0x3f;
23122088}
r3957r3958
23162092   adsp21xx_load_boot_data(srcdata, dstdata);
23172093}
23182094
2319static CPU_SET_INFO( adsp2115 )
2320{
2321   adsp2100_state *adsp = device->token;
2322   switch (state)
2323   {
2324      /* --- the following bits of info are set as 64-bit signed integers --- */
2325      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ0:   set_irq_line(adsp, ADSP2115_IRQ0, info->i);         break;
2326      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ1:   set_irq_line(adsp, ADSP2115_IRQ1, info->i);         break;
2327      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ2:   set_irq_line(adsp, ADSP2115_IRQ2, info->i);         break;
2328      case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_RX:set_irq_line(adsp, ADSP2115_SPORT0_RX, info->i);    break;
2329      case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_TX:set_irq_line(adsp, ADSP2115_SPORT0_TX, info->i);    break;
2330      case CPUINFO_INT_INPUT_STATE + ADSP2115_TIMER:   set_irq_line(adsp, ADSP2115_TIMER, info->i);      break;
2331
2332      /* --- the following bits of info are set as pointers to data or functions --- */
2333      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp->sport_rx_callback = (adsp21xx_rx_func)info->f;      break;
2334      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp->sport_tx_callback = (adsp21xx_tx_func)info->f;      break;
2335      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp->timer_fired = (adsp21xx_timer_func)info->f;   break;
2336
2337      default:
2338         CPU_SET_INFO_CALL(adsp21xx);
2339         break;
2340   }
2341}
2342
23432095CPU_GET_INFO( adsp2115 )
23442096{
2345   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
23462097   switch (state)
23472098   {
23482099      /* --- the following bits of info are returned as 64-bit signed integers --- */
2349      case CPUINFO_INT_INPUT_LINES:               info->i = 4;                           break;
2350      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ0:   info->i = adsp->irq_state[ADSP2115_IRQ0];       break;
2351      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ1:   info->i = adsp->irq_state[ADSP2115_IRQ1];       break;
2352      case CPUINFO_INT_INPUT_STATE + ADSP2115_IRQ2:   info->i = adsp->irq_state[ADSP2115_IRQ2];       break;
2353      case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_RX:info->i = adsp->irq_state[ADSP2115_SPORT0_RX];break;
2354      case CPUINFO_INT_INPUT_STATE + ADSP2115_SPORT0_TX:info->i = adsp->irq_state[ADSP2115_SPORT0_TX];break;
2355      case CPUINFO_INT_INPUT_STATE + ADSP2115_TIMER:   info->i = adsp->irq_state[ADSP2115_TIMER];       break;
2100      case CPUINFO_INT_INPUT_LINES:               info->i = 6;                     break;
23562101
23572102      /* --- the following bits of info are returned as pointers to data or functions --- */
2358      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2115);                  break;
2359      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2115);            break;
2103      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2115);               break;
23602104
2361      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp->sport_rx_callback;      break;
2362      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp->sport_tx_callback;      break;
2363      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp->timer_fired;      break;
2364
23652105      /* --- the following bits of info are returned as NULL-terminated strings --- */
2366      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2115");               break;
2106      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2115");         break;
23672107
23682108      default:
23692109         CPU_GET_INFO_CALL(adsp21xx);
23702110         break;
23712111   }
23722112}
2373#endif
23742113
2375
2376#if (HAS_ADSP2181)
23772114/**************************************************************************
23782115 * ADSP2181 section
23792116 **************************************************************************/
23802117
23812118static CPU_INIT( adsp2181 )
23822119{
2383   adsp2100_state *adsp = adsp21xx_init(device, index, clock, irqcallback);
2384   adsp->chip_type = CHIP_TYPE_ADSP2181;
2120   adsp2100_state *adsp = adsp21xx_init(device, irqcallback, CHIP_TYPE_ADSP2181);
23852121   adsp->mstat_mask = 0x7f;
23862122   adsp->imask_mask = 0x3ff;
23872123}
r3957r3958
23912127   adsp21xx_load_boot_data(srcdata, dstdata);
23922128}
23932129
2394static CPU_SET_INFO( adsp2181 )
2395{
2396   adsp2100_state *adsp = device->token;
2397   switch (state)
2398   {
2399      /* --- the following bits of info are set as 64-bit signed integers --- */
2400      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ0:   set_irq_line(adsp, ADSP2181_IRQ0, info->i);         break;
2401      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ1:   set_irq_line(adsp, ADSP2181_IRQ1, info->i);         break;
2402      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ2:   set_irq_line(adsp, ADSP2181_IRQ2, info->i);         break;
2403      case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_RX:set_irq_line(adsp, ADSP2181_SPORT0_RX, info->i);    break;
2404      case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_TX:set_irq_line(adsp, ADSP2181_SPORT0_TX, info->i);    break;
2405      case CPUINFO_INT_INPUT_STATE + ADSP2181_TIMER:   set_irq_line(adsp, ADSP2181_TIMER, info->i);      break;
2406      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQE:   set_irq_line(adsp, ADSP2181_IRQE, info->i);         break;
2407      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL1:   set_irq_line(adsp, ADSP2181_IRQL1, info->i);      break;
2408      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL2:   set_irq_line(adsp, ADSP2181_IRQL2, info->i);      break;
2409
2410      /* --- the following bits of info are set as pointers to data or functions --- */
2411      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         adsp->sport_rx_callback = (adsp21xx_rx_func)info->f;      break;
2412      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         adsp->sport_tx_callback = (adsp21xx_tx_func)info->f;      break;
2413      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      adsp->timer_fired = (adsp21xx_timer_func)info->f;   break;
2414
2415      default:
2416         CPU_SET_INFO_CALL(adsp21xx);
2417         break;
2418   }
2419}
2420
24212130CPU_GET_INFO( adsp2181 )
24222131{
2423   adsp2100_state *adsp = (device != NULL) ? device->token : NULL;
24242132   switch (state)
24252133   {
24262134      /* --- the following bits of info are returned as 64-bit signed integers --- */
2427      case CPUINFO_INT_INPUT_LINES:               info->i = 4;                           break;
2428      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ0:   info->i = adsp->irq_state[ADSP2181_IRQ0];       break;
2429      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ1:   info->i = adsp->irq_state[ADSP2181_IRQ1];       break;
2430      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQ2:   info->i = adsp->irq_state[ADSP2181_IRQ2];       break;
2431      case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_RX:info->i = adsp->irq_state[ADSP2181_SPORT0_RX];break;
2432      case CPUINFO_INT_INPUT_STATE + ADSP2181_SPORT0_TX:info->i = adsp->irq_state[ADSP2181_SPORT0_TX];break;
2433      case CPUINFO_INT_INPUT_STATE + ADSP2181_TIMER:   info->i = adsp->irq_state[ADSP2181_TIMER];       break;
2434      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQE:   info->i = adsp->irq_state[ADSP2181_IRQE];       break;
2435      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL1:   info->i = adsp->irq_state[ADSP2181_IRQL1];       break;
2436      case CPUINFO_INT_INPUT_STATE + ADSP2181_IRQL2:   info->i = adsp->irq_state[ADSP2181_IRQL2];       break;
2135      case CPUINFO_INT_INPUT_LINES:               info->i = 9;                     break;
24372136
2438      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;                     break;
2439      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 11;                     break;
2440      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = -1;                     break;
2137      case CPUINFO_INT_DATABUS_WIDTH_IO:            info->i = 16;                     break;
2138      case CPUINFO_INT_ADDRBUS_WIDTH_IO:             info->i = 11;                     break;
2139      case CPUINFO_INT_ADDRBUS_SHIFT_IO:             info->i = -1;                     break;
24412140
24422141      /* --- the following bits of info are returned as pointers to data or functions --- */
2443      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(adsp2181);                  break;
2444      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(adsp2181);            break;
2142      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(adsp2181);               break;
24452143
2446      case CPUINFO_PTR_ADSP2100_RX_HANDLER:         info->f = (genf *)adsp->sport_rx_callback;       break;
2447      case CPUINFO_PTR_ADSP2100_TX_HANDLER:         info->f = (genf *)adsp->sport_tx_callback;       break;
2448      case CPUINFO_PTR_ADSP2100_TIMER_HANDLER:      info->f = (genf *)adsp->timer_fired;       break;
2449
24502144      /* --- the following bits of info are returned as NULL-terminated strings --- */
24512145      case CPUINFO_STR_NAME:                     strcpy(info->s, "ADSP2181");               break;
24522146
r3957r3958
25252219
25262220   return result;
25272221}
2528
2529#endif
src/emu/cpu/dsp32/dsp32.h
r3957r3958
7070typedef struct _dsp32_config dsp32_config;
7171struct _dsp32_config
7272{
73   void   (*output_pins_changed)(UINT32 pins);   /* a change has occurred on an output pin */
73   void   (*output_pins_changed)(const device_config *device, UINT32 pins);   /* a change has occurred on an output pin */
7474};
7575
7676
r3957r3958
8080***************************************************************************/
8181
8282extern CPU_GET_INFO( dsp32c );
83#define CPU_DSP32C CPU_GET_INFO_NAME( dsp32c )
8384
8485extern void dsp32c_pio_w(const device_config *device, int reg, int data);
8586extern int dsp32c_pio_r(const device_config *device, int reg);
src/emu/cpu/dsp32/dsp32.c
r3957r3958
181181   int            icount;
182182   UINT8         lastpins;
183183   UINT32         ppc;
184   void         (*output_pins_changed)(UINT32 pins);
184   void         (*output_pins_changed)(const device_config *device, UINT32 pins);
185185   const device_config *device;
186186   const address_space *program;
187187};
r3957r3958
283283      if (newoutput != cpustate->lastpins)
284284      {
285285         cpustate->lastpins = newoutput;
286         (*cpustate->output_pins_changed)(newoutput);
286         (*cpustate->output_pins_changed)(cpustate->device, newoutput);
287287      }
288288   }
289289}
r3957r3958
735735      case CPUINFO_INT_MIN_CYCLES:               info->i = 4;                     break;
736736      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
737737
738      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
739      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
740      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
741      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
742      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
743      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
744      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
745      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
746      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
738      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
739      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
740      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
741      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
742      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
743      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
744      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
745      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
746      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
747747
748748      case CPUINFO_INT_INPUT_STATE + DSP32_IRQ0:      info->i = 0;                     break;
749749      case CPUINFO_INT_INPUT_STATE + DSP32_IRQ1:      info->i = 0;                     break;
r3957r3958
806806      case CPUINFO_INT_REGISTER + DSP32_IOC:         info->i = cpustate->IOC;               break;
807807
808808      /* --- the following bits of info are returned as pointers to data or functions --- */
809      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dsp32c);      break;
810      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(dsp32c);            break;
811      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(dsp32c);            break;
812      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(dsp32c);            break;
813      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dsp32c);         break;
814      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
815      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dsp32c);      break;
809      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dsp32c);      break;
810      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(dsp32c);            break;
811      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(dsp32c);            break;
812      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(dsp32c);            break;
813      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dsp32c);         break;
814      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
815      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dsp32c);      break;
816816      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
817817
818818      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/drcbex64.c
r3957r3958
175175#include "debugger.h"
176176#include "x86emit.h"
177177#include "eminline.h"
178#undef REG_SP
179178#include "x86log.h"
180179#include <math.h>
181180#include <stddef.h>
src/emu/cpu/rsp/rsp.c
r3957r3958
29332933      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
29342934      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
29352935
2936      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
2937      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2938      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2939      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2940      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2941      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2942      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
2943      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
2944      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2936      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
2937      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
2938      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
2939      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
2940      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
2941      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
2942      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
2943      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
2944      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
29452945
29462946      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
29472947
r3957r3958
29882988        case CPUINFO_INT_REGISTER + RSP_STEPCNT:        info->i = cpustate->step_count;               break;
29892989
29902990      /* --- the following bits of info are returned as pointers to data or functions --- */
2991      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(rsp);         break;
2992      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(rsp);               break;
2993      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(rsp);            break;
2994      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(rsp);               break;
2995      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(rsp);         break;
2996      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2997      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(rsp);         break;
2991      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(rsp);         break;
2992      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(rsp);               break;
2993      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(rsp);            break;
2994      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(rsp);               break;
2995      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(rsp);         break;
2996      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2997      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(rsp);         break;
29982998      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
29992999
30003000      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/rsp/rsp.h
r3957r3958
7272#define RSP_STATUS_SIGNAL7       0x4000
7373
7474CPU_GET_INFO( rsp );
75#define CPU_RSP CPU_GET_INFO_NAME( rsp )
7576
7677extern offs_t rsp_dasm_one(char *buffer, offs_t pc, UINT32 op);
7778
src/emu/cpu/cop400/cop410.c
r3957r3958
195195
196196   /* set clock divider */
197197
198   cpu_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
198   device_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
199199
200200   /* allocate serial timer */
201201
202202   cop400->serial_timer = timer_alloc(device->machine, cop400_serial_tick, cop400);
203   timer_adjust_periodic(cop400->serial_timer, attotime_zero, index, ATTOTIME_IN_HZ(clock));
203   timer_adjust_periodic(cop400->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
204204
205205   /* initialize instruction length array */
206206
r3957r3958
413413      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
414414      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
415415
416      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
417      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 9;               break;
418      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
419      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
420      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 6;               break;
421      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
422      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
423      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
424      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
416      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
417      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 9;               break;
418      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
419      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
420      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 6;               break;
421      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
422      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
423      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
424      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
425425
426426      case CPUINFO_INT_INPUT_STATE + 0:            info->i = 0;                      break;
427427
r3957r3958
441441      case CPUINFO_INT_REGISTER + COP400_SKL:         info->i = SKL;                     break;
442442
443443      /* --- the following bits of info are returned as pointers to data or functions --- */
444      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop410);      break;
445      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop410);            break;
446      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cop410);            break;
447      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop410);         break;
448      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
449      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop410);      break;
444      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop410);      break;
445      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop410);            break;
446      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cop410);            break;
447      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop410);         break;
448      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
449      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop410);      break;
450450      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cop400->icount;         break;
451      case CPUINFO_PTR_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop410);   break;
451      case CPUINFO_FCT_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop410);   break;
452452
453      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
453      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
454454         info->internal_map8 = ADDRESS_MAP_NAME(cop410_internal_rom);                              break;
455      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:
455      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:
456456          info->internal_map8 = ADDRESS_MAP_NAME(cop410_internal_ram);                        break;
457457
458458      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
487487   switch (state)
488488   {
489489      /* --- the following bits of info are returned as pointers to data or functions --- */
490      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop411);            break;
490      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop411);            break;
491491
492492      /* --- the following bits of info are returned as NULL-terminated strings --- */
493493      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP411");            break;
r3957r3958
506506      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP401");            break;
507507      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "National Semiconductor COPS"); break;
508508
509      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
509      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
510510          info->internal_map8 = NULL;                                             break;
511511
512512      default: CPU_GET_INFO_CALL(cop410); break;
src/emu/cpu/cop400/cop420.c
r3957r3958
198198
199199   /* set clock divider */
200200
201   cpu_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
201   device_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
202202
203203   /* allocate serial timer */
204204
205205   cop400->serial_timer = timer_alloc(device->machine, cop400_serial_tick, cop400);
206   timer_adjust_periodic(cop400->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(clock));
206   timer_adjust_periodic(cop400->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
207207
208208   /* allocate counter timer */
209209
210210   cop400->counter_timer = timer_alloc(device->machine, cop400_counter_tick, cop400);
211   timer_adjust_periodic(cop400->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(clock / 4));
211   timer_adjust_periodic(cop400->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16 / 4));
212212
213213   /* allocate IN latch timer */
214214
215215   cop400->inil_timer = timer_alloc(device->machine, cop400_inil_tick, cop400);
216   timer_adjust_periodic(cop400->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(clock));
216   timer_adjust_periodic(cop400->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
217217
218218   /* allocate Microbus timer */
219219
220220   if (cop400->intf->microbus == COP400_MICROBUS_ENABLED)
221221   {
222222      cop400->microbus_timer = timer_alloc(device->machine, cop400_microbus_tick, cop400);
223      timer_adjust_periodic(cop400->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(clock));
223      timer_adjust_periodic(cop400->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
224224   }
225225
226226   /* initialize instruction length array */
r3957r3958
497497      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
498498      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
499499
500      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
501      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
502      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
503      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
504      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 6;               break;
505      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
506      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
507      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
508      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
500      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
501      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
502      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
503      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
504      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 6;               break;
505      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
506      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
507      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
508      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
509509
510510      case CPUINFO_INT_INPUT_STATE + 0:            info->i = 0;                      break;
511511
r3957r3958
526526      case CPUINFO_INT_REGISTER + COP400_SKL:         info->i = SKL;                     break;
527527
528528      /* --- the following bits of info are returned as pointers to data or functions --- */
529      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop420);      break;
530      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop420);            break;
531      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cop420);            break;
532      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop420);         break;
533      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
534      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop420);      break;
529      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop420);      break;
530      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop420);            break;
531      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cop420);            break;
532      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop420);         break;
533      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
534      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop420);      break;
535535      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cop400->icount;         break;
536      case CPUINFO_PTR_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop420);   break;
536      case CPUINFO_FCT_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop420);   break;
537537
538        case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
538        case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
539539            info->internal_map8 = ADDRESS_MAP_NAME(cop420_internal_rom);                              break;
540      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:
540      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:
541541          info->internal_map8 = ADDRESS_MAP_NAME(cop420_internal_ram);                        break;
542542
543543      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
573573   switch (state)
574574   {
575575      /* --- the following bits of info are returned as pointers to data or functions --- */
576      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop421);            break;
577      case CPUINFO_PTR_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421);   break;
576      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop421);            break;
577      case CPUINFO_FCT_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421);   break;
578578
579579      /* --- the following bits of info are returned as NULL-terminated strings --- */
580580      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP421");            break;
r3957r3958
591591   switch (state)
592592   {
593593      /* --- the following bits of info are returned as pointers to data or functions --- */
594      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop422);            break;
595      case CPUINFO_PTR_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421);   break;
594      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop422);            break;
595      case CPUINFO_FCT_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop421);   break;
596596
597597      /* --- the following bits of info are returned as NULL-terminated strings --- */
598598      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP422");            break;
r3957r3958
609609   switch (state)
610610   {
611611      /* --- the following bits of info are returned as pointers to data or functions --- */
612      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
612      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
613613          info->internal_map8 = NULL;                                             break;
614614
615615      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/cop400/cop440.c
r3957r3958
210210
211211   /* set clock divider */
212212
213   cpu_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
213   device_set_info_int(device, CPUINFO_INT_CLOCK_DIVIDER, cop400->intf->cki);
214214
215215   /* allocate serial timer */
216216
217217   cop400->serial_timer = timer_alloc(device->machine, cop400_serial_tick, cop400);
218   timer_adjust_periodic(cop400->serial_timer, attotime_zero, index, ATTOTIME_IN_HZ(clock));
218   timer_adjust_periodic(cop400->serial_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
219219
220220   /* allocate counter timer */
221221
222222   cop400->counter_timer = timer_alloc(device->machine, cop400_counter_tick, cop400);
223   timer_adjust_periodic(cop400->counter_timer, attotime_zero, index, ATTOTIME_IN_HZ(clock / 4));
223   timer_adjust_periodic(cop400->counter_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16 / 4));
224224
225225   /* allocate IN latch timer */
226226
227227   cop400->inil_timer = timer_alloc(device->machine, cop400_inil_tick, cop400);
228   timer_adjust_periodic(cop400->inil_timer, attotime_zero, index, ATTOTIME_IN_HZ(clock));
228   timer_adjust_periodic(cop400->inil_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
229229
230230   /* allocate Microbus timer */
231231
232232   if (cop400->intf->microbus == COP400_MICROBUS_ENABLED)
233233   {
234234      cop400->microbus_timer = timer_alloc(device->machine, cop400_microbus_tick, cop400);
235      timer_adjust_periodic(cop400->microbus_timer, attotime_zero, index, ATTOTIME_IN_HZ(clock));
235      timer_adjust_periodic(cop400->microbus_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock / 16));
236236   }
237237
238238   /* initialize instruction length array */
r3957r3958
519519      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
520520      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
521521
522      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
523      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
524      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
525      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
526      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
527      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
528      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
529      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
530      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
522      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
523      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
524      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
525      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
526      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
527      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
528      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
529      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
530      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
531531
532532      case CPUINFO_INT_INPUT_STATE + 0:            info->i = 0;                      break;
533533
r3957r3958
548548      case CPUINFO_INT_REGISTER + COP400_SKL:         info->i = SKL;                     break;
549549
550550      /* --- the following bits of info are returned as pointers to data or functions --- */
551      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop444);      break;
552      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop444);            break;
553      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cop444);            break;
554      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop444);         break;
555      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
556      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop444);      break;
551      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cop444);      break;
552      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop444);            break;
553      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cop444);            break;
554      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cop444);         break;
555      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
556      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cop444);      break;
557557      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cop400->icount;         break;
558      case CPUINFO_PTR_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop444);   break;
558      case CPUINFO_FCT_VALIDITY_CHECK:            info->validity_check = CPU_VALIDITY_CHECK_NAME(cop444);   break;
559559
560        case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
560        case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
561561            info->internal_map8 = ADDRESS_MAP_NAME(cop444_internal_rom);                              break;
562      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:
562      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:
563563          info->internal_map8 = ADDRESS_MAP_NAME(cop444_internal_ram);                        break;
564564
565565      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
595595   switch (state)
596596   {
597597      /* --- the following bits of info are returned as pointers to data or functions --- */
598      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop445);            break;
598      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop445);            break;
599599
600600      /* --- the following bits of info are returned as NULL-terminated strings --- */
601601      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP445");            break;
r3957r3958
612612   switch (state)
613613   {
614614      /* --- the following bits of info are returned as 64-bit signed integers --- */
615      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 6;               break;
615      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 6;               break;
616616
617617      /* --- the following bits of info are returned as pointers to data or functions --- */
618      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
618      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
619619          info->internal_map8 = ADDRESS_MAP_NAME(cop424_internal_rom);                        break;
620      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:
620      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:
621621          info->internal_map8 = ADDRESS_MAP_NAME(cop424_internal_ram);                        break;
622622
623623      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
635635   switch (state)
636636   {
637637      /* --- the following bits of info are returned as pointers to data or functions --- */
638      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop425);            break;
638      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop425);            break;
639639
640640      /* --- the following bits of info are returned as NULL-terminated strings --- */
641641      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP425");            break;
r3957r3958
652652   switch (state)
653653   {
654654      /* --- the following bits of info are returned as pointers to data or functions --- */
655      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cop426);            break;
655      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cop426);            break;
656656
657657      /* --- the following bits of info are returned as NULL-terminated strings --- */
658658      case CPUINFO_STR_NAME:                     strcpy(info->s, "COP426");            break;
r3957r3958
669669   switch (state)
670670   {
671671      /* --- the following bits of info are returned as pointers to data or functions --- */
672      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:
672      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:
673673          info->internal_map8 = NULL;                                             break;
674674
675675      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/cop400/cop400.h
r3957r3958
9494extern CPU_GET_INFO( cop410 );
9595extern CPU_GET_INFO( cop411 );
9696
97#define CPU_COP401 CPU_GET_INFO_NAME( cop401 )
98#define CPU_COP410 CPU_GET_INFO_NAME( cop410 )
99#define CPU_COP411 CPU_GET_INFO_NAME( cop411 )
100
97101/* COP 42x */
98102extern CPU_GET_INFO( cop402 );
99103extern CPU_GET_INFO( cop420 );
100104extern CPU_GET_INFO( cop421 );
101105extern CPU_GET_INFO( cop422 );
102106
107#define CPU_COP402 CPU_GET_INFO_NAME( cop402 )
108#define CPU_COP420 CPU_GET_INFO_NAME( cop420 )
109#define CPU_COP421 CPU_GET_INFO_NAME( cop421 )
110#define CPU_COP422 CPU_GET_INFO_NAME( cop422 )
111
103112/* COP 44x */
104113extern CPU_GET_INFO( cop404 );
105114extern CPU_GET_INFO( cop424 );
r3957r3958
108117extern CPU_GET_INFO( cop444 );
109118extern CPU_GET_INFO( cop445 );
110119
120#define CPU_COP404 CPU_GET_INFO_NAME( cop404 )
121#define CPU_COP424 CPU_GET_INFO_NAME( cop424 )
122#define CPU_COP425 CPU_GET_INFO_NAME( cop425 )
123#define CPU_COP426 CPU_GET_INFO_NAME( cop426 )
124#define CPU_COP444 CPU_GET_INFO_NAME( cop444 )
125#define CPU_COP445 CPU_GET_INFO_NAME( cop445 )
126
111127CPU_DISASSEMBLE( cop410 );
112128CPU_DISASSEMBLE( cop420 );
113129CPU_DISASSEMBLE( cop444 );
src/emu/cpu/m6502/m4510.c
r3957r3958
450450      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
451451      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
452452
453      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
454      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
455      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
456      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
457      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 13;               break;
458      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
459      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
460      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
461      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
462      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
463      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
453      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
454      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
455      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
456      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 16;               break;
457      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = 13;               break;
458      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
459      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
460      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
461      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
462      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
463      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
464464
465465      case CPUINFO_INT_INPUT_STATE + M4510_IRQ_LINE:   info->i = cpustate->irq_state;            break;
466466      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;            break;
r3957r3958
492492      case CPUINFO_INT_M6510_PORT:               info->i = m4510_get_port(cpustate);            break;
493493
494494      /* --- the following bits of info are returned as pointers to data or functions --- */
495      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m4510);         break;
496      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m4510);            break;
497      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m4510);            break;
498      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m4510);            break;
499      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m4510);         break;
500      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
501      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m4510);         break;
495      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m4510);         break;
496      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m4510);            break;
497      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m4510);            break;
498      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m4510);            break;
499      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m4510);         break;
500      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
501      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m4510);         break;
502502      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
503503      case CPUINFO_PTR_INTERNAL_MEMORY_MAP:         info->internal_map8 = ADDRESS_MAP_NAME(m4510_mem); break;
504      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(m4510);      break;
504      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(m4510);      break;
505505      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   info->f = (genf *) cpustate->rdmem_id;      break;
506506      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   info->f = (genf *) cpustate->wrmem_id;      break;
507507      case CPUINFO_PTR_M6510_PORTREAD:            info->f = (genf *) cpustate->port_read;      break;
src/emu/cpu/m6502/m6502.c
r3957r3958
130130 *
131131 *****************************************************************************/
132132
133static void m6502_common_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
133static void m6502_common_init(const device_config *device, cpu_irq_callback irqcallback, UINT8 subtype, void (*const *insn)(m6502_Regs *cpustate), const char *type)
134134{
135135   m6502_Regs *cpustate = device->token;
136136
r3957r3958
165165
166166static CPU_INIT( m6502 )
167167{
168   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_6502, insn6502, "m6502");
168   m6502_common_init(device, irqcallback, SUBTYPE_6502, insn6502, "m6502");
169169}
170170
171171static CPU_RESET( m6502 )
r3957r3958
313313
314314static CPU_INIT( n2a03 )
315315{
316   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_2A03, insn2a03, "n2a03");
316   m6502_common_init(device, irqcallback, SUBTYPE_2A03, insn2a03, "n2a03");
317317}
318318
319319/* The N2A03 is integrally tied to its PSG (they're on the same die).
r3957r3958
336336
337337static CPU_INIT( m6510 )
338338{
339   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_6510, insn6510, "m6510");
339   m6502_common_init(device, irqcallback, SUBTYPE_6510, insn6510, "m6510");
340340}
341341
342342static CPU_RESET( m6510 )
r3957r3958
404404
405405static CPU_INIT( m65c02 )
406406{
407   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_65C02, insn65c02, "m65c02");
407   m6502_common_init(device, irqcallback, SUBTYPE_65C02, insn65c02, "m65c02");
408408}
409409
410410static CPU_RESET( m65c02 )
r3957r3958
510510#if (HAS_M65SC02)
511511static CPU_INIT( m65sc02 )
512512{
513   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_65SC02, insn65sc02, "m65sc02");
513   m6502_common_init(device, irqcallback, SUBTYPE_65SC02, insn65sc02, "m65sc02");
514514}
515515#endif
516516
r3957r3958
522522static CPU_INIT( deco16 )
523523{
524524   m6502_Regs *cpustate = device->token;
525   m6502_common_init(device, index, clock, irqcallback, SUBTYPE_DECO16, insndeco16, "deco16");
525   m6502_common_init(device, irqcallback, SUBTYPE_DECO16, insndeco16, "deco16");
526526   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
527527}
528528
r3957r3958
709709      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
710710      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
711711
712      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
713      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
714      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
715      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
716      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
717      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
718      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
719      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
720      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
712      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
713      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
714      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
715      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
716      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
717      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
718      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
719      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
720      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
721721
722722      case CPUINFO_INT_INPUT_STATE + M6502_IRQ_LINE:      info->i = cpustate->irq_state;         break;
723723      case CPUINFO_INT_INPUT_STATE + M6502_SET_OVERFLOW:   info->i = cpustate->so_state;         break;
r3957r3958
738738      case CPUINFO_INT_REGISTER + M6502_SUBTYPE:      info->i = cpustate->subtype;            break;
739739
740740      /* --- the following bits of info are returned as pointers to data or functions --- */
741      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6502);         break;
742      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6502);            break;
743      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6502);            break;
744      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m6502);            break;
745      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6502);         break;
746      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
747      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6502);         break;
741      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6502);         break;
742      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6502);            break;
743      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6502);            break;
744      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m6502);            break;
745      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6502);         break;
746      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
747      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6502);         break;
748748      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
749749      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   info->f = (genf *) cpustate->rdmem_id;      break;
750750      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   info->f = (genf *) cpustate->wrmem_id;      break;
r3957r3958
790790   switch (state)
791791   {
792792      /* --- the following bits of info are returned as pointers to data or functions --- */
793      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(n2a03);            break;
793      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(n2a03);            break;
794794
795795      /* --- the following bits of info are returned as NULL-terminated strings --- */
796796      case CPUINFO_STR_NAME:                     strcpy(info->s, "N2A03");            break;
r3957r3958
827827   switch (state)
828828   {
829829      /* --- the following bits of info are returned as pointers to data or functions --- */
830      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6510);         break;
831      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6510);            break;
832      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6510);            break;
833      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6510);         break;
830      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6510);         break;
831      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6510);            break;
832      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6510);            break;
833      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6510);         break;
834834      case CPUINFO_PTR_INTERNAL_MEMORY_MAP:         info->internal_map8 = ADDRESS_MAP_NAME(m6510_mem); break;
835835      case CPUINFO_PTR_M6510_PORTREAD:            info->f = (genf *) cpustate->port_read;      break;
836836      case CPUINFO_PTR_M6510_PORTWRITE:            info->f = (genf *) cpustate->port_write;   break;
r3957r3958
924924   switch (state)
925925   {
926926      /* --- the following bits of info are returned as pointers to data or functions --- */
927      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m65c02);      break;
928      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m65c02);            break;
929      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m65c02);            break;
930      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m65c02);         break;
931      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65c02);      break;
927      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m65c02);      break;
928      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m65c02);            break;
929      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m65c02);            break;
930      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m65c02);         break;
931      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65c02);      break;
932932
933933      /* --- the following bits of info are returned as NULL-terminated strings --- */
934934      case CPUINFO_STR_NAME:                     strcpy(info->s, "M65C02");            break;
r3957r3958
949949   switch (state)
950950   {
951951      /* --- the following bits of info are returned as pointers to data or functions --- */
952      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m65sc02);            break;
953      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65sc02);      break;
952      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m65sc02);            break;
953      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65sc02);      break;
954954
955955      /* --- the following bits of info are returned as NULL-terminated strings --- */
956956      case CPUINFO_STR_NAME:                     strcpy(info->s, "M65SC02");            break;
r3957r3958
990990   switch (state)
991991   {
992992      /* --- the following bits of info are returned as 64-bit signed integers --- */
993      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
994      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;               break;
993      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
994      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 8;               break;
995995
996996      /* --- the following bits of info are returned as pointers to data or functions --- */
997      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(deco16);      break;
998      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(deco16);            break;
999      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(deco16);            break;
1000      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(deco16);         break;
1001      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(deco16);      break;
997      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(deco16);      break;
998      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(deco16);            break;
999      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(deco16);            break;
1000      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(deco16);         break;
1001      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(deco16);      break;
10021002
10031003      /* --- the following bits of info are returned as NULL-terminated strings --- */
10041004      case CPUINFO_STR_NAME:                     strcpy(info->s, "DECO CPU16");         break;
src/emu/cpu/m6502/m4510.h
r3957r3958
4040#define M4510_IRQ_LINE               M6502_IRQ_LINE
4141
4242CPU_GET_INFO( m4510 );
43#define CPU_M4510 CPU_GET_INFO_NAME( m4510 )
4344
4445
4546extern CPU_DISASSEMBLE( m4510 );
src/emu/cpu/m6502/m6502.h
r3957r3958
7979};
8080
8181extern CPU_GET_INFO( m6502 );
82#define CPU_M6502 CPU_GET_INFO_NAME( m6502 )
8283
8384extern CPU_DISASSEMBLE( m6502 );
8485
r3957r3958
100101#define M6510_IRQ_LINE               M6502_IRQ_LINE
101102
102103extern CPU_GET_INFO( m6510 );
104#define CPU_M6510 CPU_GET_INFO_NAME( m6510 )
103105
104106extern CPU_DISASSEMBLE( m6510 );
105107
r3957r3958
120122#define M6510T_IRQ_LINE               M6502_IRQ_LINE
121123
122124extern CPU_GET_INFO( m6510t );
125#define CPU_M6510T CPU_GET_INFO_NAME( m6510t )
123126
124127#endif
125128
r3957r3958
138141#define M7501_IRQ_LINE               M6502_IRQ_LINE
139142
140143extern CPU_GET_INFO( m7501 );
144#define CPU_M7501 CPU_GET_INFO_NAME( m7501 )
141145#endif
142146
143147#if (HAS_M8502)
r3957r3958
155159#define M8502_IRQ_LINE               M6502_IRQ_LINE
156160
157161extern CPU_GET_INFO( m8502 );
162#define CPU_M8502 CPU_GET_INFO_NAME( m8502 )
158163#endif
159164
160165
r3957r3958
176181#define N2A03_IRQ_LINE               M6502_IRQ_LINE
177182
178183extern CPU_GET_INFO( n2a03 );
184#define CPU_N2A03 CPU_GET_INFO_NAME( n2a03 )
179185
180186#define N2A03_DEFAULTCLOCK (21477272.724 / 12)
181187
r3957r3958
205211#define M65C02_IRQ_LINE               M6502_IRQ_LINE
206212
207213extern CPU_GET_INFO( m65c02 );
214#define CPU_M65C02 CPU_GET_INFO_NAME( m65c02 )
208215
209216extern CPU_DISASSEMBLE( m65c02 );
210217
r3957r3958
228235#define M65SC02_IRQ_LINE            M6502_IRQ_LINE
229236
230237extern CPU_GET_INFO( m65sc02 );
238#define CPU_M65SC02 CPU_GET_INFO_NAME( m65sc02 )
231239
232240extern CPU_DISASSEMBLE( m65sc02 );
233241#endif
r3957r3958
250258#define DECO16_IRQ_LINE               M6502_IRQ_LINE
251259
252260extern CPU_GET_INFO( deco16 );
261#define CPU_DECO16 CPU_GET_INFO_NAME( deco16 )
253262#endif
254263
255264extern CPU_DISASSEMBLE( deco16 );
src/emu/cpu/m6502/m6509.c
r3957r3958
332332      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
333333      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
334334
335      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
336      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
337      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
338      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
339      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
340      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
341      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
342      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
343      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
335      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
336      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
337      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
338      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
339      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
340      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
341      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
342      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
343      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
344344
345345      case CPUINFO_INT_INPUT_STATE + M6509_IRQ_LINE:   info->i = cpustate->irq_state;            break;
346346      case CPUINFO_INT_INPUT_STATE + M6509_SET_OVERFLOW:info->i = cpustate->so_state;            break;
r3957r3958
362362      case CPUINFO_INT_REGISTER + M6509_ZP:         info->i = cpustate->zp.w.l;               break;
363363
364364      /* --- the following bits of info are returned as pointers to data or functions --- */
365      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6509);         break;
366      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6509);            break;
367      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6509);            break;
368      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m6509);            break;
369      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6509);         break;
370      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
371      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6502);         break;
365      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6509);         break;
366      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6509);            break;
367      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6509);            break;
368      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m6509);            break;
369      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6509);         break;
370      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
371      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6502);         break;
372372      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
373373      case CPUINFO_PTR_INTERNAL_MEMORY_MAP:         info->internal_map8 = ADDRESS_MAP_NAME(m6509_mem); break;
374374      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   info->f = (genf *) cpustate->rdmem_id;      break;
src/emu/cpu/m6502/m65ce02.c
r3957r3958
276276      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
277277      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
278278
279      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
280      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
281      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
282      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
283      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 13;               break;
284      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
285      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
286      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;               break;
287      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
288      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
289      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;               break;
279      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
280      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
281      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
282      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 16;               break;
283      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:   info->i = 13;               break;
284      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
285      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;               break;
286      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;               break;
287      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
288      case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 0;               break;
289      case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;               break;
290290
291291      case CPUINFO_INT_INPUT_STATE+M65CE02_NMI_STATE: info->i = cpustate->nmi_state;         break;
292292      case CPUINFO_INT_INPUT_STATE+M65CE02_IRQ_STATE: info->i = cpustate->irq_state;         break;
r3957r3958
307307      case CPUINFO_INT_REGISTER+M65CE02_ZP:         info->i = cpustate->zp.w.l;            break;
308308
309309      /* --- the following bits of info are returned as pointers to data or functions --- */
310      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m65ce02);         break;
311      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m65ce02);            break;
312      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m65ce02);            break;
313      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m65ce02);            break;
314      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m65ce02);         break;
315      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
316      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65ce02);         break;
310      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m65ce02);         break;
311      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m65ce02);            break;
312      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m65ce02);            break;
313      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m65ce02);            break;
314      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m65ce02);         break;
315      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
316      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m65ce02);         break;
317317      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
318318      case CPUINFO_PTR_M6502_READINDEXED_CALLBACK:   info->f = (genf *) cpustate->rdmem_id;      break;
319319      case CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK:   info->f = (genf *) cpustate->wrmem_id;      break;
src/emu/cpu/m6502/m6509.h
r3957r3958
4040#define M6509_SET_OVERFLOW 3
4141
4242CPU_GET_INFO( m6509 );
43#define CPU_M6509 CPU_GET_INFO_NAME( m6509 )
4344
4445#endif /* __M6509_H__ */
src/emu/cpu/m6502/m65ce02.h
r3957r3958
3636#define M65CE02_IRQ_LINE            M6502_IRQ_LINE
3737
3838CPU_GET_INFO( m65ce02 );
39#define CPU_M65CE02 CPU_GET_INFO_NAME( m65ce02 )
3940
4041extern CPU_DISASSEMBLE( m65ce02 );
4142
src/emu/cpu/jaguar/jaguar.h
r3957r3958
101101***************************************************************************/
102102
103103extern CPU_GET_INFO( jaguargpu );
104#define CPU_JAGUARGPU CPU_GET_INFO_NAME( jaguargpu )
104105extern void jaguargpu_ctrl_w(const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask);
105106extern UINT32 jaguargpu_ctrl_r(const device_config *device, offs_t offset);
106107
107108extern CPU_GET_INFO( jaguardsp );
109#define CPU_JAGUARDSP CPU_GET_INFO_NAME( jaguardsp )
108110extern void jaguardsp_ctrl_w(const device_config *device, offs_t offset, UINT32 data, UINT32 mem_mask);
109111extern UINT32 jaguardsp_ctrl_r(const device_config *device, offs_t offset);
110112
src/emu/cpu/jaguar/jaguar.c
r3957r3958
15161516      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                              break;
15171517      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                              break;
15181518
1519      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                        break;
1520      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;                        break;
1521      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                        break;
1519      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;                        break;
1520      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;                        break;
1521      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                        break;
15221522
15231523      case CPUINFO_INT_INPUT_STATE + JAGUAR_IRQ0:      info->i = (jaguar->ctrl[G_CTRL] & 0x40) ? ASSERT_LINE : CLEAR_LINE; break;
15241524      case CPUINFO_INT_INPUT_STATE + JAGUAR_IRQ1:      info->i = (jaguar->ctrl[G_CTRL] & 0x80) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
15671567      case CPUINFO_INT_SP:                     info->i = jaguar->b0[31];                     break;
15681568
15691569      /* --- the following bits of info are returned as pointers to data or functions --- */
1570      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(jaguargpu);      break;
1571      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(jaguargpu);            break;
1572      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(jaguar);            break;
1573      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(jaguar);               break;
1574      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(jaguargpu);      break;
1575      case CPUINFO_PTR_BURN:                     info->burn = NULL;                           break;
1576      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(jaguargpu);break;
1570      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(jaguargpu);      break;
1571      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(jaguargpu);            break;
1572      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(jaguar);            break;
1573      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(jaguar);               break;
1574      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(jaguargpu);      break;
1575      case CPUINFO_FCT_BURN:                     info->burn = NULL;                           break;
1576      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(jaguargpu);break;
15771577      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &jaguar->icount;                  break;
15781578
15791579      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
16621662      case CPUINFO_INT_INPUT_STATE + JAGUAR_IRQ5:      info->i = (jaguar->ctrl[G_CTRL] & 0x10000) ? ASSERT_LINE : CLEAR_LINE; break;
16631663
16641664      /* --- the following bits of info are returned as pointers to data or functions --- */
1665      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(jaguardsp);      break;
1666      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(jaguardsp);            break;
1667      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(jaguardsp);      break;
1668      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(jaguardsp);break;
1665      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(jaguardsp);      break;
1666      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(jaguardsp);            break;
1667      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(jaguardsp);      break;
1668      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(jaguardsp);break;
16691669
16701670      /* --- the following bits of info are returned as NULL-terminated strings --- */
16711671      case CPUINFO_STR_NAME:                     strcpy(info->s, "Jaguar DSP");                  break;
src/emu/cpu/i8085/i8085.h
r3957r3958
1#ifndef I8085_H
2#define I8085_H
1#ifndef __I8085_H__
2#define __I8085_H__
33
44#include "cpuintrf.h"
55
6enum
7{
8   I8085_PC=1, I8085_SP, I8085_AF ,I8085_BC, I8085_DE, I8085_HL,
9   I8085_HALT, I8085_IM, I8085_IREQ, I8085_ISRV, I8085_VECTOR,
10   I8085_TRAP_STATE, I8085_INTR_STATE,
11   I8085_RST55_STATE, I8085_RST65_STATE, I8085_RST75_STATE, I8085_STATUS
12};
136
7/***************************************************************************
8    CONSTANTS
9***************************************************************************/
10
1411enum
1512{
16   CPUINFO_PTR_I8085_SOD_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC,
17   CPUINFO_PTR_I8085_SID_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC + 1,
18   CPUINFO_PTR_I8085_INTE_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC + 2,
19   CPUINFO_PTR_I8085_STATUS_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC + 3,
20   CPUINFO_INT_I8085_SID = CPUINFO_INT_CPU_SPECIFIC
13   I8085_PC, I8085_SP, I8085_AF, I8085_BC, I8085_DE, I8085_HL,
14   I8085_A, I8085_B, I8085_C, I8085_D, I8085_E, I8085_H, I8085_L,
15   I8085_STATUS, I8085_SOD, I8085_SID, I8085_INTE,
16   I8085_HALT, I8085_IM,
17
18   I8085_GENPC = REG_GENPC,
19   I8085_GENSP = REG_GENSP,
20   I8085_GENPCBASE = REG_GENPCBASE
2121};
2222
23typedef void (*i8085_sod_func)(const device_config *device, int state);
24typedef int (*i8085_sid_func)(const device_config *device);
25typedef void (*i8085_inte_func)(const device_config *device, int state);
26typedef void (*i8085_status_func)(const device_config *device, UINT8 status);
2723
28
2924#define I8085_INTR_LINE     0
3025#define I8085_RST55_LINE   1
3126#define I8085_RST65_LINE   2
3227#define I8085_RST75_LINE   3
3328
34CPU_GET_INFO( i8085 );
3529
36/**************************************************************************
37 * I8080 section
38 **************************************************************************/
39#if (HAS_8080)
40#define I8080_PC                I8085_PC
41#define I8080_SP            I8085_SP
42#define I8080_BC            I8085_BC
43#define I8080_DE            I8085_DE
44#define I8080_HL            I8085_HL
45#define I8080_AF            I8085_AF
46#define I8080_HALT            I8085_HALT
47#define I8080_IREQ            I8085_IREQ
48#define I8080_ISRV            I8085_ISRV
49#define I8080_VECTOR         I8085_VECTOR
50#define I8080_TRAP_STATE      I8085_TRAP_STATE
51#define I8080_INTR_STATE      I8085_INTR_STATE
52#define I8080_STATUS         I8085_STATUS
53#define I8080_REG_LAYOUT \
54{   CPU_8080, \
55   I8080_AF,I8080_BC,I8080_DE,I8080_HL,I8080_SP,I8080_PC, DBG_ROW, \
56   I8080_HALT,I8080_IREQ,I8080_ISRV,I8080_VECTOR, I8080_STATUS, \
57    DBG_END }
5830
59#define I8080_INTR_LINE         I8085_INTR_LINE
31/***************************************************************************
32    TYPE DEFINITIONS
33***************************************************************************/
6034
61CPU_GET_INFO( i8080 );
62#endif
35typedef void (*i8085_sod_func)(const device_config *device, int state);
36typedef int (*i8085_sid_func)(const device_config *device);
37typedef void (*i8085_inte_func)(const device_config *device, int state);
38typedef void (*i8085_status_func)(const device_config *device, UINT8 status);
6339
64CPU_DISASSEMBLE( i8085 );
65
66INLINE void i8085_set_sod_callback(const device_config *device, i8085_sod_func callback)
40typedef struct _i8085_config i8085_config;
41struct _i8085_config
6742{
68   cpu_set_info_fct(device, CPUINFO_PTR_I8085_SOD_CALLBACK, (genf *)callback);
69}
43   i8085_inte_func      inte;            /* INTE changed callback */
44   i8085_status_func   status;            /* STATUS changed callback */
45   i8085_sod_func      sod;            /* SOD changed callback (8085A only) */
46   i8085_sid_func      sid;            /* SID changed callback (8085A only) */
47};
7048
71INLINE void i8085_set_sid_callback(const device_config *device, i8085_sid_func callback)
72{
73   cpu_set_info_fct(device, CPUINFO_PTR_I8085_SID_CALLBACK, (genf *)callback);
74}
7549
76INLINE void i8085_set_inte_callback(const device_config *device, i8085_inte_func callback)
77{
78   cpu_set_info_fct(device, CPUINFO_PTR_I8085_INTE_CALLBACK, (genf *)callback);
79}
8050
81INLINE void i8085_set_status_callback(const device_config *device, i8085_status_func callback)
82{
83   cpu_set_info_fct(device, CPUINFO_PTR_I8085_STATUS_CALLBACK, (genf *)callback);
84}
51/***************************************************************************
52    FUNCTION PROTOTYPES
53***************************************************************************/
8554
86INLINE void i8085_set_sid(const device_config *device, int sid)
87{
88   cpu_set_info_int(device, CPUINFO_INT_I8085_SID, sid);
89}
55CPU_GET_INFO( i8080 );
56#define CPU_8080 CPU_GET_INFO_NAME( i8080 )
9057
58CPU_GET_INFO( i8085 );
59#define CPU_8085A CPU_GET_INFO_NAME( i8085 )
60
61CPU_DISASSEMBLE( i8085 );
62
63#define i8085_set_sid(cpu, sid)      cpu_set_reg(cpu, I8085_SID, sid)
64
9165#endif
src/emu/cpu/i8085/i8085cpu.h
r3957r3958
2121#define CF              0x01
2222
2323#define IM_SID          0x80
24#define IM_SOD          0x40
25//#define IM_IEN          0x20
26#define IM_INTR         0x20 //AT: the 8085 ignores bit 0x20. we move IM_INTR here for compatibility.
27#define IM_TRAP         0x10
28//#define IM_INTR         0x08
29#define IM_IEN          0x08 //AT: RIM returns IEN status on this bit. SIM checks this bit to allow masking RST55-75
30#define IM_RST75        0x04
31#define IM_RST65        0x02
32#define IM_RST55        0x01
24#define IM_I75          0x40
25#define IM_I65          0x20
26#define IM_I55          0x10
27#define IM_IE           0x08
28#define IM_M75          0x04
29#define IM_M65          0x02
30#define IM_M55          0x01
3331
3432#define ADDR_TRAP       0x0024
3533#define ADDR_RST55      0x002c
src/emu/cpu/i8085/i8085.c
r3957r3958
122122 *
123123 *****************************************************************************/
124124
125/*int survival_prot = 0; */
126
127125#include "debugger.h"
128126#include "i8085.h"
129127#include "i8085cpu.h"
r3957r3958
133131
134132#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
135133
136#define I8085_INTR      0xff
134#define CPUTYPE_8080   0
135#define CPUTYPE_8085   1
137136
137
138
139/***************************************************************************
140    TYPE DEFINITIONS
141***************************************************************************/
142
138143typedef struct _i8085_state i8085_state;
139144struct _i8085_state
140145{
141   int    cputype;   /* 0 8080, 1 8085A */
142   PAIR   PC,SP,AF,BC,DE,HL,XX;
143   UINT8   HALT;
144   UINT8   IM;       /* interrupt mask */
145   UINT8   IREQ;      /* requested interrupts */
146   UINT8   ISRV;      /* serviced interrupt */
147   UINT32   INTR;      /* vector for INTR */
148   UINT32   IRQ2;      /* scheduled interrupt address */
149   UINT32   IRQ1;      /* executed interrupt address */
150   UINT8   STATUS;      /* status word */
151   UINT8   after_ei;   /* are we in the EI shadow? */
152   INT8   irq_state[4];
153   cpu_irq_callback irq_callback;
146   i8085_config       config;
147   int             cputype;      /* 0 8080, 1 8085A */
148   PAIR            PC,SP,AF,BC,DE,HL,XX;
149   UINT8            HALT;
150   UINT8            IM;          /* interrupt mask (8085A only) */
151   UINT8            STATUS;         /* status word */
152
153   UINT8            after_ei;      /* post-EI processing; starts at 2, check for ints at 0 */
154   UINT8            nmi_state;      /* raw NMI line state */
155   UINT8            irq_state[4];   /* raw IRQ line states */
156   UINT8            trap_pending;   /* TRAP interrupt latched? */
157   UINT8            trap_im_copy;   /* copy of IM register when TRAP was taken */
158   UINT8            sod_state;      /* state of the SOD line */
159
160   UINT8            ietemp;         /* import/export temp space */
161
162   cpu_irq_callback    irq_callback;
154163   const device_config *device;
155164   const address_space *program;
156165   const address_space *io;
157   i8085_sod_func sod_callback;
158   i8085_sid_func sid_callback;
159   i8085_inte_func inte_callback;
160   i8085_status_func status_callback;
161   int      icount;
162   UINT8    rim_ien;
166   cpu_state_table    state;
167   int               icount;
163168};
164169
170
171
172/***************************************************************************
173    CPU STATE DESCRIPTION
174***************************************************************************/
175
176#define I8085_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
177   CPU_STATE_ENTRY(I8085_##_name, #_name, _format, i8085_state, _member, _datamask, ~0, _flags)
178
179static const cpu_state_entry state_array[] =
180{
181   I8085_STATE_ENTRY(PC,  "%04X", PC.w.l, 0xffff, 0)
182   I8085_STATE_ENTRY(GENPC, "%04X", PC.w.l, 0xffff, CPUSTATE_NOSHOW)
183//  I8085_STATE_ENTRY(GENPCBASE, "%04X", prvpc.w.l, 0xffff, CPUSTATE_NOSHOW)
184
185   I8085_STATE_ENTRY(SP,  "%04X", PC.w.l, 0xffff, 0)
186   I8085_STATE_ENTRY(GENSP, "%04X", PC.w.l, 0xffff, CPUSTATE_NOSHOW)
187
188   I8085_STATE_ENTRY(A, "%02X", AF.b.l, 0xff, CPUSTATE_NOSHOW)
189   I8085_STATE_ENTRY(B, "%02X", BC.b.h, 0xff, CPUSTATE_NOSHOW)
190   I8085_STATE_ENTRY(C, "%02X", BC.b.l, 0xff, CPUSTATE_NOSHOW)
191   I8085_STATE_ENTRY(D, "%02X", DE.b.h, 0xff, CPUSTATE_NOSHOW)
192   I8085_STATE_ENTRY(E, "%02X", DE.b.l, 0xff, CPUSTATE_NOSHOW)
193   I8085_STATE_ENTRY(H, "%02X", HL.b.h, 0xff, CPUSTATE_NOSHOW)
194   I8085_STATE_ENTRY(L, "%02X", HL.b.l, 0xff, CPUSTATE_NOSHOW)
195
196   I8085_STATE_ENTRY(AF, "%04X", AF.w.l, 0xffff, 0)
197   I8085_STATE_ENTRY(BC, "%04X", BC.w.l, 0xffff, 0)
198   I8085_STATE_ENTRY(DE, "%04X", DE.w.l, 0xffff, 0)
199   I8085_STATE_ENTRY(HL, "%04X", HL.w.l, 0xffff, 0)
200
201   I8085_STATE_ENTRY(STATUS, "%02X", STATUS, 0xff, 0)
202   I8085_STATE_ENTRY(SOD, "%1u", sod_state, 0x1, 0)
203   I8085_STATE_ENTRY(SID, "%1u", ietemp, 0x1, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
204   I8085_STATE_ENTRY(INTE, "%1u", ietemp, 0x1, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
205};
206
207static const cpu_state_table state_table_template =
208{
209   NULL,                  /* pointer to the base of state (offsets are relative to this) */
210   0,                     /* subtype this table refers to */
211   ARRAY_LENGTH(state_array),   /* number of entries */
212   state_array               /* array of entries */
213};
214
215
216
217/***************************************************************************
218    MACROS
219***************************************************************************/
220
221#define IS_8080(c)         ((c)->cputype == CPUTYPE_8080)
222#define IS_8085(c)         ((c)->cputype == CPUTYPE_8085)
223
224
225
226/***************************************************************************
227    STATIC TABLES
228***************************************************************************/
229
165230static UINT8 ZS[256];
166231static UINT8 ZSP[256];
167232
168static UINT8 ROP(i8085_state *cpustate)
233
234
235/***************************************************************************
236    FUNCTION PROTOTYPES
237***************************************************************************/
238
239static void execute_one(i8085_state *cpustate, int opcode);
240
241
242
243/***************************************************************************
244    INLINE FUNCTIONS
245***************************************************************************/
246
247INLINE void set_sod(i8085_state *cpustate, int state)
169248{
170   cpustate->STATUS = 0xa2; // instruction fetch
249   if (state != 0 && cpustate->sod_state == 0)
250   {
251      cpustate->sod_state = 1;
252      if (cpustate->config.sod != NULL)
253         (*cpustate->config.sod)(cpustate->device, 1);
254   }
255   else if (state == 0 && cpustate->sod_state != 0)
256   {
257      cpustate->sod_state = 0;
258      if (cpustate->config.sod != NULL)
259         (*cpustate->config.sod)(cpustate->device, 0);
260   }
261}
262
263
264INLINE void set_inte(i8085_state *cpustate, int state)
265{
266   if (state != 0 && (cpustate->IM & IM_IE) == 0)
267   {
268      cpustate->IM |= IM_IE;
269      if (cpustate->config.inte != NULL)
270         (*cpustate->config.inte)(cpustate->device, 1);
271   }
272   else if (state == 0 && (cpustate->IM & IM_IE) != 0)
273   {
274      cpustate->IM &= ~IM_IE;
275      if (cpustate->config.inte != NULL)
276         (*cpustate->config.inte)(cpustate->device, 0);
277   }
278}
279
280
281INLINE void set_status(i8085_state *cpustate, UINT8 status)
282{
283   if (status != cpustate->STATUS && cpustate->config.status != NULL)
284      (*cpustate->config.status)(cpustate->device, status);
285   cpustate->STATUS = status;
286}
287
288
289INLINE UINT8 get_rim_value(i8085_state *cpustate)
290{
291   UINT8 result = cpustate->IM;
292
293   /* copy live RST5.5 and RST6.5 states */
294   result &= ~(IM_I65 | IM_I55);
295   if (cpustate->irq_state[I8085_RST65_LINE] && !(cpustate->IM & IM_M65))
296      result |= IM_I65;
297   if (cpustate->irq_state[I8085_RST55_LINE] && !(cpustate->IM & IM_M55))
298      result |= IM_I55;
299
300   /* fetch the SID bit if we have a callback */
301   if (cpustate->config.sid != NULL)
302      result = (result & 0x7f) | ((*cpustate->config.sid)(cpustate->device) ? 0x80 : 0);
303   return result;
304}
305
306
307INLINE void break_halt_for_interrupt(i8085_state *cpustate)
308{
309   /* de-halt if necessary */
310   if (cpustate->HALT)
311   {
312      cpustate->PC.w.l++;
313      cpustate->HALT = 0;
314      set_status(cpustate, 0x26);   /* int ack while halt */
315   }
316   else
317      set_status(cpustate, 0x23);   /* int ack */
318}
319
320
321INLINE UINT8 ROP(i8085_state *cpustate)
322{
323   set_status(cpustate, 0xa2); // instruction fetch
171324   return memory_decrypted_read_byte(cpustate->program, cpustate->PC.w.l++);
172325}
173326
174static UINT8 ARG(i8085_state *cpustate)
327INLINE UINT8 ARG(i8085_state *cpustate)
175328{
176329   return memory_raw_read_byte(cpustate->program, cpustate->PC.w.l++);
177330}
178331
179static UINT16 ARG16(i8085_state *cpustate)
332INLINE UINT16 ARG16(i8085_state *cpustate)
180333{
181334   UINT16 w;
182335   w  = memory_raw_read_byte(cpustate->program, cpustate->PC.d);
r3957r3958
186339   return w;
187340}
188341
189static UINT8 RM(i8085_state *cpustate, UINT32 a)
342INLINE UINT8 RM(i8085_state *cpustate, UINT32 a)
190343{
191   cpustate->STATUS = 0x82; // memory read
344   set_status(cpustate, 0x82); // memory read
192345   return memory_read_byte_8le(cpustate->program, a);
193346}
194347
195static void WM(i8085_state *cpustate, UINT32 a, UINT8 v)
348INLINE void WM(i8085_state *cpustate, UINT32 a, UINT8 v)
196349{
197   cpustate->STATUS = 0x00; // memory write
350   set_status(cpustate, 0x00); // memory write
198351   memory_write_byte_8le(cpustate->program, a, v);
199352}
200353
201INLINE void execute_one(i8085_state *cpustate, int opcode)
354
355static void check_for_interrupts(i8085_state *cpustate)
202356{
203   /* output state word */
204   if (cpustate->status_callback) (*cpustate->status_callback)(cpustate->device, cpustate->STATUS);
357   /* TRAP is the highest priority */
358   if (cpustate->trap_pending)
359   {
360      /* the first RIM after a TRAP reflects the original IE state; remember it here,
361           setting the high bit to indicate it is valid */
362      cpustate->trap_im_copy = cpustate->IM | 0x80;
205363
364      /* reset the pending state */
365      cpustate->trap_pending = FALSE;
366
367      /* break out of HALT state and call the IRQ ack callback */
368      break_halt_for_interrupt(cpustate);
369      if (cpustate->irq_callback != NULL)
370         (*cpustate->irq_callback)(cpustate->device, INPUT_LINE_NMI);
371
372      /* push the PC and jump to $0024 */
373      M_PUSH(PC);
374      cpustate->IM &= ~IM_IE;
375      cpustate->PC.w.l = ADDR_TRAP;
376      cpustate->icount -= 11;
377   }
378
379   /* followed by RST7.5 */
380   else if ((cpustate->IM & IM_I75) && !(cpustate->IM & IM_M75) && (cpustate->IM & IM_IE))
381   {
382      /* reset the pending state (which is CPU-visible via the RIM instruction) */
383      cpustate->IM &= ~IM_I75;
384
385      /* break out of HALT state and call the IRQ ack callback */
386      break_halt_for_interrupt(cpustate);
387      if (cpustate->irq_callback != NULL)
388         (*cpustate->irq_callback)(cpustate->device, I8085_RST75_LINE);
389
390      /* push the PC and jump to $003C */
391      M_PUSH(PC);
392      cpustate->IM &= ~IM_IE;
393      cpustate->PC.w.l = ADDR_RST75;
394      cpustate->icount -= 11;
395   }
396
397   /* followed by RST6.5 */
398   else if (cpustate->irq_state[I8085_RST65_LINE] && !(cpustate->IM & IM_M65) && (cpustate->IM & IM_IE))
399   {
400      /* break out of HALT state and call the IRQ ack callback */
401      break_halt_for_interrupt(cpustate);
402      if (cpustate->irq_callback != NULL)
403         (*cpustate->irq_callback)(cpustate->device, I8085_RST65_LINE);
404
405      /* push the PC and jump to $0034 */
406      M_PUSH(PC);
407      cpustate->IM &= ~IM_IE;
408      cpustate->PC.w.l = ADDR_RST65;
409      cpustate->icount -= 11;
410   }
411
412   /* followed by RST5.5 */
413   else if (cpustate->irq_state[I8085_RST55_LINE] && !(cpustate->IM & IM_M55) && (cpustate->IM & IM_IE))
414   {
415      /* break out of HALT state and call the IRQ ack callback */
416      break_halt_for_interrupt(cpustate);
417      if (cpustate->irq_callback != NULL)
418         (*cpustate->irq_callback)(cpustate->device, I8085_RST55_LINE);
419
420      /* push the PC and jump to $002C */
421      M_PUSH(PC);
422      cpustate->IM &= ~IM_IE;
423      cpustate->PC.w.l = ADDR_RST55;
424      cpustate->icount -= 11;
425   }
426
427   /* followed by classic INTR */
428   else if (cpustate->irq_state[I8085_INTR_LINE] && (cpustate->IM & IM_IE))
429   {
430      UINT32 vector = 0;
431
432      /* break out of HALT state and call the IRQ ack callback */
433      break_halt_for_interrupt(cpustate);
434      if (cpustate->irq_callback != NULL)
435         vector = (*cpustate->irq_callback)(cpustate->device, I8085_INTR_LINE);
436
437      /* use the resulting vector as an opcode to execute */
438      cpustate->IM &= ~IM_IE;
439      switch (vector & 0xff0000)
440      {
441         case 0xcd0000:   /* CALL nnnn */
442            cpustate->icount -= 7;
443            M_PUSH(PC);
444
445         case 0xc30000:   /* JMP  nnnn */
446            cpustate->icount -= 10;
447            cpustate->PC.d = vector & 0xffff;
448            break;
449
450         default:
451            LOG(("i8085 take int $%02x\n", vector));
452            execute_one(cpustate, vector & 0xff);
453            break;
454      }
455   }
456}
457
458
459static void execute_one(i8085_state *cpustate, int opcode)
460{
206461   switch (opcode)
207462   {
208463      case 0x00: cpustate->icount -= 4;   /* NOP  */
r3957r3958
214469      case 0x02: cpustate->icount -= 7;   /* STAX B */
215470         WM(cpustate, cpustate->BC.d, cpustate->AF.b.h);
216471         break;
217      case 0x03: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* INX  B */
472      case 0x03: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* INX  B */
218473         cpustate->BC.w.l++;
219         if( cpustate->cputype )
474         if (IS_8085(cpustate))
220475         {
221476            if (cpustate->BC.b.l == 0x00) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
222477         }
223478         break;
224      case 0x04: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  B */
479      case 0x04: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  B */
225480         M_INR(cpustate->BC.b.h);
226481         break;
227      case 0x05: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  B */
482      case 0x05: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  B */
228483         M_DCR(cpustate->BC.b.h);
229484         break;
230485      case 0x06: cpustate->icount -= 7;   /* MVI  B,nn */
r3957r3958
235490         break;
236491
237492      case 0x08:
238         if( cpustate->cputype ) {
493         if (IS_8085(cpustate)) {
239494            cpustate->icount -= 10;      /* DSUB */
240495            M_DSUB(cpustate);
241496         } else {
r3957r3958
248503      case 0x0a: cpustate->icount -= 7;   /* LDAX B */
249504         cpustate->AF.b.h = RM(cpustate, cpustate->BC.d);
250505         break;
251      case 0x0b: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* DCX  B */
506      case 0x0b: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* DCX  B */
252507         cpustate->BC.w.l--;
253         if( cpustate->cputype )
508         if (IS_8085(cpustate))
254509         {
255510            if (cpustate->BC.b.l == 0xff) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
256511         }
257512         break;
258      case 0x0c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  C */
513      case 0x0c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  C */
259514         M_INR(cpustate->BC.b.l);
260515         break;
261      case 0x0d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  C */
516      case 0x0d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  C */
262517         M_DCR(cpustate->BC.b.l);
263518         break;
264519      case 0x0e: cpustate->icount -= 7;   /* MVI  C,nn */
r3957r3958
269524         break;
270525
271526      case 0x10:
272         if( cpustate->cputype ) {
527         if (IS_8085(cpustate)) {
273528            cpustate->icount -= 7;      /* ASRH */
274529            cpustate->AF.b.l = (cpustate->AF.b.l & ~CF) | (cpustate->HL.b.l & CF);
275530            cpustate->HL.w.l = (cpustate->HL.w.l >> 1);
r3957r3958
283538      case 0x12: cpustate->icount -= 7;   /* STAX D */
284539         WM(cpustate, cpustate->DE.d, cpustate->AF.b.h);
285540         break;
286      case 0x13: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* INX  D */
541      case 0x13: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* INX  D */
287542         cpustate->DE.w.l++;
288         if( cpustate->cputype )
543         if (IS_8085(cpustate))
289544         {
290545            if (cpustate->DE.b.l == 0x00) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
291546         }
292547         break;
293      case 0x14: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  D */
548      case 0x14: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  D */
294549         M_INR(cpustate->DE.b.h);
295550         break;
296      case 0x15: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  D */
551      case 0x15: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  D */
297552         M_DCR(cpustate->DE.b.h);
298553         break;
299554      case 0x16: cpustate->icount -= 7;   /* MVI  D,nn */
r3957r3958
304559         break;
305560
306561      case 0x18:
307         if( cpustate->cputype ) {
562         if (IS_8085(cpustate)) {
308563            cpustate->icount -= 10;      /* RLDE */
309564            cpustate->AF.b.l = (cpustate->AF.b.l & ~(CF | VF)) | (cpustate->DE.b.h >> 7);
310565            cpustate->DE.w.l = (cpustate->DE.w.l << 1) | (cpustate->DE.w.l >> 15);
r3957r3958
320575      case 0x1a: cpustate->icount -= 7;   /* LDAX D */
321576         cpustate->AF.b.h = RM(cpustate, cpustate->DE.d);
322577         break;
323      case 0x1b: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* DCX  D */
578      case 0x1b: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* DCX  D */
324579         cpustate->DE.w.l--;
325         if( cpustate->cputype )
580         if (IS_8085(cpustate))
326581         {
327582            if (cpustate->DE.b.l == 0xff) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
328583         }
329584         break;
330      case 0x1c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  E */
585      case 0x1c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  E */
331586         M_INR(cpustate->DE.b.l);
332587         break;
333      case 0x1d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  E */
588      case 0x1d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  E */
334589         M_DCR(cpustate->DE.b.l);
335590         break;
336591      case 0x1e: cpustate->icount -= 7;   /* MVI  E,nn */
r3957r3958
341596         break;
342597
343598      case 0x20:
344         if( cpustate->cputype ) {
599         if (IS_8085(cpustate)) {
345600            cpustate->icount -= 7;      /* RIM  */
346            cpustate->AF.b.h = cpustate->IM;
347            if (cpustate->sid_callback)
348               cpustate->AF.b.h = (cpustate->AF.b.h & 0x7f) | ((*cpustate->sid_callback)(cpustate->device) ? 0x80 : 0);
349            cpustate->AF.b.h |= cpustate->rim_ien; cpustate->rim_ien = 0; //AT: read and clear IEN status latch
601            cpustate->AF.b.h = get_rim_value(cpustate);
602
603            /* if we have remembered state from taking a TRAP, fix up the IE flag here */
604            if (cpustate->trap_im_copy & 0x80)
605               cpustate->AF.b.h = (cpustate->AF.b.h & ~IM_IE) | (cpustate->trap_im_copy & IM_IE);
606            cpustate->trap_im_copy = 0;
350607         } else {
351608            cpustate->icount -= 4;      /* NOP undocumented */
352609         }
r3957r3958
360617         cpustate->XX.w.l++;
361618         WM(cpustate, cpustate->XX.d, cpustate->HL.b.h);
362619         break;
363      case 0x23: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* INX  H */
620      case 0x23: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* INX  H */
364621         cpustate->HL.w.l++;
365         if( cpustate->cputype )
622         if (IS_8085(cpustate))
366623         {
367624            if (cpustate->HL.b.l == 0x00) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
368625         }
369626         break;
370      case 0x24: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  H */
627      case 0x24: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  H */
371628         M_INR(cpustate->HL.b.h);
372629         break;
373      case 0x25: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  H */
630      case 0x25: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  H */
374631         M_DCR(cpustate->HL.b.h);
375632         break;
376633      case 0x26: cpustate->icount -= 7;   /* MVI  H,nn */
r3957r3958
382639         if (cpustate->AF.b.l & HF) cpustate->XX.d |= 0x200;
383640         if (cpustate->AF.b.l & NF) cpustate->XX.d |= 0x400;
384641         cpustate->AF.w.l = DAA[cpustate->XX.d];
385         if( cpustate->cputype==0 )
642         if (IS_8080(cpustate))
386643         {
387644            cpustate->AF.b.l &= 0xd5; // Ignore not used flags
388645         }
389646         break;
390647
391648      case 0x28:
392         if( cpustate->cputype ) {
649         if (IS_8085(cpustate)) {
393650            cpustate->icount -= 10;      /* LDEH nn */
394651            cpustate->XX.d = ARG(cpustate);
395652            cpustate->DE.d = (cpustate->HL.d + cpustate->XX.d) & 0xffff;
r3957r3958
406663         cpustate->XX.w.l++;
407664         cpustate->HL.b.h = RM(cpustate, cpustate->XX.d);
408665         break;
409      case 0x2b: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* DCX  H */
666      case 0x2b: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* DCX  H */
410667         cpustate->HL.w.l--;
411         if( cpustate->cputype )
668         if (IS_8085(cpustate))
412669         {
413670            if (cpustate->HL.b.l == 0xff) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
414671         }
415672         break;
416      case 0x2c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  L */
673      case 0x2c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  L */
417674         M_INR(cpustate->HL.b.l);
418675         break;
419      case 0x2d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  L */
676      case 0x2d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  L */
420677         M_DCR(cpustate->HL.b.l);
421678         break;
422679      case 0x2e: cpustate->icount -= 7;   /* MVI  L,nn */
423680         M_MVI(cpustate->HL.b.l);
424681         break;
425682      case 0x2f: cpustate->icount -= 4;   /* CMA  */
426         if( cpustate->cputype )
683         if (IS_8085(cpustate))
427684         {
428685            cpustate->AF.b.h ^= 0xff;
429686            cpustate->AF.b.l |= HF + NF;
r3957r3958
435692         break;
436693
437694      case 0x30:
438         if( cpustate->cputype )
695         if (IS_8085(cpustate))
439696         {
440697            cpustate->icount -= 7;      /* SIM  */
441698
442            if (cpustate->AF.b.h & 0x40) //SOE - only when bit 0x40 is set!
699            /* if bit 3 is set, bits 0-2 become the new masks */
700            if (cpustate->AF.b.h & 0x08)
443701            {
444               cpustate->IM &=~IM_SOD;
445               if (cpustate->AF.b.h & 0x80) cpustate->IM |= IM_SOD; //is it needed ?
446               if (cpustate->sod_callback) (*cpustate->sod_callback)(cpustate->device, cpustate->AF.b.h >> 7); //SOD - data = bit 0x80
702               cpustate->IM &= ~(IM_M55 | IM_M65 | IM_M75 | IM_I55 | IM_I65);
703               cpustate->IM |= cpustate->AF.b.h & (IM_M55 | IM_M65 | IM_M75);
704
705               /* update live state based on the new masks */
706               if ((cpustate->IM & IM_M55) == 0 && cpustate->irq_state[I8085_RST55_LINE])
707                  cpustate->IM |= IM_I55;
708               if ((cpustate->IM & IM_M65) == 0 && cpustate->irq_state[I8085_RST65_LINE])
709                  cpustate->IM |= IM_I65;
447710            }
448//AT
449            //cpustate->IM &= (IM_SID + IM_IEN + IM_TRAP);
450            //cpustate->IM |= (cpustate->AF.b.h & ~(IM_SID + IM_SOD + IM_IEN + IM_TRAP));
451711
452            // overwrite RST5.5-7.5 interrupt masks only when bit 0x08 of the accumulator is set
453            if (cpustate->AF.b.h & 0x08)
454               cpustate->IM = (cpustate->IM & ~(IM_RST55+IM_RST65+IM_RST75)) | (cpustate->AF.b.h & (IM_RST55+IM_RST65+IM_RST75));
712            /* bit if 4 is set, the 7.5 flip-flop is cleared */
713            if (cpustate->AF.b.h & 0x10)
714               cpustate->IM &= ~IM_I75;
455715
716            /* if bit 6 is set, then bit 7 is the new SOD state */
717            if (cpustate->AF.b.h & 0x40)
718               set_sod(cpustate, cpustate->AF.b.h >> 7);
719
720            /* check for revealed interrupts */
721            check_for_interrupts(cpustate);
456722         } else {
457723            cpustate->icount -= 4;      /* NOP undocumented */
458724         }
r3957r3958
465731         cpustate->XX.d = ARG16(cpustate);
466732         WM(cpustate, cpustate->XX.d, cpustate->AF.b.h);
467733         break;
468      case 0x33: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* INX  SP */
734      case 0x33: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* INX  SP */
469735         cpustate->SP.w.l++;
470         if( cpustate->cputype )
736         if (IS_8085(cpustate))
471737         {
472738            if (cpustate->SP.b.l == 0x00) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
473739         }
r3957r3958
491757         break;
492758
493759      case 0x38:
494         if( cpustate->cputype ) {
760         if (IS_8085(cpustate)) {
495761            cpustate->icount -= 10;      /* LDES nn */
496762            cpustate->XX.d = ARG(cpustate);
497763            cpustate->DE.d = (cpustate->SP.d + cpustate->XX.d) & 0xffff;
r3957r3958
506772         cpustate->XX.d = ARG16(cpustate);
507773         cpustate->AF.b.h = RM(cpustate, cpustate->XX.d);
508774         break;
509      case 0x3b: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* DCX  SP */
775      case 0x3b: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* DCX  SP */
510776         cpustate->SP.w.l--;
511         if( cpustate->cputype )
777         if (IS_8085(cpustate))
512778         {
513779            if (cpustate->SP.b.l == 0xff) cpustate->AF.b.l |= XF; else cpustate->AF.b.l &= ~XF;
514780         }
515781         break;
516      case 0x3c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* INR  A */
782      case 0x3c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* INR  A */
517783         M_INR(cpustate->AF.b.h);
518784         break;
519      case 0x3d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* DCR  A */
785      case 0x3d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* DCR  A */
520786         M_DCR(cpustate->AF.b.h);
521787         break;
522788      case 0x3e: cpustate->icount -= 7;   /* MVI  A,nn */
r3957r3958
526792         cpustate->AF.b.l = (cpustate->AF.b.l & 0xfe) | ((cpustate->AF.b.l & CF)==1 ? 0 : 1);
527793         break;
528794
529      case 0x40: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,B */
795      case 0x40: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,B */
530796         /* no op */
531797         break;
532      case 0x41: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,C */
798      case 0x41: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,C */
533799         cpustate->BC.b.h = cpustate->BC.b.l;
534800         break;
535      case 0x42: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,D */
801      case 0x42: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,D */
536802         cpustate->BC.b.h = cpustate->DE.b.h;
537803         break;
538      case 0x43: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,E */
804      case 0x43: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,E */
539805         cpustate->BC.b.h = cpustate->DE.b.l;
540806         break;
541      case 0x44: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,H */
807      case 0x44: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,H */
542808         cpustate->BC.b.h = cpustate->HL.b.h;
543809         break;
544      case 0x45: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,L */
810      case 0x45: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,L */
545811         cpustate->BC.b.h = cpustate->HL.b.l;
546812         break;
547813      case 0x46: cpustate->icount -= 7;   /* MOV  B,M */
548814         cpustate->BC.b.h = RM(cpustate, cpustate->HL.d);
549815         break;
550      case 0x47: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  B,A */
816      case 0x47: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  B,A */
551817         cpustate->BC.b.h = cpustate->AF.b.h;
552818         break;
553819
554      case 0x48: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,B */
820      case 0x48: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,B */
555821         cpustate->BC.b.l = cpustate->BC.b.h;
556822         break;
557      case 0x49: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,C */
823      case 0x49: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,C */
558824         /* no op */
559825         break;
560      case 0x4a: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,D */
826      case 0x4a: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,D */
561827         cpustate->BC.b.l = cpustate->DE.b.h;
562828         break;
563      case 0x4b: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,E */
829      case 0x4b: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,E */
564830         cpustate->BC.b.l = cpustate->DE.b.l;
565831         break;
566      case 0x4c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,H */
832      case 0x4c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,H */
567833         cpustate->BC.b.l = cpustate->HL.b.h;
568834         break;
569      case 0x4d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,L */
835      case 0x4d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,L */
570836         cpustate->BC.b.l = cpustate->HL.b.l;
571837         break;
572838      case 0x4e: cpustate->icount -= 7;   /* MOV  C,M */
573839         cpustate->BC.b.l = RM(cpustate, cpustate->HL.d);
574840         break;
575      case 0x4f: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  C,A */
841      case 0x4f: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  C,A */
576842         cpustate->BC.b.l = cpustate->AF.b.h;
577843         break;
578844
579      case 0x50: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,B */
845      case 0x50: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,B */
580846         cpustate->DE.b.h = cpustate->BC.b.h;
581847         break;
582      case 0x51: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,C */
848      case 0x51: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,C */
583849         cpustate->DE.b.h = cpustate->BC.b.l;
584850         break;
585      case 0x52: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,D */
851      case 0x52: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,D */
586852         /* no op */
587853         break;
588      case 0x53: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,E */
854      case 0x53: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,E */
589855         cpustate->DE.b.h = cpustate->DE.b.l;
590856         break;
591      case 0x54: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,H */
857      case 0x54: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,H */
592858         cpustate->DE.b.h = cpustate->HL.b.h;
593859         break;
594      case 0x55: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,L */
860      case 0x55: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,L */
595861         cpustate->DE.b.h = cpustate->HL.b.l;
596862         break;
597863      case 0x56: cpustate->icount -= 7;   /* MOV  D,M */
598864         cpustate->DE.b.h = RM(cpustate, cpustate->HL.d);
599865         break;
600      case 0x57: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  D,A */
866      case 0x57: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  D,A */
601867         cpustate->DE.b.h = cpustate->AF.b.h;
602868         break;
603869
604      case 0x58: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,B */
870      case 0x58: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,B */
605871         cpustate->DE.b.l = cpustate->BC.b.h;
606872         break;
607      case 0x59: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,C */
873      case 0x59: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,C */
608874         cpustate->DE.b.l = cpustate->BC.b.l;
609875         break;
610      case 0x5a: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,D */
876      case 0x5a: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,D */
611877         cpustate->DE.b.l = cpustate->DE.b.h;
612878         break;
613      case 0x5b: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,E */
879      case 0x5b: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,E */
614880         /* no op */
615881         break;
616      case 0x5c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,H */
882      case 0x5c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,H */
617883         cpustate->DE.b.l = cpustate->HL.b.h;
618884         break;
619      case 0x5d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,L */
885      case 0x5d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,L */
620886         cpustate->DE.b.l = cpustate->HL.b.l;
621887         break;
622888      case 0x5e: cpustate->icount -= 7;   /* MOV  E,M */
623889         cpustate->DE.b.l = RM(cpustate, cpustate->HL.d);
624890         break;
625      case 0x5f: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  E,A */
891      case 0x5f: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  E,A */
626892         cpustate->DE.b.l = cpustate->AF.b.h;
627893         break;
628894
629      case 0x60: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,B */
895      case 0x60: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,B */
630896         cpustate->HL.b.h = cpustate->BC.b.h;
631897         break;
632      case 0x61: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,C */
898      case 0x61: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,C */
633899         cpustate->HL.b.h = cpustate->BC.b.l;
634900         break;
635      case 0x62: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,D */
901      case 0x62: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,D */
636902         cpustate->HL.b.h = cpustate->DE.b.h;
637903         break;
638      case 0x63: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,E */
904      case 0x63: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,E */
639905         cpustate->HL.b.h = cpustate->DE.b.l;
640906         break;
641      case 0x64: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,H */
907      case 0x64: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,H */
642908         /* no op */
643909         break;
644      case 0x65: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,L */
910      case 0x65: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,L */
645911         cpustate->HL.b.h = cpustate->HL.b.l;
646912         break;
647913      case 0x66: cpustate->icount -= 7;   /* MOV  H,M */
648914         cpustate->HL.b.h = RM(cpustate, cpustate->HL.d);
649915         break;
650      case 0x67: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  H,A */
916      case 0x67: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  H,A */
651917         cpustate->HL.b.h = cpustate->AF.b.h;
652918         break;
653919
654      case 0x68: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,B */
920      case 0x68: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,B */
655921         cpustate->HL.b.l = cpustate->BC.b.h;
656922         break;
657      case 0x69: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,C */
923      case 0x69: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,C */
658924         cpustate->HL.b.l = cpustate->BC.b.l;
659925         break;
660      case 0x6a: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,D */
926      case 0x6a: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,D */
661927         cpustate->HL.b.l = cpustate->DE.b.h;
662928         break;
663      case 0x6b: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,E */
929      case 0x6b: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,E */
664930         cpustate->HL.b.l = cpustate->DE.b.l;
665931         break;
666      case 0x6c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,H */
932      case 0x6c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,H */
667933         cpustate->HL.b.l = cpustate->HL.b.h;
668934         break;
669      case 0x6d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,L */
935      case 0x6d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,L */
670936         /* no op */
671937         break;
672938      case 0x6e: cpustate->icount -= 7;   /* MOV  L,M */
673939         cpustate->HL.b.l = RM(cpustate, cpustate->HL.d);
674940         break;
675      case 0x6f: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  L,A */
941      case 0x6f: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  L,A */
676942         cpustate->HL.b.l = cpustate->AF.b.h;
677943         break;
678944
r3957r3958
694960      case 0x75: cpustate->icount -= 7;   /* MOV  M,L */
695961         WM(cpustate, cpustate->HL.d, cpustate->HL.b.l);
696962         break;
697      case 0x76: cpustate->icount -= (cpustate->cputype) ? 5 : 7;   /* HLT */
963      case 0x76: cpustate->icount -= IS_8085(cpustate) ? 5 : 7;   /* HLT */
698964         cpustate->PC.w.l--;
699965         cpustate->HALT = 1;
700         cpustate->STATUS = 0x8a; // halt acknowledge
966         set_status(cpustate, 0x8a); // halt acknowledge
701967         if (cpustate->icount > 0) cpustate->icount = 0;
702968         break;
703969      case 0x77: cpustate->icount -= 7;   /* MOV  M,A */
704970         WM(cpustate, cpustate->HL.d, cpustate->AF.b.h);
705971         break;
706972
707      case 0x78: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,B */
973      case 0x78: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,B */
708974         cpustate->AF.b.h = cpustate->BC.b.h;
709975         break;
710      case 0x79: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,C */
976      case 0x79: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,C */
711977         cpustate->AF.b.h = cpustate->BC.b.l;
712978         break;
713      case 0x7a: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,D */
979      case 0x7a: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,D */
714980         cpustate->AF.b.h = cpustate->DE.b.h;
715981         break;
716      case 0x7b: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,E */
982      case 0x7b: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,E */
717983         cpustate->AF.b.h = cpustate->DE.b.l;
718984         break;
719      case 0x7c: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,H */
985      case 0x7c: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,H */
720986         cpustate->AF.b.h = cpustate->HL.b.h;
721987         break;
722      case 0x7d: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,L */
988      case 0x7d: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,L */
723989         cpustate->AF.b.h = cpustate->HL.b.l;
724990         break;
725991      case 0x7e: cpustate->icount -= 7;   /* MOV  A,M */
726992         cpustate->AF.b.h = RM(cpustate, cpustate->HL.d);
727993         break;
728      case 0x7f: cpustate->icount -= (cpustate->cputype) ? 4 : 5;   /* MOV  A,A */
994      case 0x7f: cpustate->icount -= IS_8085(cpustate) ? 4 : 5;   /* MOV  A,A */
729995         /* no op */
730996         break;
731997
r3957r3958
9291195         M_CMP(cpustate->AF.b.h);
9301196         break;
9311197
932      case 0xc0: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RNZ  */
1198      case 0xc0: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RNZ  */
9331199         M_RET( !(cpustate->AF.b.l & ZF) );
9341200         break;
9351201      case 0xc1: cpustate->icount -= 10;   /* POP  B */
r3957r3958
9441210      case 0xc4: cpustate->icount -= 11;   /* CNZ  nnnn */
9451211         M_CALL( !(cpustate->AF.b.l & ZF) );
9461212         break;
947      case 0xc5: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* PUSH B */
1213      case 0xc5: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* PUSH B */
9481214         M_PUSH(BC);
9491215         break;
9501216      case 0xc6: cpustate->icount -= 7;   /* ADI  nn */
9511217         cpustate->XX.b.l = ARG(cpustate);
9521218         M_ADD(cpustate->XX.b.l);
9531219            break;
954      case 0xc7: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  0 */
1220      case 0xc7: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  0 */
9551221         M_RST(0);
9561222         break;
9571223
958      case 0xc8: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RZ   */
1224      case 0xc8: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RZ   */
9591225         M_RET( cpustate->AF.b.l & ZF );
9601226         break;
9611227      case 0xc9: cpustate->icount -= 10;   /* RET  */
r3957r3958
9651231         M_JMP( cpustate->AF.b.l & ZF );
9661232         break;
9671233      case 0xcb:
968         if( cpustate->cputype ) {
1234         if (IS_8085(cpustate)) {
9691235            if (cpustate->AF.b.l & VF) {
9701236               cpustate->icount -= 12;
9711237               M_RST(8);         /* call 0x40 */
r3957r3958
9871253         cpustate->XX.b.l = ARG(cpustate);
9881254         M_ADC(cpustate->XX.b.l);
9891255         break;
990      case 0xcf: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  1 */
1256      case 0xcf: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  1 */
9911257         M_RST(1);
9921258         break;
9931259
994      case 0xd0: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RNC  */
1260      case 0xd0: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RNC  */
9951261         M_RET( !(cpustate->AF.b.l & CF) );
9961262         break;
9971263      case 0xd1: cpustate->icount -= 10;   /* POP  D */
r3957r3958
10061272      case 0xd4: cpustate->icount -= 11;   /* CNC  nnnn */
10071273         M_CALL( !(cpustate->AF.b.l & CF) );
10081274         break;
1009      case 0xd5: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* PUSH D */
1275      case 0xd5: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* PUSH D */
10101276         M_PUSH(DE);
10111277         break;
10121278      case 0xd6: cpustate->icount -= 7;   /* SUI  nn */
10131279         cpustate->XX.b.l = ARG(cpustate);
10141280         M_SUB(cpustate->XX.b.l);
10151281         break;
1016      case 0xd7: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  2 */
1282      case 0xd7: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  2 */
10171283         M_RST(2);
10181284         break;
10191285
1020      case 0xd8: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RC   */
1286      case 0xd8: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RC   */
10211287         M_RET( cpustate->AF.b.l & CF );
10221288         break;
10231289      case 0xd9:
1024         if( cpustate->cputype ) {
1290         if (IS_8085(cpustate)) {
10251291            cpustate->icount -= 10;      /* SHLX */
10261292            cpustate->XX.w.l = cpustate->DE.w.l;
10271293            WM(cpustate, cpustate->XX.d, cpustate->HL.b.l);
r3957r3958
10421308         M_CALL( cpustate->AF.b.l & CF );
10431309         break;
10441310      case 0xdd:
1045         if( cpustate->cputype ) {
1311         if (IS_8085(cpustate)) {
10461312            cpustate->icount -= 7;      /* JNX  nnnn */
10471313            M_JMP( !(cpustate->AF.b.l & XF) );
10481314         } else {
r3957r3958
10541320         cpustate->XX.b.l = ARG(cpustate);
10551321         M_SBB(cpustate->XX.b.l);
10561322         break;
1057      case 0xdf: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  3 */
1323      case 0xdf: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  3 */
10581324         M_RST(3);
10591325         break;
10601326
1061      case 0xe0: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RPO    */
1327      case 0xe0: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RPO    */
10621328         M_RET( !(cpustate->AF.b.l & VF) );
10631329         break;
10641330      case 0xe1: cpustate->icount -= 10;   /* POP  H */
r3957r3958
10671333      case 0xe2: cpustate->icount -= 10;   /* JPO  nnnn */
10681334         M_JMP( !(cpustate->AF.b.l & VF) );
10691335         break;
1070      case 0xe3: cpustate->icount -= (cpustate->cputype) ? 16 : 18;   /* XTHL */
1336      case 0xe3: cpustate->icount -= IS_8085(cpustate) ? 16 : 18;   /* XTHL */
10711337         M_POP(XX);
10721338         M_PUSH(HL);
10731339         cpustate->HL.d = cpustate->XX.d;
r3957r3958
10751341      case 0xe4: cpustate->icount -= 11;   /* CPO  nnnn */
10761342         M_CALL( !(cpustate->AF.b.l & VF) );
10771343         break;
1078      case 0xe5: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* PUSH H */
1344      case 0xe5: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* PUSH H */
10791345         M_PUSH(HL);
10801346         break;
10811347      case 0xe6: cpustate->icount -= 7;   /* ANI  nn */
10821348         cpustate->XX.b.l = ARG(cpustate);
10831349         M_ANA(cpustate->XX.b.l);
10841350         break;
1085      case 0xe7: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  4 */
1351      case 0xe7: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  4 */
10861352         M_RST(4);
10871353         break;
10881354
1089      case 0xe8: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RPE  */
1355      case 0xe8: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RPE  */
10901356         M_RET( cpustate->AF.b.l & VF );
10911357         break;
1092      case 0xe9: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* PCHL */
1358      case 0xe9: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* PCHL */
10931359         cpustate->PC.d = cpustate->HL.w.l;
10941360         break;
10951361      case 0xea: cpustate->icount -= 10;   /* JPE  nnnn */
r3957r3958
11041370         M_CALL( cpustate->AF.b.l & VF );
11051371         break;
11061372      case 0xed:
1107         if( cpustate->cputype ) {
1373         if (IS_8085(cpustate)) {
11081374            cpustate->icount -= 10;      /* LHLX */
11091375            cpustate->XX.w.l = cpustate->DE.w.l;
11101376            cpustate->HL.b.l = RM(cpustate, cpustate->XX.d);
r3957r3958
11191385         cpustate->XX.b.l = ARG(cpustate);
11201386         M_XRA(cpustate->XX.b.l);
11211387         break;
1122      case 0xef: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  5 */
1388      case 0xef: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  5 */
11231389         M_RST(5);
11241390         break;
11251391
1126      case 0xf0: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RP   */
1392      case 0xf0: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RP   */
11271393         M_RET( !(cpustate->AF.b.l&SF) );
11281394         break;
11291395      case 0xf1: cpustate->icount -= 10;   /* POP  A */
r3957r3958
11341400         break;
11351401      case 0xf3: cpustate->icount -= 4;   /* DI   */
11361402         /* remove interrupt enable */
1137         cpustate->IM &= ~IM_IEN;
1138         if (cpustate->inte_callback) (*cpustate->inte_callback)(cpustate->device, (cpustate->IM & IM_IEN) ? 1 : 0);
1403         set_inte(cpustate, 0);
11391404         break;
11401405      case 0xf4: cpustate->icount -= 11;   /* CP   nnnn */
11411406         M_CALL( !(cpustate->AF.b.l & SF) );
11421407         break;
1143      case 0xf5: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* PUSH A */
1408      case 0xf5: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* PUSH A */
11441409         M_PUSH(AF);
11451410         break;
11461411      case 0xf6: cpustate->icount -= 7;   /* ORI  nn */
11471412         cpustate->XX.b.l = ARG(cpustate);
11481413         M_ORA(cpustate->XX.b.l);
11491414         break;
1150      case 0xf7: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  6 */
1415      case 0xf7: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  6 */
11511416         M_RST(6);
11521417         break;
11531418
1154      case 0xf8: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* RM   */
1419      case 0xf8: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* RM   */
11551420         M_RET( cpustate->AF.b.l & SF );
11561421         break;
1157      case 0xf9: cpustate->icount -= (cpustate->cputype) ? 6 : 5;   /* SPHL */
1422      case 0xf9: cpustate->icount -= IS_8085(cpustate) ? 6 : 5;   /* SPHL */
11581423         cpustate->SP.d = cpustate->HL.d;
11591424         break;
11601425      case 0xfa: cpustate->icount -= 10;   /* JM   nnnn */
r3957r3958
11621427         break;
11631428      case 0xfb: cpustate->icount -= 4;   /* EI */
11641429         /* set interrupt enable */
1165         cpustate->IM |= IM_IEN;
1166         if (cpustate->inte_callback) (*cpustate->inte_callback)(cpustate->device, (cpustate->IM & IM_IEN) ? 1 : 0);
1167         cpustate->after_ei = TRUE;
1430         set_inte(cpustate, 1);
1431         cpustate->after_ei = 2;
11681432         break;
11691433      case 0xfc: cpustate->icount -= 11;   /* CM   nnnn */
11701434         M_CALL( cpustate->AF.b.l & SF );
11711435         break;
11721436      case 0xfd:
1173         if( cpustate->cputype ) {
1437         if (IS_8085(cpustate)) {
11741438            cpustate->icount -= 7;      /* JX   nnnn */
11751439            M_JMP( cpustate->AF.b.l & XF );
11761440         } else {
r3957r3958
11821446         cpustate->XX.b.l = ARG(cpustate);
11831447         M_CMP(cpustate->XX.b.l);
11841448         break;
1185      case 0xff: cpustate->icount -= (cpustate->cputype) ? 12 : 11;   /* RST  7 */
1449      case 0xff: cpustate->icount -= IS_8085(cpustate) ? 12 : 11;   /* RST  7 */
11861450         M_RST(7);
11871451         break;
11881452   }
11891453}
11901454
1191static void Interrupt(i8085_state *cpustate)
1192{
11931455
1194   if( cpustate->HALT )      /* if the CPU was halted */
1195   {
1196      cpustate->PC.w.l++;    /* skip HALT instr */
1197      cpustate->HALT = 0;
1198      cpustate->STATUS = 0x26; // int ack while halt
1199   } else {
1200      cpustate->STATUS = 0x23; // int ack
1201   }
1202//AT
1203   cpustate->IREQ &= ~cpustate->ISRV; // remove serviced IRQ flag
1204   cpustate->rim_ien = (cpustate->ISRV==IM_TRAP) ? cpustate->IM & IM_IEN : 0; // latch general interrupt enable bit on TRAP or NMI
1205//ZT
1206   cpustate->IM &= ~IM_IEN;      /* remove general interrupt enable bit */
1456/***************************************************************************
1457    COMMON EXECUTION
1458***************************************************************************/
12071459
1208   if( cpustate->ISRV == IM_INTR )
1209   {
1210      LOG(("Interrupt get INTR vector\n"));
1211      cpustate->IRQ1 = (cpustate->irq_callback)(cpustate->device, 0);
1212   }
1213
1214   if( cpustate->cputype )
1215   {
1216      if( cpustate->ISRV == IM_RST55 )
1217      {
1218         LOG(("Interrupt get RST5.5 vector\n"));
1219         //cpustate->IRQ1 = (cpustate->irq_callback)(cpustate->device, 1);
1220         cpustate->irq_state[I8085_RST55_LINE] = CLEAR_LINE; //AT: processing RST5.5, reset interrupt line
1221      }
1222
1223      if( cpustate->ISRV == IM_RST65   )
1224      {
1225         LOG(("Interrupt get RST6.5 vector\n"));
1226         //cpustate->IRQ1 = (cpustate->irq_callback)(cpustate->device, 2);
1227         cpustate->irq_state[I8085_RST65_LINE] = CLEAR_LINE; //AT: processing RST6.5, reset interrupt line
1228      }
1229
1230      if( cpustate->ISRV == IM_RST75 )
1231      {
1232         LOG(("Interrupt get RST7.5 vector\n"));
1233         //cpustate->IRQ1 = (cpustate->irq_callback)(cpustate->device, 3);
1234         cpustate->irq_state[I8085_RST75_LINE] = CLEAR_LINE; //AT: processing RST7.5, reset interrupt line
1235      }
1236   }
1237
1238   switch( cpustate->IRQ1 & 0xff0000 )
1239   {
1240      case 0xcd0000:   /* CALL nnnn */
1241         cpustate->icount -= 7;
1242         M_PUSH(PC);
1243      case 0xc30000:   /* JMP  nnnn */
1244         cpustate->icount -= 10;
1245         cpustate->PC.d = cpustate->IRQ1 & 0xffff;
1246         break;
1247      default:
1248         switch( cpustate->ISRV )
1249         {
1250            case IM_TRAP:
1251            case IM_RST75:
1252            case IM_RST65:
1253            case IM_RST55:
1254               M_PUSH(PC);
1255               if (cpustate->IRQ1 != (1 << I8085_RST75_LINE))
1256                  cpustate->PC.d = cpustate->IRQ1;
1257               else
1258                  cpustate->PC.d = 0x3c;
1259               break;
1260            default:
1261               LOG(("i8085 take int $%02x\n", cpustate->IRQ1));
1262               execute_one(cpustate, cpustate->IRQ1 & 0xff);
1263         }
1264   }
1265   cpustate->ISRV = 0;
1266}
1267
1268static CPU_EXECUTE( i8085 )
1460static CPU_EXECUTE( i808x )
12691461{
12701462   i8085_state *cpustate = device->token;
12711463
12721464   cpustate->icount = cycles;
1465
1466   /* check for TRAPs before diving in (can't do others because of after_ei) */
1467   if (cpustate->trap_pending || cpustate->after_ei == 0)
1468      check_for_interrupts(cpustate);
1469
12731470   do
12741471   {
12751472      debugger_instruction_hook(device, cpustate->PC.d);
12761473
1277      /* interrupts enabled or TRAP pending ? */
1278      if ( ((cpustate->IM & IM_IEN) && (!cpustate->after_ei)) || (cpustate->IREQ & IM_TRAP) )
1279      {
1280         /* copy scheduled to executed interrupt request */
1281         cpustate->IRQ1 = cpustate->IRQ2;
1282         /* reset scheduled interrupt request */
1283         cpustate->IRQ2 = 0;
1284         /* interrupt now ? */
1285         if (cpustate->IRQ1) Interrupt(cpustate);
1286      }
1474      /* the instruction after an EI does not take an interrupt, so
1475           we cannot check immediately; handle post-EI behavior here */
1476      if (cpustate->after_ei != 0 && --cpustate->after_ei == 0)
1477         check_for_interrupts(cpustate);
12871478
1288      cpustate->after_ei = FALSE;
12891479      /* here we go... */
12901480      execute_one(cpustate, ROP(cpustate));
12911481
r3957r3958
12941484   return cycles - cpustate->icount;
12951485}
12961486
1297/****************************************************************************
1298 * Initialise the various lookup tables used by the emulation code
1299 ****************************************************************************/
1487
1488
1489/***************************************************************************
1490    CORE INITIALIZATION
1491***************************************************************************/
1492
13001493static void init_tables (void)
13011494{
13021495   UINT8 zs;
r3957r3958
13201513   }
13211514}
13221515
1323/****************************************************************************
1324 * Init the 8085 emulation
1325 ****************************************************************************/
1326static CPU_INIT( i8085 )
1516
1517static void init_808x_common(const device_config *device, cpu_irq_callback irqcallback, int type)
13271518{
13281519   i8085_state *cpustate = device->token;
13291520
13301521   init_tables();
1331   cpustate->cputype = 1;
1522
1523   /* set up the state table */
1524   cpustate->state = state_table_template;
1525   cpustate->state.baseptr = cpustate;
1526   cpustate->state.subtypemask = 1 << type;
1527
1528   if (device->static_config != NULL)
1529      cpustate->config = *(i8085_config *)device->static_config;
1530   cpustate->cputype = type;
13321531   cpustate->irq_callback = irqcallback;
13331532   cpustate->device = device;
1533
13341534   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
13351535   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
13361536
1537   state_save_register_device_item(device, 0, cpustate->PC.w.l);
1538   state_save_register_device_item(device, 0, cpustate->SP.w.l);
13371539   state_save_register_device_item(device, 0, cpustate->AF.w.l);
13381540   state_save_register_device_item(device, 0, cpustate->BC.w.l);
13391541   state_save_register_device_item(device, 0, cpustate->DE.w.l);
13401542   state_save_register_device_item(device, 0, cpustate->HL.w.l);
1341   state_save_register_device_item(device, 0, cpustate->SP.w.l);
1342   state_save_register_device_item(device, 0, cpustate->PC.w.l);
13431543   state_save_register_device_item(device, 0, cpustate->HALT);
13441544   state_save_register_device_item(device, 0, cpustate->IM);
1345   state_save_register_device_item(device, 0, cpustate->IREQ);
1346   state_save_register_device_item(device, 0, cpustate->ISRV);
1347   state_save_register_device_item(device, 0, cpustate->INTR);
1348   state_save_register_device_item(device, 0, cpustate->IRQ2);
1349   state_save_register_device_item(device, 0, cpustate->IRQ1);
13501545   state_save_register_device_item(device, 0, cpustate->STATUS);
13511546   state_save_register_device_item(device, 0, cpustate->after_ei);
1547   state_save_register_device_item(device, 0, cpustate->nmi_state);
13521548   state_save_register_device_item_array(device, 0, cpustate->irq_state);
1549   state_save_register_device_item(device, 0, cpustate->trap_pending);
1550   state_save_register_device_item(device, 0, cpustate->trap_im_copy);
1551   state_save_register_device_item(device, 0, cpustate->sod_state);
13531552}
13541553
1355/****************************************************************************
1356 * Reset the 8085 emulation
1357 ****************************************************************************/
1358static CPU_RESET( i8085 )
1554static CPU_INIT( i8080 )
13591555{
1360   i8085_state *cpustate = device->token;
1361   cpu_irq_callback save_irqcallback;
1362   i8085_sod_func save_sodcallback;
1363   i8085_sid_func save_sidcallback;
1364   i8085_inte_func save_intecallback;
1365   i8085_status_func save_statuscallback;
1366   int cputype_bak = cpustate->cputype;
1367
1368   init_tables();
1369   save_irqcallback = cpustate->irq_callback;
1370   save_sodcallback = cpustate->sod_callback;
1371   save_sidcallback = cpustate->sid_callback;
1372   save_intecallback = cpustate->inte_callback;
1373   save_statuscallback = cpustate->status_callback;
1374   memset(cpustate, 0, sizeof(*cpustate));
1375   cpustate->irq_callback = save_irqcallback;
1376   cpustate->sod_callback = save_sodcallback;
1377   cpustate->sid_callback = save_sidcallback;
1378   cpustate->inte_callback = save_intecallback;
1379   cpustate->status_callback = save_statuscallback;
1380   cpustate->device = device;
1381   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
1382   cpustate->io = memory_find_address_space(device, ADDRESS_SPACE_IO);
1383
1384   cpustate->cputype = cputype_bak;
1385   cpustate->after_ei = FALSE;
1386
1387   if (cpustate->inte_callback) (*cpustate->inte_callback)(cpustate->device, (cpustate->IM & IM_IEN) ? 1 : 0);
1556   init_808x_common(device, irqcallback, CPUTYPE_8080);
13881557}
13891558
1390/****************************************************************************
1391 * Shut down the CPU emulation
1392 ****************************************************************************/
1393static CPU_EXIT( i8085 )
1559static CPU_INIT( i8085 )
13941560{
1395   /* nothing to do */
1561   init_808x_common(device, irqcallback, CPUTYPE_8085);
13961562}
13971563
1398/****************************************************************************/
1399/* Set TRAP signal state                                                    */
1400/****************************************************************************/
1401static void i8085_set_TRAP(i8085_state *cpustate, int state)
1402{
1403   LOG(("i8085: TRAP %d\n", state));
1404   if (state)
1405   {
1406      cpustate->IREQ |= IM_TRAP;
1407      if( cpustate->ISRV & IM_TRAP ) return;   /* already servicing TRAP ? */
1408      cpustate->ISRV = IM_TRAP;            /* service TRAP */
1409      cpustate->IRQ2 = ADDR_TRAP;
1410   }
1411   else
1412   {
1413      cpustate->IREQ &= ~IM_TRAP;          /* remove request for TRAP */
1414   }
1415}
14161564
1417/****************************************************************************/
1418/* Set RST7.5 signal state                                                  */
1419/****************************************************************************/
1420static void i8085_set_RST75(i8085_state *cpustate, int state)
1421{
1422   LOG(("i8085: RST7.5 %d\n", state));
1423   if( state )
1424   {
14251565
1426      cpustate->IREQ |= IM_RST75;          /* request RST7.5 */
1427      cpustate->irq_state[I8085_RST75_LINE] = CLEAR_LINE;   /* clear latch */
1428      if( cpustate->IM & IM_RST75 ) return;   /* if masked, ignore it for now */
1429      if( !cpustate->ISRV )               /* if no higher priority IREQ is serviced */
1430      {
1431         cpustate->ISRV = IM_RST75;         /* service RST7.5 */
1432         cpustate->IRQ2 = ADDR_RST75;
1433      }
1434   }
1435   /* RST7.5 is reset only by SIM or end of service routine ! */
1436}
1566/***************************************************************************
1567    COMMON RESET
1568***************************************************************************/
14371569
1438/****************************************************************************/
1439/* Set RST6.5 signal state                                                  */
1440/****************************************************************************/
1441static void i8085_set_RST65(i8085_state *cpustate, int state)
1570static CPU_RESET( i808x )
14421571{
1443   LOG(("i8085: RST6.5 %d\n", state));
1444   if( state )
1445   {
1446      cpustate->IREQ |= IM_RST65;          /* request RST6.5 */
1447      if( cpustate->IM & IM_RST65 ) return;   /* if masked, ignore it for now */
1448      if( !cpustate->ISRV )               /* if no higher priority IREQ is serviced */
1449      {
1450         cpustate->ISRV = IM_RST65;         /* service RST6.5 */
1451         cpustate->IRQ2 = ADDR_RST65;
1452      }
1453   }
1454   else
1455   {
1456      cpustate->IREQ &= ~IM_RST65;         /* remove request for RST6.5 */
1457   }
1458}
1572   i8085_state *cpustate = device->token;
14591573
1460/****************************************************************************/
1461/* Set RST5.5 signal state                                                  */
1462/****************************************************************************/
1463static void i8085_set_RST55(i8085_state *cpustate, int state)
1464{
1465   LOG(("i8085: RST5.5 %d\n", state));
1466   if( state )
1467   {
1468      cpustate->IREQ |= IM_RST55;          /* request RST5.5 */
1469      if( cpustate->IM & IM_RST55 ) return;   /* if masked, ignore it for now */
1470      if( !cpustate->ISRV )               /* if no higher priority IREQ is serviced */
1471      {
1472         cpustate->ISRV = IM_RST55;         /* service RST5.5 */
1473         cpustate->IRQ2 = ADDR_RST55;
1474      }
1475   }
1476   else
1477   {
1478      cpustate->IREQ &= ~IM_RST55;         /* remove request for RST5.5 */
1479   }
1574   cpustate->PC.d = 0;
1575   cpustate->HALT = 0;
1576   cpustate->IM &= ~IM_I75;
1577   cpustate->IM |= IM_M55 | IM_M65 | IM_M75;
1578   cpustate->after_ei = FALSE;
1579   cpustate->trap_pending = FALSE;
1580   cpustate->trap_im_copy = 0;
1581   set_inte(cpustate, 0);
1582   set_sod(cpustate, 0);
14801583}
14811584
1482/****************************************************************************/
1483/* Set INTR signal                                                          */
1484/****************************************************************************/
1485static void i8085_set_INTR(i8085_state *cpustate, int state)
1486{
1487   LOG(("i8085: INTR %d\n", state));
1488   if( state )
1489   {
1490      cpustate->IREQ |= IM_INTR;            /* request INTR */
1491      //cpustate->INTR = state;
1492      cpustate->INTR = I8085_INTR; //AT: cpustate->INTR is supposed to hold IRQ0 vector(0x38) (0xff in this implementation)
1493      if( cpustate->IM & IM_INTR ) return;   /* if masked, ignore it for now */
1494      if( !cpustate->ISRV )               /* if no higher priority IREQ is serviced */
1495      {
1496         cpustate->ISRV = IM_INTR;         /* service INTR */
1497         cpustate->IRQ2 = cpustate->INTR;
1498      }
1499   }
1500   else
1501   {
1502      cpustate->IREQ &= ~IM_INTR;          /* remove request for INTR */
1503   }
1504}
15051585
1506static void i8085_set_irq_line(i8085_state *cpustate, int irqline, int state)
1586
1587/***************************************************************************
1588    COMMON STATE IMPORT/EXPORT
1589***************************************************************************/
1590
1591static CPU_IMPORT_STATE( i808x )
15071592{
1508   if (irqline == INPUT_LINE_NMI)
1593   i8085_state *cpustate = device->token;
1594
1595   switch (entry->index)
15091596   {
1510      if( state != CLEAR_LINE )
1511         i8085_set_TRAP(cpustate, 1);
1512   }
1513   else if (irqline < 4)
1514   {
1515      if (irqline == I8085_RST75_LINE)   /* RST7.5 is latched on rising edge, the others are sampled */
1516      {
1517         if( state != CLEAR_LINE )
1518            cpustate->irq_state[irqline] = state;
1519      }
1520      else
1521         cpustate->irq_state[irqline] = state;
1597      case I8085_SID:
1598         if (cpustate->ietemp)
1599            cpustate->IM |= IM_SID;
1600         else
1601            cpustate->IM &= ~IM_SID;
1602         break;
15221603
1523      if (state == CLEAR_LINE)
1524      {
1525         if( !(cpustate->IM & IM_IEN) )
1526         {
1527            switch (irqline)
1528            {
1529               case I8085_INTR_LINE: i8085_set_INTR(cpustate, 0); break;
1530               case I8085_RST55_LINE: i8085_set_RST55(cpustate, 0); break;
1531               case I8085_RST65_LINE: i8085_set_RST65(cpustate, 0); break;
1532               case I8085_RST75_LINE: i8085_set_RST75(cpustate, 0); break;
1533            }
1534         }
1535      }
1536      else
1537      {
1538         if( cpustate->IM & IM_IEN )
1539         {
1540            switch( irqline )
1541            {
1542               case I8085_INTR_LINE: i8085_set_INTR(cpustate, 1); break;
1543               case I8085_RST55_LINE: i8085_set_RST55(cpustate, 1); break;
1544               case I8085_RST65_LINE: i8085_set_RST65(cpustate, 1); break;
1545               case I8085_RST75_LINE: i8085_set_RST75(cpustate, 1); break;
1546            }
1547         }
1548      }
1604      case I8085_INTE:
1605         if (cpustate->ietemp)
1606            cpustate->IM |= IM_IE;
1607         else
1608            cpustate->IM &= ~IM_IE;
1609         break;
1610
1611      default:
1612         fatalerror("CPU_IMPORT_STATE(i808x) called for unexpected value\n");
1613         break;
15491614   }
15501615}
15511616
15521617
1553/**************************************************************************
1554 * 8080 section
1555 **************************************************************************/
1556#if (HAS_8080)
1557
1558static CPU_INIT( i8080 )
1618static CPU_EXPORT_STATE( i808x )
15591619{
15601620   i8085_state *cpustate = device->token;
15611621
1562   init_tables();
1563   cpustate->cputype = 0;
1564   cpustate->irq_callback = irqcallback;
1565   cpustate->device = device;
1622   switch (entry->index)
1623   {
1624      case I8085_SID:
1625         cpustate->ietemp = ((cpustate->IM & IM_SID) != 0);
1626         if (cpustate->config.sid != NULL)
1627            cpustate->ietemp = ((*cpustate->config.sid)(cpustate->device) != 0);
1628         break;
15661629
1567   state_save_register_device_item(device, 0, cpustate->AF.w.l);
1568   state_save_register_device_item(device, 0, cpustate->BC.w.l);
1569   state_save_register_device_item(device, 0, cpustate->DE.w.l);
1570   state_save_register_device_item(device, 0, cpustate->HL.w.l);
1571   state_save_register_device_item(device, 0, cpustate->SP.w.l);
1572   state_save_register_device_item(device, 0, cpustate->PC.w.l);
1573   state_save_register_device_item(device, 0, cpustate->HALT);
1574   state_save_register_device_item(device, 0, cpustate->IM);
1575   state_save_register_device_item(device, 0, cpustate->IREQ);
1576   state_save_register_device_item(device, 0, cpustate->ISRV);
1577   state_save_register_device_item(device, 0, cpustate->INTR);
1578   state_save_register_device_item(device, 0, cpustate->IRQ2);
1579   state_save_register_device_item(device, 0, cpustate->IRQ1);
1580   state_save_register_device_item(device, 0, cpustate->STATUS);
1581   state_save_register_device_item_array(device, 0, cpustate->irq_state);
1630      case I8085_INTE:
1631         cpustate->ietemp = ((cpustate->IM & IM_IE) != 0);
1632         break;
1633
1634      default:
1635         fatalerror("CPU_EXPORT_STATE(i808x) called for unexpected value\n");
1636         break;
1637   }
15821638}
15831639
1584static void i8080_set_irq_line(i8085_state *cpustate, int irqline, int state)
1640
1641
1642/***************************************************************************
1643    COMMON SET INFO
1644***************************************************************************/
1645
1646static void i808x_set_irq_line(i8085_state *cpustate, int irqline, int state)
15851647{
1648   int newstate = (state != CLEAR_LINE);
1649
1650   /* NMI is edge-triggered */
15861651   if (irqline == INPUT_LINE_NMI)
15871652   {
1588      if( state != CLEAR_LINE )
1589         i8085_set_TRAP(cpustate, 1);
1653      if (!cpustate->nmi_state && newstate)
1654         cpustate->trap_pending = TRUE;
1655      cpustate->nmi_state = newstate;
15901656   }
1591   else
1657
1658   /* RST7.5 is edge-triggered */
1659   else if (irqline == I8085_RST75_LINE)
15921660   {
1593      cpustate->irq_state[irqline] = state;
1594      if (state == CLEAR_LINE)
1595      {
1596         if (!(cpustate->IM & IM_IEN))
1597            i8085_set_INTR(cpustate, 0);
1598      }
1599      else
1600      {
1601         if (cpustate->IM & IM_IEN)
1602            i8085_set_INTR(cpustate, 1);
1603      }
1661      if (!cpustate->irq_state[I8085_RST75_LINE] && newstate)
1662         cpustate->IM |= IM_I75;
1663      cpustate->irq_state[I8085_RST75_LINE] = newstate;
16041664   }
1665
1666   /* remaining sources are level triggered */
1667   else if (irqline < ARRAY_LENGTH(cpustate->irq_state))
1668      cpustate->irq_state[irqline] = state;
16051669}
1606#endif
16071670
16081671
1609/**************************************************************************
1610 * Generic set_info
1611 **************************************************************************/
1612
1613static CPU_SET_INFO( i8085 )
1672static CPU_SET_INFO( i808x )
16141673{
16151674   i8085_state *cpustate = device->token;
16161675   switch (state)
16171676   {
16181677      /* --- the following bits of info are set as 64-bit signed integers --- */
1619      case CPUINFO_INT_INPUT_STATE + I8085_INTR_LINE:   i8085_set_irq_line(cpustate, I8085_INTR_LINE, info->i); break;
1620      case CPUINFO_INT_INPUT_STATE + I8085_RST55_LINE:i8085_set_irq_line(cpustate, I8085_RST55_LINE, info->i); break;
1621      case CPUINFO_INT_INPUT_STATE + I8085_RST65_LINE:i8085_set_irq_line(cpustate, I8085_RST65_LINE, info->i); break;
1622      case CPUINFO_INT_INPUT_STATE + I8085_RST75_LINE:i8085_set_irq_line(cpustate, I8085_RST75_LINE, info->i); break;
1623      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   i8085_set_irq_line(cpustate, INPUT_LINE_NMI, info->i); break;
1624
1625      case CPUINFO_INT_PC:                     cpustate->PC.w.l = info->i;                break;
1626      case CPUINFO_INT_REGISTER + I8085_PC:         cpustate->PC.w.l = info->i;                  break;
1627      case CPUINFO_INT_SP:                     cpustate->SP.w.l = info->i;                  break;
1628      case CPUINFO_INT_REGISTER + I8085_SP:         cpustate->SP.w.l = info->i;                  break;
1629      case CPUINFO_INT_REGISTER + I8085_AF:         cpustate->AF.w.l = info->i;                  break;
1630      case CPUINFO_INT_REGISTER + I8085_BC:         cpustate->BC.w.l = info->i;                  break;
1631      case CPUINFO_INT_REGISTER + I8085_DE:         cpustate->DE.w.l = info->i;                  break;
1632      case CPUINFO_INT_REGISTER + I8085_HL:         cpustate->HL.w.l = info->i;                  break;
1633      case CPUINFO_INT_REGISTER + I8085_IM:         cpustate->IM = info->i;                     break;
1634      case CPUINFO_INT_REGISTER + I8085_HALT:         cpustate->HALT = info->i;                  break;
1635      case CPUINFO_INT_REGISTER + I8085_IREQ:         cpustate->IREQ = info->i;                  break;
1636      case CPUINFO_INT_REGISTER + I8085_ISRV:         cpustate->ISRV = info->i;                  break;
1637      case CPUINFO_INT_REGISTER + I8085_VECTOR:      cpustate->INTR = info->i;                  break;
1638      case CPUINFO_INT_REGISTER + I8085_STATUS:      cpustate->STATUS = info->i;                  break;
1639
1640      case CPUINFO_INT_I8085_SID:                  if (info->i) cpustate->IM |= IM_SID; else cpustate->IM &= ~IM_SID; break;
1641
1642      /* --- the following bits of info are set as pointers to data or functions --- */
1643      case CPUINFO_PTR_I8085_SOD_CALLBACK:         cpustate->sod_callback = (i8085_sod_func)info->f; break;
1644      case CPUINFO_PTR_I8085_SID_CALLBACK:         cpustate->sid_callback = (i8085_sid_func)info->f; break;
1645      case CPUINFO_PTR_I8085_INTE_CALLBACK:         cpustate->inte_callback = (i8085_inte_func)info->f; break;
1646      case CPUINFO_PTR_I8085_STATUS_CALLBACK:         cpustate->status_callback = (i8085_status_func)info->f; break;
1678      case CPUINFO_INT_INPUT_STATE + I8085_INTR_LINE:
1679      case CPUINFO_INT_INPUT_STATE + I8085_RST55_LINE:
1680      case CPUINFO_INT_INPUT_STATE + I8085_RST65_LINE:
1681      case CPUINFO_INT_INPUT_STATE + I8085_RST75_LINE:
1682      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:
1683         i808x_set_irq_line(cpustate, state - CPUINFO_INT_INPUT_STATE, info->i);
1684         break;
16471685   }
16481686}
16491687
16501688
16511689
1652/**************************************************************************
1653 * Generic get_info
1654 **************************************************************************/
1690/***************************************************************************
1691    8085/COMMON GET INFO
1692***************************************************************************/
16551693
16561694CPU_GET_INFO( i8085 )
16571695{
r3957r3958
16701708      case CPUINFO_INT_MIN_CYCLES:               info->i = 4;                     break;
16711709      case CPUINFO_INT_MAX_CYCLES:               info->i = 16;                     break;
16721710
1673      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1674      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
1675      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1676      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1677      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1678      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1679      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1680      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;               break;
1681      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1711      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 8;                     break;
1712      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:       info->i = 16;                     break;
1713      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:       info->i = 0;                     break;
1714      case CPUINFO_INT_DATABUS_WIDTH_IO:            info->i = 8;                     break;
1715      case CPUINFO_INT_ADDRBUS_WIDTH_IO:             info->i = 8;                     break;
1716      case CPUINFO_INT_ADDRBUS_SHIFT_IO:             info->i = 0;                     break;
16821717
1683      case CPUINFO_INT_INPUT_STATE + I8085_INTR_LINE:   info->i = (cpustate->IREQ & IM_INTR) ? ASSERT_LINE : CLEAR_LINE; break;
1684      case CPUINFO_INT_INPUT_STATE + I8085_RST55_LINE:info->i = (cpustate->IREQ & IM_RST55) ? ASSERT_LINE : CLEAR_LINE; break;
1685      case CPUINFO_INT_INPUT_STATE + I8085_RST65_LINE:info->i = (cpustate->IREQ & IM_RST65) ? ASSERT_LINE : CLEAR_LINE; break;
1686      case CPUINFO_INT_INPUT_STATE + I8085_RST75_LINE:info->i = (cpustate->IREQ & IM_RST75) ? ASSERT_LINE : CLEAR_LINE; break;
1687      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = (cpustate->IREQ & IM_TRAP) ? ASSERT_LINE : CLEAR_LINE; break;
1718      /* --- the following bits of info are returned as pointers to functions --- */
1719      case CPUINFO_FCT_SET_INFO:      info->setinfo = CPU_SET_INFO_NAME(i808x);            break;
1720      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(i8085);                  break;
1721      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(i808x);               break;
1722      case CPUINFO_FCT_EXECUTE:      info->execute = CPU_EXECUTE_NAME(i808x);            break;
1723      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(i8085);      break;
1724      case CPUINFO_FCT_IMPORT_STATE:   info->import_state = CPU_IMPORT_STATE_NAME(i808x);      break;
1725      case CPUINFO_FCT_EXPORT_STATE:   info->export_state = CPU_EXPORT_STATE_NAME(i808x);      break;
16881726
1689      case CPUINFO_INT_PREVIOUSPC:               /* not supported */                  break;
1727      /* --- the following bits of info are returned as pointers --- */
1728      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
1729      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &cpustate->state;   break;
16901730
1691      case CPUINFO_INT_PC:                     info->i = cpustate->PC.d;                  break;
1692      case CPUINFO_INT_REGISTER + I8085_PC:         info->i = cpustate->PC.w.l;                  break;
1693      case CPUINFO_INT_SP:                     info->i = cpustate->SP.d;                  break;
1694      case CPUINFO_INT_REGISTER + I8085_SP:         info->i = cpustate->SP.w.l;                  break;
1695      case CPUINFO_INT_REGISTER + I8085_AF:         info->i = cpustate->AF.w.l;                  break;
1696      case CPUINFO_INT_REGISTER + I8085_BC:         info->i = cpustate->BC.w.l;                  break;
1697      case CPUINFO_INT_REGISTER + I8085_DE:         info->i = cpustate->DE.w.l;                  break;
1698      case CPUINFO_INT_REGISTER + I8085_HL:         info->i = cpustate->HL.w.l;                  break;
1699      case CPUINFO_INT_REGISTER + I8085_IM:         info->i = cpustate->IM;                     break;
1700      case CPUINFO_INT_REGISTER + I8085_HALT:         info->i = cpustate->HALT;                  break;
1701      case CPUINFO_INT_REGISTER + I8085_IREQ:         info->i = cpustate->IREQ;                  break;
1702      case CPUINFO_INT_REGISTER + I8085_ISRV:         info->i = cpustate->ISRV;                  break;
1703      case CPUINFO_INT_REGISTER + I8085_VECTOR:      info->i = cpustate->INTR;                  break;
1704      case CPUINFO_INT_REGISTER + I8085_STATUS:      info->i = cpustate->STATUS;                  break;
1705
1706      /* --- the following bits of info are returned as pointers to data or functions --- */
1707      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8085);         break;
1708      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8085);            break;
1709      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(i8085);            break;
1710      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(i8085);            break;
1711      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i8085);         break;
1712      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1713      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8085);         break;
1714      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
1715
17161731      /* --- the following bits of info are returned as NULL-terminated strings --- */
17171732      case CPUINFO_STR_NAME:                     strcpy(info->s, "8085A");            break;
17181733      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Intel 8080");         break;
r3957r3958
17311746            cpustate->AF.b.l & 0x02 ? 'N':'.',
17321747            cpustate->AF.b.l & 0x01 ? 'C':'.');
17331748         break;
1734
1735      case CPUINFO_STR_REGISTER + I8085_AF:         sprintf(info->s, "AF:%04X", cpustate->AF.w.l);   break;
1736      case CPUINFO_STR_REGISTER + I8085_BC:         sprintf(info->s, "BC:%04X", cpustate->BC.w.l);   break;
1737      case CPUINFO_STR_REGISTER + I8085_DE:         sprintf(info->s, "DE:%04X", cpustate->DE.w.l);   break;
1738      case CPUINFO_STR_REGISTER + I8085_HL:         sprintf(info->s, "HL:%04X", cpustate->HL.w.l);   break;
1739      case CPUINFO_STR_REGISTER + I8085_SP:         sprintf(info->s, "SP:%04X", cpustate->SP.w.l);   break;
1740      case CPUINFO_STR_REGISTER + I8085_PC:         sprintf(info->s, "PC:%04X", cpustate->PC.w.l);   break;
1741      case CPUINFO_STR_REGISTER + I8085_IM:         sprintf(info->s, "IM:%02X", cpustate->IM);      break;
1742      case CPUINFO_STR_REGISTER + I8085_HALT:         sprintf(info->s, "HALT:%d", cpustate->HALT);   break;
1743      case CPUINFO_STR_REGISTER + I8085_IREQ:         sprintf(info->s, "IREQ:%02X", cpustate->IREQ);   break;
1744      case CPUINFO_STR_REGISTER + I8085_ISRV:         sprintf(info->s, "ISRV:%02X", cpustate->ISRV);   break;
1745      case CPUINFO_STR_REGISTER + I8085_VECTOR:      sprintf(info->s, "VEC:%02X", cpustate->INTR);   break;
1746      case CPUINFO_STR_REGISTER + I8085_STATUS:      sprintf(info->s, "SW:%02X", cpustate->STATUS);   break;
17471749   }
17481750}
17491751
17501752
1751#if (HAS_8080)
1752/**************************************************************************
1753 * CPU-specific get_info/set_info
1754 **************************************************************************/
1753/***************************************************************************
1754    8080-SPECIFIC GET INFO
1755***************************************************************************/
17551756
1756static CPU_SET_INFO( i8080 )
1757{
1758   i8085_state *cpustate = device->token;
1759   switch (state)
1760   {
1761      /* --- the following bits of info are set as 64-bit signed integers --- */
1762      case CPUINFO_INT_INPUT_STATE + I8080_INTR_LINE:   i8080_set_irq_line(cpustate, I8080_INTR_LINE, info->i); break;
1763      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   i8080_set_irq_line(cpustate, INPUT_LINE_NMI, info->i); break;
1764
1765      default:                              CPU_SET_INFO_CALL(i8085); break;
1766   }
1767}
1768
17691757CPU_GET_INFO( i8080 )
17701758{
1771   i8085_state *cpustate = (device != NULL) ? device->token : NULL;
17721759   switch (state)
17731760   {
17741761      /* --- the following bits of info are returned as 64-bit signed integers --- */
17751762      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
17761763      case CPUINFO_INT_INPUT_LINES:               info->i = 1;                     break;
1777      case CPUINFO_INT_INPUT_STATE + I8085_INTR_LINE:   info->i = (cpustate->IREQ & IM_INTR) ? ASSERT_LINE : CLEAR_LINE; break;
1778      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = (cpustate->IREQ & IM_TRAP) ? ASSERT_LINE : CLEAR_LINE; break;
17791764
1780      /* --- the following bits of info are returned as pointers to data or functions --- */
1781      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8080);         break;
1782      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8080);            break;
1765      /* --- the following bits of info are returned as pointers to functions --- */
1766      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(i8080);                  break;
17831767
17841768      /* --- the following bits of info are returned as NULL-terminated strings --- */
17851769      case CPUINFO_STR_NAME:                     strcpy(info->s, "8080");            break;
r3957r3958
17871771      default:                              CPU_GET_INFO_CALL(i8085); break;
17881772   }
17891773}
1790#endif
src/emu/cpu/powerpc/ppcdrc.c
r3957r3958
531531    ppcdrc_init - initialize the processor
532532-------------------------------------------------*/
533533
534static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
534static void ppcdrc_init(powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, cpu_irq_callback irqcallback)
535535{
536536   drcfe_config feconfig =
537537   {
r3957r3958
556556   memset(ppc, 0, sizeof(*ppc));
557557
558558   /* initialize the core */
559   ppccom_init(ppc, flavor, cap, tb_divisor, device, index, clock, irqcallback);
559   ppccom_init(ppc, flavor, cap, tb_divisor, device, irqcallback);
560560
561561   /* allocate the implementation-specific state from the full cache */
562562   ppc->impstate = drccache_memory_alloc_near(cache, sizeof(*ppc->impstate));
r3957r3958
795795
796796static CPU_GET_INFO( ppcdrc )
797797{
798   powerpc_state *ppc = (device != NULL) ? *(powerpc_state **)device->token : NULL;
798   powerpc_state *ppc = (device != NULL && device->token != NULL) ? *(powerpc_state **)device->token : NULL;
799799   switch (state)
800800   {
801801      /* --- the following bits of info are returned as 64-bit signed integers --- */
r3957r3958
803803      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */                     break;
804804
805805      /* --- the following bits of info are returned as pointers to data or functions --- */
806      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc);      break;
807      case CPUINFO_PTR_INIT:                     /* provided per-CPU */                     break;
808      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppcdrc);         break;
809      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppcdrc);            break;
810      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppcdrc);      break;
811      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ppcdrc);break;
812      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(ppcdrc);   break;
813      case CPUINFO_PTR_CONTEXT:                  info->p = ppc;                           break;
806      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc);      break;
807      case CPUINFO_FCT_INIT:                     /* provided per-CPU */                     break;
808      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppcdrc);         break;
809      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppcdrc);            break;
810      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppcdrc);      break;
811      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ppcdrc);break;
812      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(ppcdrc);   break;
814813
815814      /* --- the following bits of info are returned as NULL-terminated strings --- */
816815      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
r3957r3958
41994198
42004199static CPU_GET_INFO( ppcdrc4xx )
42014200{
4202   powerpc_state *ppc = (device != NULL) ? *(powerpc_state **)device->token : NULL;
4201   powerpc_state *ppc = (device != NULL && device->token != NULL) ? *(powerpc_state **)device->token : NULL;
42034202   CPU_GET_INFO_CALL(ppcdrc);
42044203   ppc4xx_get_info(ppc, state, info);
42054204}
r3957r3958
42294228
42304229static CPU_INIT( ppc403ga )
42314230{
4232   ppcdrc_init(PPC_MODEL_403GA, PPCCAP_4XX, 1, device, index, clock, irqcallback);
4231   ppcdrc_init(PPC_MODEL_403GA, PPCCAP_4XX, 1, device, irqcallback);
42334232}
42344233
42354234
r3957r3958
42454244      /* --- the following bits of info are returned as 64-bit signed integers --- */
42464245
42474246      /* --- the following bits of info are returned as pointers to data or functions --- */
4248      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc403ga);            break;
4249      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc4xx);      break;
4247      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc403ga);            break;
4248      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc4xx);      break;
42504249
42514250      /* --- the following bits of info are returned as NULL-terminated strings --- */
42524251      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 403GA");      break;
r3957r3958
42684267
42694268static CPU_INIT( ppc403gcx )
42704269{
4271   ppcdrc_init(PPC_MODEL_403GCX, PPCCAP_4XX, 1, device, index, clock, irqcallback);
4270   ppcdrc_init(PPC_MODEL_403GCX, PPCCAP_4XX, 1, device, irqcallback);
42724271}
42734272
42744273
r3957r3958
42844283      /* --- the following bits of info are returned as 64-bit signed integers --- */
42854284
42864285      /* --- the following bits of info are returned as pointers to data or functions --- */
4287      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc403gcx);         break;
4288      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc4xx);      break;
4286      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc403gcx);         break;
4287      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppcdrc4xx);      break;
42894288
42904289      /* --- the following bits of info are returned as NULL-terminated strings --- */
42914290      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 403GCX");      break;
r3957r3958
43124311
43134312static CPU_INIT( ppc601 )
43144313{
4315   ppcdrc_init(PPC_MODEL_601, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 0/* no TB */, device, index, clock, irqcallback);
4314   ppcdrc_init(PPC_MODEL_601, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 0/* no TB */, device, irqcallback);
43164315}
43174316
43184317
r3957r3958
43284327      /* --- the following bits of info are returned as 64-bit signed integers --- */
43294328
43304329      /* --- the following bits of info are returned as pointers to data or functions --- */
4331      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc601);            break;
4330      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc601);            break;
43324331
43334332      /* --- the following bits of info are returned as NULL-terminated strings --- */
43344333      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 601");         break;
r3957r3958
43504349
43514350static CPU_INIT( ppc602 )
43524351{
4353   ppcdrc_init(PPC_MODEL_602, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, index, clock, irqcallback);
4352   ppcdrc_init(PPC_MODEL_602, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, irqcallback);
43544353}
43554354
43564355
r3957r3958
43664365      /* --- the following bits of info are returned as 64-bit signed integers --- */
43674366
43684367      /* --- the following bits of info are returned as pointers to data or functions --- */
4369      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc602);            break;
4368      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc602);            break;
43704369
43714370      /* --- the following bits of info are returned as NULL-terminated strings --- */
43724371      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 602");         break;
r3957r3958
43884387
43894388static CPU_INIT( ppc603 )
43904389{
4391   ppcdrc_init(PPC_MODEL_603, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, index, clock, irqcallback);
4390   ppcdrc_init(PPC_MODEL_603, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, irqcallback);
43924391}
43934392
43944393
r3957r3958
44044403      /* --- the following bits of info are returned as 64-bit signed integers --- */
44054404
44064405      /* --- the following bits of info are returned as pointers to data or functions --- */
4407      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc603);            break;
4406      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc603);            break;
44084407
44094408      /* --- the following bits of info are returned as NULL-terminated strings --- */
44104409      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 603");         break;
r3957r3958
44264425
44274426static CPU_INIT( ppc603e )
44284427{
4429   ppcdrc_init(PPC_MODEL_603E, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, index, clock, irqcallback);
4428   ppcdrc_init(PPC_MODEL_603E, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, irqcallback);
44304429}
44314430
44324431
r3957r3958
44424441      /* --- the following bits of info are returned as 64-bit signed integers --- */
44434442
44444443      /* --- the following bits of info are returned as pointers to data or functions --- */
4445      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc603e);            break;
4444      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc603e);            break;
44464445
44474446      /* --- the following bits of info are returned as NULL-terminated strings --- */
44484447      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 603e");      break;
r3957r3958
44644463
44654464static CPU_INIT( ppc603r )
44664465{
4467   ppcdrc_init(PPC_MODEL_603R, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, index, clock, irqcallback);
4466   ppcdrc_init(PPC_MODEL_603R, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED | PPCCAP_603_MMU, 4, device, irqcallback);
44684467}
44694468
44704469
r3957r3958
44804479      /* --- the following bits of info are returned as 64-bit signed integers --- */
44814480
44824481      /* --- the following bits of info are returned as pointers to data or functions --- */
4483      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc603r);            break;
4482      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc603r);            break;
44844483
44854484      /* --- the following bits of info are returned as NULL-terminated strings --- */
44864485      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 603R");      break;
r3957r3958
45024501
45034502static CPU_INIT( ppc604 )
45044503{
4505   ppcdrc_init(PPC_MODEL_604, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 4, device, index, clock, irqcallback);
4504   ppcdrc_init(PPC_MODEL_604, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 4, device, irqcallback);
45064505}
45074506
45084507
r3957r3958
45184517      /* --- the following bits of info are returned as 64-bit signed integers --- */
45194518
45204519      /* --- the following bits of info are returned as pointers to data or functions --- */
4521      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc604);            break;
4520      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc604);            break;
45224521
45234522      /* --- the following bits of info are returned as NULL-terminated strings --- */
45244523      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC 604");         break;
r3957r3958
45454544
45464545static CPU_INIT( mpc8240 )
45474546{
4548   ppcdrc_init(PPC_MODEL_MPC8240, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 4/* unknown */, device, index, clock, irqcallback);
4547   ppcdrc_init(PPC_MODEL_MPC8240, PPCCAP_OEA | PPCCAP_VEA | PPCCAP_FPU | PPCCAP_MISALIGNED, 4/* unknown */, device, irqcallback);
45494548}
45504549
45514550
r3957r3958
45614560      /* --- the following bits of info are returned as 64-bit signed integers --- */
45624561
45634562      /* --- the following bits of info are returned as pointers to data or functions --- */
4564      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(mpc8240);            break;
4563      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(mpc8240);            break;
45654564
45664565      /* --- the following bits of info are returned as NULL-terminated strings --- */
45674566      case CPUINFO_STR_NAME:                     strcpy(info->s, "PowerPC MPC8240");      break;
src/emu/cpu/powerpc/ppccom.c
r3957r3958
184184    structure based on the configured type
185185-------------------------------------------------*/
186186
187void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
187void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, cpu_irq_callback irqcallback)
188188{
189189   const powerpc_config *config = device->static_config;
190190
r3957r3958
194194   ppc->cap = cap;
195195   ppc->cache_line_size = 32;
196196   ppc->tb_divisor = tb_divisor;
197   ppc->cpu_clock = clock;
197   ppc->cpu_clock = device->clock;
198198   ppc->irq_callback = irqcallback;
199199   ppc->device = device;
200200   ppc->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
201   ppc->system_clock = (config != NULL) ? config->bus_frequency : clock;
202   ppc->tb_divisor = (ppc->tb_divisor * clock + ppc->system_clock / 2 - 1) / ppc->system_clock;
201   ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock;
202   ppc->tb_divisor = (ppc->tb_divisor * device->clock + ppc->system_clock / 2 - 1) / ppc->system_clock;
203203
204204   /* allocate the virtual TLB */
205205   ppc->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES);
r3957r3958
10891089      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
10901090      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
10911091
1092      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
1093      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1094      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1095      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1096      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = POWERPC_MIN_PAGE_SHIFT;break;
1092      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
1093      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1094      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1095      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 32;               break;
1096      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = POWERPC_MIN_PAGE_SHIFT;break;
10971097
10981098      case CPUINFO_INT_INPUT_STATE + PPC_IRQ:         info->i = ppc->irq_pending ? ASSERT_LINE : CLEAR_LINE; break;
10991099
r3957r3958
11561156      case CPUINFO_INT_REGISTER + PPC_R31:         info->i = ppc->r[31];               break;
11571157
11581158      /* --- the following bits of info are returned as pointers to data or functions --- */
1159      case CPUINFO_PTR_SET_INFO:                  /* provided by core */               break;
1160      case CPUINFO_PTR_INIT:                     /* provided by core */               break;
1161      case CPUINFO_PTR_RESET:                     /* provided by core */               break;
1162      case CPUINFO_PTR_EXIT:                     /* provided by core */               break;
1163      case CPUINFO_PTR_EXECUTE:                  /* provided by core */               break;
1164      case CPUINFO_PTR_TRANSLATE:                  /* provided by core */               break;
1165      case CPUINFO_PTR_DISASSEMBLE:               /* provided by core */               break;
1159      case CPUINFO_FCT_SET_INFO:                  /* provided by core */               break;
1160      case CPUINFO_FCT_INIT:                     /* provided by core */               break;
1161      case CPUINFO_FCT_RESET:                     /* provided by core */               break;
1162      case CPUINFO_FCT_EXIT:                     /* provided by core */               break;
1163      case CPUINFO_FCT_EXECUTE:                  /* provided by core */               break;
1164      case CPUINFO_FCT_TRANSLATE:                  /* provided by core */               break;
1165      case CPUINFO_FCT_DISASSEMBLE:               /* provided by core */               break;
11661166      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &ppc->icount;         break;
11671167
11681168      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
16561656      {
16571657         /* if we have a transmit handler, send it that way */
16581658         if (ppc->spu.tx_handler != NULL)
1659            (*ppc->spu.tx_handler)(ppc->spu.txbuf);
1659            (*ppc->spu.tx_handler)(ppc->device, ppc->spu.txbuf);
16601660
16611661         /* indicate that we have moved it to the shift register */
16621662         ppc->spu.regs[SPU4XX_LINE_STATUS] |= 0x04;
r3957r3958
17141714
17151715static READ8_HANDLER( ppc4xx_spu_r )
17161716{
1717   powerpc_state *ppc = cpu_get_info_ptr(space->cpu, CPUINFO_PTR_CONTEXT);
1717   powerpc_state *ppc = *(powerpc_state **)space->cpu->token;
17181718   UINT8 result = 0xff;
17191719
17201720   switch (offset)
r3957r3958
17411741
17421742static WRITE8_HANDLER( ppc4xx_spu_w )
17431743{
1744   powerpc_state *ppc = cpu_get_info_ptr(space->cpu, CPUINFO_PTR_CONTEXT);
1744   powerpc_state *ppc = *(powerpc_state **)space->cpu->token;
17451745   UINT8 oldstate, newstate;
17461746
17471747   if (PRINTF_SPU)
r3957r3958
18291829      case CPUINFO_INT_PPC_RX_DATA:               ppc4xx_spu_rx_data(ppc, info->i);               break;
18301830
18311831      /* --- the following bits of info are returned as pointers to data or functions --- */
1832      case CPUINFO_PTR_SPU_TX_HANDLER:            ppc->spu.tx_handler = (ppc4xx_spu_tx_handler)info->f; break;
1832      case CPUINFO_FCT_SPU_TX_HANDLER:            ppc->spu.tx_handler = (ppc4xx_spu_tx_handler)info->f; break;
18331833
18341834      /* --- everything else is handled generically --- */
18351835      default:                              ppccom_set_info(ppc, state, info);      break;
r3957r3958
18541854      case CPUINFO_INT_INPUT_STATE + PPC_IRQ_LINE_3:   info->i = ppc4xx_get_irq_line(ppc, PPC4XX_IRQ_BIT_EXT3);      break;
18551855      case CPUINFO_INT_INPUT_STATE + PPC_IRQ_LINE_4:   info->i = ppc4xx_get_irq_line(ppc, PPC4XX_IRQ_BIT_EXT4);      break;
18561856
1857      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1858      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 31;               break;
1859      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1860      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = POWERPC_MIN_PAGE_SHIFT;break;
1857      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1858      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 31;               break;
1859      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 32;               break;
1860      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = POWERPC_MIN_PAGE_SHIFT;break;
18611861
18621862      /* --- the following bits of info are returned as pointers to data or functions --- */
1863      case CPUINFO_PTR_INIT:                     /* provided per-CPU */               break;
1864      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_ppc4xx); break;
1863      case CPUINFO_FCT_INIT:                     /* provided per-CPU */               break;
1864      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(internal_ppc4xx); break;
18651865
18661866      /* --- everything else is handled generically --- */
18671867      default:                              ppccom_get_info(ppc, state, info);      break;
src/emu/cpu/powerpc/ppc.c
r3957r3958
18161816      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
18171817      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
18181818
1819      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1820      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1821      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1822      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1823      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1824      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1825      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1826      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1827      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1819      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1820      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1821      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1822      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1823      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1824      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1825      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1826      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1827      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
18281828
18291829      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
18301830
r3957r3958
18761876
18771877
18781878      /* --- the following bits of info are returned as pointers to data or functions --- */
1879      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1880      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ppc);         break;
1879      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1880      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(ppc);         break;
18811881      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &ppc_icount;            break;
18821882
18831883      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
19451945      case CPUINFO_INT_REGISTER + PPC_EXISR:         info->i = EXISR;                  break;
19461946
19471947      /* --- the following bits of info are returned as pointers to data or functions --- */
1948      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc403);      break;
1949      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc403);            break;
1950      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc403);            break;
1951      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppc403);            break;
1952      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc403);         break;
1948      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc403);      break;
1949      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc403);            break;
1950      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc403);            break;
1951      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppc403);            break;
1952      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc403);         break;
19531953
19541954      /* --- the following bits of info are returned as NULL-terminated strings --- */
19551955      case CPUINFO_STR_NAME:                     strcpy(info->s, "PPC403");            break;
19561956      case CPUINFO_STR_REGISTER + PPC_EXIER:         sprintf(info->s, "EXIER: %08X", EXIER); break;
19571957      case CPUINFO_STR_REGISTER + PPC_EXISR:         sprintf(info->s, "EXISR: %08X", EXISR); break;
19581958
1959      default:                              ppc_get_info(state, info);            break;
1959      default:                              CPU_GET_INFO_CALL(ppc);            break;
19601960   }
19611961}
19621962#endif
r3957r3958
19701970      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                     break;
19711971      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
19721972
1973      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
1974      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1975      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1976      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 17;               break;
1973      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
1974      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1975      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 32;               break;
1976      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = 17;               break;
19771977      case CPUINFO_INT_REGISTER + PPC_DEC:         info->i = read_decrementer();         break;
19781978
19791979      /* --- the following bits of info are returned as pointers to data or functions --- */
1980      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc603);      break;
1981      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc603);            break;
1982      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
1983      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppc603);            break;
1984      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
1985      case CPUINFO_PTR_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
1986      case CPUINFO_PTR_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
1987      case CPUINFO_PTR_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
1988      case CPUINFO_PTR_TRANSLATE:                  info->translate = ppc_translate_address_cb;   break;
1980      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc603);      break;
1981      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc603);            break;
1982      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
1983      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppc603);            break;
1984      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
1985      case CPUINFO_FCT_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
1986      case CPUINFO_FCT_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
1987      case CPUINFO_FCT_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
1988      case CPUINFO_FCT_TRANSLATE:                  info->translate = ppc_translate_address_cb;   break;
19891989
19901990      /* --- the following bits of info are returned as NULL-terminated strings --- */
19911991      case CPUINFO_STR_NAME:                     strcpy(info->s, "PPC603");            break;
19921992      case CPUINFO_STR_REGISTER + PPC_DEC:         sprintf(info->s, "DEC: %08X", read_decrementer()); break;
19931993
1994      default:                              ppc_get_info(state, info);            break;
1994      default:                              CPU_GET_INFO_CALL(ppc);            break;
19951995   }
19961996}
19971997#endif
r3957r3958
20222022      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
20232023      case CPUINFO_INT_REGISTER + PPC_IBR:         info->i = ppc.ibr;                  break;
20242024
2025      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
2026      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2025      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
2026      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
20272027
20282028      /* --- the following bits of info are returned as pointers to data or functions --- */
2029      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc602);      break;
2030      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc602);            break;
2031      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc602);            break;
2032      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppc602);            break;
2033      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc602);         break;
2034      case CPUINFO_PTR_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2035      case CPUINFO_PTR_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2036      case CPUINFO_PTR_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
2037      case CPUINFO_PTR_TRANSLATE:                  info->translate = ppc_translate_address_cb;   break;
2029      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc602);      break;
2030      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc602);            break;
2031      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc602);            break;
2032      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppc602);            break;
2033      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc602);         break;
2034      case CPUINFO_FCT_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2035      case CPUINFO_FCT_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2036      case CPUINFO_FCT_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
2037      case CPUINFO_FCT_TRANSLATE:                  info->translate = ppc_translate_address_cb;   break;
20382038
20392039      /* --- the following bits of info are returned as NULL-terminated strings --- */
20402040      case CPUINFO_STR_NAME:                     strcpy(info->s, "PPC602");            break;
20412041      case CPUINFO_STR_REGISTER + PPC_IBR:         sprintf(info->s, "IBR: %08X", ppc.ibr); break;
20422042
2043      default:                              ppc_get_info(state, info);            break;
2043      default:                              CPU_GET_INFO_CALL(ppc);            break;
20442044   }
20452045}
20462046#endif
r3957r3958
20692069      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                     break;
20702070      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
20712071
2072      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
2073      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2072      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
2073      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
20742074
20752075      /* --- the following bits of info are returned as pointers to data or functions --- */
2076      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mpc8240);      break;
2077      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(mpc8240);            break;
2078      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2079      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(mpc8240);            break;
2080      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2081      case CPUINFO_PTR_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2082      case CPUINFO_PTR_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2083      case CPUINFO_PTR_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
2076      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mpc8240);      break;
2077      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(mpc8240);            break;
2078      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2079      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(mpc8240);            break;
2080      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2081      case CPUINFO_FCT_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2082      case CPUINFO_FCT_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2083      case CPUINFO_FCT_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
20842084
20852085      /* --- the following bits of info are returned as NULL-terminated strings --- */
20862086      case CPUINFO_STR_NAME:                     strcpy(info->s, "MPC8240");            break;
20872087
2088      default:                              ppc_get_info(state, info);            break;
2088      default:                              CPU_GET_INFO_CALL(ppc);            break;
20892089   }
20902090}
20912091#endif
r3957r3958
21142114      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                     break;
21152115      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
21162116
2117      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
2118      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2117      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
2118      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
21192119
21202120      /* --- the following bits of info are returned as pointers to data or functions --- */
2121      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc601);      break;
2122      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc601);            break;
2123      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2124      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppc601);            break;
2125      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2126      case CPUINFO_PTR_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2127      case CPUINFO_PTR_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2128      case CPUINFO_PTR_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
2121      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc601);      break;
2122      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc601);            break;
2123      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2124      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppc601);            break;
2125      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2126      case CPUINFO_FCT_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2127      case CPUINFO_FCT_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2128      case CPUINFO_FCT_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
21292129
21302130      /* --- the following bits of info are returned as NULL-terminated strings --- */
21312131      case CPUINFO_STR_NAME:                     strcpy(info->s, "PPC601");            break;
21322132
2133      default:                              ppc_get_info(state, info);            break;
2133      default:                              CPU_GET_INFO_CALL(ppc);            break;
21342134   }
21352135}
21362136#endif
r3957r3958
21592159      case CPUINFO_INT_INPUT_LINES:               info->i = 5;                     break;
21602160      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
21612161
2162      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 64;               break;
2163      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2162      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 64;               break;
2163      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
21642164
21652165      /* --- the following bits of info are returned as pointers to data or functions --- */
2166      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc604);      break;
2167      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(ppc604);            break;
2168      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2169      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(ppc604);            break;
2170      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2171      case CPUINFO_PTR_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2172      case CPUINFO_PTR_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2173      case CPUINFO_PTR_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
2166      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(ppc604);      break;
2167      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(ppc604);            break;
2168      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(ppc603);            break;
2169      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(ppc604);            break;
2170      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ppc603);         break;
2171      case CPUINFO_FCT_READ:                     info->read = CPU_GET_READ_NAME(ppc);               break;
2172      case CPUINFO_FCT_WRITE:                     info->write = CPU_GET_WRITE_NAME(ppc);            break;
2173      case CPUINFO_FCT_READOP:                  info->readop = CPU_GET_READOP_NAME(ppc);            break;
21742174
21752175      /* --- the following bits of info are returned as NULL-terminated strings --- */
21762176      case CPUINFO_STR_NAME:                     strcpy(info->s, "PPC604");            break;
21772177
2178      default:                              ppc_get_info(state, info);            break;
2178      default:                              CPU_GET_INFO_CALL(ppc);            break;
21792179   }
21802180}
21812181#endif
src/emu/cpu/powerpc/ppccom.h
r3957r3958
572572    FUNCTION PROTOTYPES
573573***************************************************************************/
574574
575void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, int index, int clock, cpu_irq_callback irqcallback);
575void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_divisor, const device_config *device, cpu_irq_callback irqcallback);
576576void ppccom_exit(powerpc_state *ppc);
577577
578578void ppccom_reset(powerpc_state *ppc);
src/emu/cpu/powerpc/ppc.h
r3957r3958
114114
115115   CPUINFO_PTR_PPC_FASTRAM_BASE = CPUINFO_PTR_CPU_SPECIFIC,
116116
117   CPUINFO_PTR_SPU_TX_HANDLER,
118
119   CPUINFO_PTR_CONTEXT         /* temporary */
117   CPUINFO_FCT_SPU_TX_HANDLER = CPUINFO_FCT_CPU_SPECIFIC
120118};
121119
122120
r3957r3958
136134    STRUCTURES AND TYPEDEFS
137135***************************************************************************/
138136
139typedef void (*ppc4xx_spu_tx_handler)(UINT8 data);
137typedef void (*ppc4xx_spu_tx_handler)(const device_config *device, UINT8 data);
140138
141139typedef struct _powerpc_config powerpc_config;
142140struct _powerpc_config
r3957r3958
152150
153151#if (HAS_PPC403GA)
154152CPU_GET_INFO( ppc403ga );
153#define CPU_PPC403GA CPU_GET_INFO_NAME( ppc403ga )
155154#endif
156155
157156#if (HAS_PPC403GCX)
158157CPU_GET_INFO( ppc403gcx );
158#define CPU_PPC403GCX CPU_GET_INFO_NAME( ppc403gcx )
159159#endif
160160
161161#if (HAS_PPC601)
162162CPU_GET_INFO( ppc601 );
163#define CPU_PPC601 CPU_GET_INFO_NAME( ppc601 )
163164#endif
164165
165166#if (HAS_PPC602)
166167CPU_GET_INFO( ppc602 );
168#define CPU_PPC602 CPU_GET_INFO_NAME( ppc602 )
167169#endif
168170
169171#if (HAS_PPC603)
170172CPU_GET_INFO( ppc603 );
173#define CPU_PPC603 CPU_GET_INFO_NAME( ppc603 )
171174#endif
172175
173176#if (HAS_PPC603E)
174177CPU_GET_INFO( ppc603e );
178#define CPU_PPC603E CPU_GET_INFO_NAME( ppc603e )
175179#endif
176180
177181#if (HAS_PPC603R)
178182CPU_GET_INFO( ppc603r );
183#define CPU_PPC603R CPU_GET_INFO_NAME( ppc603r )
179184#endif
180185
181186#if (HAS_PPC604)
182187CPU_GET_INFO( ppc604 );
188#define CPU_PPC604 CPU_GET_INFO_NAME( ppc604 )
183189#endif
184190
185191#if (HAS_MPC8240)
186192CPU_GET_INFO( mpc8240 );
193#define CPU_MPC8240 CPU_GET_INFO_NAME( mpc8240 )
187194#endif
188195
189196
r3957r3958
194201
195202INLINE void ppc4xx_spu_set_tx_handler(const device_config *cpu, ppc4xx_spu_tx_handler handler)
196203{
197   cpu_set_info_fct(cpu, CPUINFO_PTR_SPU_TX_HANDLER, (genf *)handler);
204   device_set_info_fct(cpu, CPUINFO_FCT_SPU_TX_HANDLER, (genf *)handler);
198205}
199206
200207
201208INLINE void ppc4xx_spu_receive_byte(const device_config *cpu, UINT8 byteval)
202209{
203   cpu_set_info_int(cpu, CPUINFO_INT_PPC_RX_DATA, byteval);
210   device_set_info_int(cpu, CPUINFO_INT_PPC_RX_DATA, byteval);
204211}
205212
206213
src/emu/cpu/arm/arm.c
r3957r3958
14591459      case CPUINFO_INT_MIN_CYCLES:               info->i = 3;                     break;
14601460      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
14611461
1462      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1463      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 26;               break;
1464      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1465      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1466      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1467      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1468      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1469      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1470      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1462      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1463      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 26;               break;
1464      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1465      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1466      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1467      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1468      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1469      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1470      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
14711471
14721472      case CPUINFO_INT_INPUT_STATE + ARM_IRQ_LINE:   info->i = cpustate->pendingIrq;         break;
14731473      case CPUINFO_INT_INPUT_STATE + ARM_FIRQ_LINE:   info->i = cpustate->pendingFiq;         break;
r3957r3958
15071507      case CPUINFO_INT_REGISTER + ARM32_SR14:         info->i = cpustate->sArmRegister[eR14_SVC];   break;
15081508
15091509      /* --- the following bits of info are returned as pointers to data or functions --- */
1510      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(arm);         break;
1511      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(arm);            break;
1512      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(arm);            break;
1513      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(arm);            break;
1514      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(arm);         break;
1515      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1516      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(arm);   break;
1510      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(arm);         break;
1511      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(arm);            break;
1512      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(arm);            break;
1513      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(arm);            break;
1514      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(arm);         break;
1515      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1516      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(arm);   break;
15171517      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
15181518
15191519      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/arm/arm.h
r3957r3958
1717 ***************************************************************************************************/
1818
1919extern CPU_GET_INFO( arm );
20#define CPU_ARM CPU_GET_INFO_NAME( arm )
2021
2122extern UINT32 arm_disasm(char *pBuf, UINT32 pc, UINT32 opcode);
2223
src/emu/cpu/lr35902/lr35902.c
r3957r3958
422422   case CPUINFO_INT_MIN_CYCLES:               info->i = 1;   /* right? */         break;
423423   case CPUINFO_INT_MAX_CYCLES:               info->i = 16;   /* right? */         break;
424424
425   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
426   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
427   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
428   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
429   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
430   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
431   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
432   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
433   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
425   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
426   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
427   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
428   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
429   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
430   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
431   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
432   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
433   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
434434
435435   case CPUINFO_INT_SP:                     info->i = cpustate->w.SP;               break;
436436   case CPUINFO_INT_PC:                     info->i = cpustate->w.PC;               break;
r3957r3958
453453   case CPUINFO_INT_REGISTER + LR35902_SPEED:      info->i = 0x7E | ( ( cpustate->w.gb_speed - 1 ) << 7 ) | cpustate->w.gb_speed_change_pending; break;
454454
455455   /* --- the following bits of info are returned as pointers to data or functions --- */
456   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(lr35902);      break;
457   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(lr35902);            break;
458   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(lr35902);         break;
459   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(lr35902);      break;
460   case CPUINFO_PTR_BURN:                     info->burn = CPU_BURN_NAME(lr35902);            break;
461   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(lr35902);      break;
456   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(lr35902);      break;
457   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(lr35902);            break;
458   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(lr35902);         break;
459   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(lr35902);      break;
460   case CPUINFO_FCT_BURN:                     info->burn = CPU_BURN_NAME(lr35902);            break;
461   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(lr35902);      break;
462462   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->w.icount;         break;
463463
464464   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/lr35902/lr35902.h
r3957r3958
3131/* Return register contents                                                 */
3232/****************************************************************************/
3333extern CPU_GET_INFO( lr35902 );
34#define CPU_LR35902 CPU_GET_INFO_NAME( lr35902 )
3435
3536extern CPU_DISASSEMBLE( lr35902 );
3637
src/emu/cpu/z8000/z8000.c
r3957r3958
523523      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
524524      case CPUINFO_INT_MAX_CYCLES:               info->i = 744;                     break;
525525
526      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
527      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
528      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
529      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
530      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
531      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
532      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
533      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
534      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
526      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
527      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
528      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
529      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
530      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
531      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
532      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
533      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
534      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
535535
536536      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_state;               break;
537537      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_state[0];            break;
r3957r3958
567567      case CPUINFO_INT_REGISTER + Z8000_R15:         info->i = cpustate->RW(15);                  break;
568568
569569      /* --- the following bits of info are returned as pointers to data or functions --- */
570      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(z8000);      break;
571      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(z8000);            break;
572      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(z8000);         break;
573      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(z8000);            break;
574      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(z8000);      break;
575      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
576      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(z8000);break;
570      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(z8000);      break;
571      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(z8000);            break;
572      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(z8000);         break;
573      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(z8000);            break;
574      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(z8000);      break;
575      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
576      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(z8000);break;
577577      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
578578
579579      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/z8000/z8000.h
r3957r3958
2626
2727/* PUBLIC FUNCTIONS */
2828extern CPU_GET_INFO( z8000 );
29#define CPU_Z8000 CPU_GET_INFO_NAME( z8000 )
2930
3031CPU_DISASSEMBLE( z8000 );
3132
src/emu/cpu/vtlb.c
r3957r3958
7070   vtlb->fixed = fixed_entries;
7171   vtlb->pageshift = cpu_get_page_shift(cpu, space);
7272   vtlb->addrwidth = cpu_get_logaddr_width(cpu, space);
73   vtlb->translate = (cpu_translate_func)cpu_get_info_fct(cpu, CPUINFO_PTR_TRANSLATE);
73   vtlb->translate = (cpu_translate_func)device_get_info_fct(cpu, CPUINFO_FCT_TRANSLATE);
7474
7575   /* validate CPU information */
7676   assert((1 << vtlb->pageshift) > VTLB_FLAGS_MASK);
src/emu/cpu/tms32010/tms32010.h
r3957r3958
5252 */
5353
5454CPU_GET_INFO( tms32010 );
55#define CPU_TMS32010 CPU_GET_INFO_NAME( tms32010 )
5556
5657
57
58/****************************************************************************
59 *  Read the state of the BIO pin
60 */
61
62#define TMS32010_BIO_In (memory_read_word_16be(cpustate->io, TMS32010_BIO<<1))
63
64
65/****************************************************************************
66 *  Input a word from given I/O port
67 */
68
69#define TMS32010_In(Port) (memory_read_word_16be(cpustate->io, (Port)<<1))
70
71
72/****************************************************************************
73 *  Output a word to given I/O port
74 */
75
76#define TMS32010_Out(Port,Value) (memory_write_word_16be(cpustate->io, (Port)<<1,Value))
77
78
79
80/****************************************************************************
81 *  Read a word from given ROM memory location
82 */
83
84#define TMS32010_ROM_RDMEM(A) (memory_read_word_16be(cpustate->program, (A)<<1))
85
86
87/****************************************************************************
88 *  Write a word to given ROM memory location
89 */
90
91#define TMS32010_ROM_WRMEM(A,V) (memory_write_word_16be(cpustate->program, (A)<<1,V))
92
93
94
95/****************************************************************************
96 *  Read a word from given RAM memory location
97 */
98
99#define TMS32010_RAM_RDMEM(A) (memory_read_word_16be(cpustate->data, (A)<<1))
100
101
102/****************************************************************************
103 *  Write a word to given RAM memory location
104 */
105
106#define TMS32010_RAM_WRMEM(A,V) (memory_write_word_16be(cpustate->data, (A)<<1,V))
107
108
109
110/****************************************************************************
111 *  TMS32010_RDOP() is identical to TMS32010_RDMEM() except it is used for reading
112 *  opcodes. In case of system with memory mapped I/O, this function can be
113 *  used to greatly speed up emulation
114 */
115
116#define TMS32010_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
117
118
119/****************************************************************************
120 *  TMS32010_RDOP_ARG() is identical to TMS32010_RDOP() except it is used
121 *  for reading opcode arguments. This difference can be used to support systems
122 *  that use different encoding mechanisms for opcodes and opcode arguments
123 */
124
125#define TMS32010_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))
126
127
128
12958CPU_DISASSEMBLE( tms32010 );
13059
13160#endif   /* __TMS32010_H__ */
src/emu/cpu/tms32010/tms32010.c
r3957r3958
138138
139139
140140
141/****************************************************************************
142 *  Read the state of the BIO pin
143 */
141144
145#define TMS32010_BIO_In (memory_read_word_16be(cpustate->io, TMS32010_BIO<<1))
146
147
148/****************************************************************************
149 *  Input a word from given I/O port
150 */
151
152#define TMS32010_In(Port) (memory_read_word_16be(cpustate->io, (Port)<<1))
153
154
155/****************************************************************************
156 *  Output a word to given I/O port
157 */
158
159#define TMS32010_Out(Port,Value) (memory_write_word_16be(cpustate->io, (Port)<<1,Value))
160
161
162
163/****************************************************************************
164 *  Read a word from given ROM memory location
165 */
166
167#define TMS32010_ROM_RDMEM(A) (memory_read_word_16be(cpustate->program, (A)<<1))
168
169
170/****************************************************************************
171 *  Write a word to given ROM memory location
172 */
173
174#define TMS32010_ROM_WRMEM(A,V) (memory_write_word_16be(cpustate->program, (A)<<1,V))
175
176
177
178/****************************************************************************
179 *  Read a word from given RAM memory location
180 */
181
182#define TMS32010_RAM_RDMEM(A) (memory_read_word_16be(cpustate->data, (A)<<1))
183
184
185/****************************************************************************
186 *  Write a word to given RAM memory location
187 */
188
189#define TMS32010_RAM_WRMEM(A,V) (memory_write_word_16be(cpustate->data, (A)<<1,V))
190
191
192
193/****************************************************************************
194 *  TMS32010_RDOP() is identical to TMS32010_RDMEM() except it is used for reading
195 *  opcodes. In case of system with memory mapped I/O, this function can be
196 *  used to greatly speed up emulation
197 */
198
199#define TMS32010_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
200
201
202/****************************************************************************
203 *  TMS32010_RDOP_ARG() is identical to TMS32010_RDOP() except it is used
204 *  for reading opcode arguments. This difference can be used to support systems
205 *  that use different encoding mechanisms for opcodes and opcode arguments
206 */
207
208#define TMS32010_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))
209
210
142211/************************************************************************
143212 *  Shortcuts
144213 ************************************************************************/
r3957r3958
886955      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
887956      case CPUINFO_INT_MAX_CYCLES:               info->i = 3;                     break;
888957
889      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
890      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 12;               break;
891      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
892      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;               break;
893      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 8;               break;
894      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;               break;
895      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
896      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 5;               break;
897      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = -1;               break;
958      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
959      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 12;               break;
960      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
961      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 16;               break;
962      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 8;               break;
963      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -1;               break;
964      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
965      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 5;               break;
966      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = -1;               break;
898967
899968      case CPUINFO_INT_INPUT_STATE + 0:            info->i = (cpustate->INTF & TMS32010_INT_PENDING) ? ASSERT_LINE : CLEAR_LINE;   break;
900969
r3957r3958
913982      case CPUINFO_INT_REGISTER + TMS32010_AR1:       info->i = cpustate->AR[1];            break;
914983
915984      /* --- the following bits of info are returned as pointers to data or functions --- */
916      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32010);      break;
917      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms32010);            break;
918      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms32010);            break;
919      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms32010);            break;
920      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32010);         break;
921      case CPUINFO_PTR_BURN:                     info->burn = NULL;                           break;
922      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32010);   break;
985      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32010);      break;
986      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tms32010);            break;
987      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms32010);            break;
988      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(tms32010);            break;
989      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32010);         break;
990      case CPUINFO_FCT_BURN:                     info->burn = NULL;                           break;
991      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32010);   break;
923992      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;               break;
924      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:   info->internal_map16 = ADDRESS_MAP_NAME(tms32010_ram); break;
993      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:   info->internal_map16 = ADDRESS_MAP_NAME(tms32010_ram); break;
925994
926995      /* --- the following bits of info are returned as NULL-terminated strings --- */
927996      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS32010");               break;
src/emu/cpu/sh2/sh2comn.h
r3957r3958
174174TIMER_CALLBACK( sh2_timer_callback );
175175TIMER_CALLBACK( sh2_dmac_callback );
176176
177void sh2_common_init(SH2 *sh2, const device_config *device, int index, int clock, cpu_irq_callback irqcallback);
177void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irqcallback);
178178void sh2_recalc_irq(SH2 *sh2);
179179void sh2_set_irq_line(SH2 *sh2, int irqline, int state);
180180void sh2_set_frt_input(const device_config *device, int state);
src/emu/cpu/sh2/sh2.h
r3957r3958
9292  int  (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size);
9393};
9494
95extern CPU_GET_INFO( sh1 );
9596extern CPU_GET_INFO( sh2 );
9697
98#define CPU_SH1 CPU_GET_INFO_NAME( sh1 )
99#define CPU_SH2 CPU_GET_INFO_NAME( sh2 )
100
97101WRITE32_HANDLER( sh2_internal_w );
98102READ32_HANDLER( sh2_internal_r );
99103
src/emu/cpu/sh2/sh2drc.c
r3957r3958
685685   memset(sh2, 0, sizeof(SH2));
686686
687687   /* initialize the common core parts */
688   sh2_common_init(sh2, device, index, clock, irqcallback);
688   sh2_common_init(sh2, device, irqcallback);
689689
690690   /* allocate the implementation-specific state from the full cache */
691691   sh2->cache = cache;
r3957r3958
34013401
34023402CPU_GET_INFO( sh2 )
34033403{
3404   SH2 *sh2 = (device != NULL) ? *(SH2 **)device->token : NULL;
3404   SH2 *sh2 = (device != NULL && device->token != NULL) ? *(SH2 **)device->token : NULL;
34053405   switch (state)
34063406   {
34073407      /* --- the following bits of info are returned as 64-bit signed integers --- */
r3957r3958
34163416      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
34173417      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
34183418
3419      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
3420      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
3421      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
3422      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
3423      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
3424      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
3425      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
3426      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
3427      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
3419      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
3420      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
3421      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
3422      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
3423      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
3424      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
3425      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
3426      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
3427      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
34283428
34293429      // Internal maps
3430      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(sh2_internal_map); break;
3431      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map32 = NULL;   break;
3432      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map32 = NULL;   break;
3430      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(sh2_internal_map); break;
3431      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map32 = NULL;   break;
3432      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map32 = NULL;   break;
34333433
34343434      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLIN:   info->i = sh2->irq_line_state[SH2_INT_VBLIN]; break;
34353435      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLOUT:   info->i = sh2->irq_line_state[SH2_INT_VBLOUT]; break;
r3957r3958
34803480      case CPUINFO_INT_REGISTER + SH2_EA:            info->i = sh2->ea;                  break;
34813481
34823482      /* --- the following bits of info are returned as pointers to data or functions --- */
3483      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh2);         break;
3484      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(sh2);               break;
3485      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(sh2);            break;
3486      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(sh2);               break;
3487      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh2);         break;
3488      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
3489      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh2);         break;
3483      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh2);         break;
3484      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(sh2);               break;
3485      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(sh2);            break;
3486      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(sh2);               break;
3487      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh2);         break;
3488      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
3489      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh2);         break;
34903490      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &sh2->icount;            break;
34913491
34923492      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
35453545   switch (state)
35463546   {
35473547      /* --- the following bits of info are returned as pointers to data or functions --- */
3548      case CPUINFO_PTR_RESET:                  info->reset = CPU_RESET_NAME(sh1);            break;
3548      case CPUINFO_FCT_RESET:                  info->reset = CPU_RESET_NAME(sh1);            break;
35493549
35503550      /* --- the following bits of info are returned as NULL-terminated strings --- */
35513551      case CPUINFO_STR_NAME:                      strcpy(info->s, "SH-1");            break;
src/emu/cpu/sh2/sh2comn.c
r3957r3958
104104         sh2->frc_base = cpu_get_total_cycles(sh2->device);
105105         timer_adjust_oneshot(sh2->timer, cpu_clocks_to_attotime(sh2->device, max_delta), 0);
106106      } else {
107         logerror("SH2.%d: Timer event in %d cycles of external clock", cpu_get_index(sh2->device), max_delta);
107         logerror("SH2.%s: Timer event in %d cycles of external clock", sh2->device->tag, max_delta);
108108      }
109109   }
110110}
r3957r3958
141141   int dma = param & 1;
142142   SH2 *sh2 = ptr;
143143
144   LOG(("SH2.%d: DMA %d complete\n", cpu_get_index(sh2->device), dma));
144   LOG(("SH2.%s: DMA %d complete\n", sh2->device->tag, dma));
145145   sh2->m[0x63+4*dma] |= 2;
146146   sh2->dma_timer_active[dma] = 0;
147147   sh2_recalc_irq(sh2);
r3957r3958
309309   case 0x04: // TIER, FTCSR, FRC
310310      if((mem_mask & 0x00ffffff) != 0)
311311         sh2_timer_resync(sh2);
312//      printf("SH2.%d: TIER write %04x @ %04x\n", cpu_get_index(sh2->device), data >> 16, mem_mask>>16);
312//      printf("SH2.%s: TIER write %04x @ %04x\n", sh2->device->tag, data >> 16, mem_mask>>16);
313313      sh2->m[4] = (sh2->m[4] & ~(ICF|OCFA|OCFB|OVF)) | (old & sh2->m[4] & (ICF|OCFA|OCFB|OVF));
314314      COMBINE_DATA(&sh2->frc);
315315      if((mem_mask & 0x00ffffff) != 0)
r3957r3958
317317      sh2_recalc_irq(sh2);
318318      break;
319319   case 0x05: // OCRx, TCR, TOCR
320//      printf("SH2.%d: TCR write %08x @ %08x\n", cpu_get_index(sh2->device), data, mem_mask);
320//      printf("SH2.%s: TCR write %08x @ %08x\n", sh2->device->tag, data, mem_mask);
321321      sh2_timer_resync(sh2);
322322      if(sh2->m[5] & 0x10)
323323         sh2->ocrb = (sh2->ocrb & (~mem_mask >> 16)) | ((data & mem_mask) >> 16);
r3957r3958
533533   sh2_timer_resync(sh2);
534534   sh2->icr = sh2->frc;
535535   sh2->m[4] |= ICF;
536   logerror("SH2.%d: ICF activated (%x)\n", cpu_get_index(sh2->device), sh2->pc & AM);
536   logerror("SH2.%s: ICF activated (%x)\n", sh2->device->tag, sh2->pc & AM);
537537   sh2_recalc_irq(sh2);
538538}
539539
r3957r3958
696696   #endif
697697}
698698
699void sh2_common_init(SH2 *sh2, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
699void sh2_common_init(SH2 *sh2, const device_config *device, cpu_irq_callback irqcallback)
700700{
701701   const sh2_cpu_core *conf = device->static_config;
702702
src/emu/cpu/sh2/sh2.c
r3957r3958
22512251   memset(sh2, 0, sizeof(SH2));
22522252
22532253   /* initialize the common core parts */
2254   sh2_common_init(sh2, device, index, clock, irqcallback);
2254   sh2_common_init(sh2, device, irqcallback);
22552255}
22562256
22572257/**************************************************************************
r3957r3958
23382338      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
23392339      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
23402340
2341      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
2342      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
2343      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2344      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2345      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2346      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2347      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
2348      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
2349      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2341      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
2342      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
2343      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
2344      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
2345      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
2346      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
2347      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
2348      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
2349      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
23502350
23512351      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLIN:   info->i = sh2->irq_line_state[SH2_INT_VBLIN]; break;
23522352      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLOUT:   info->i = sh2->irq_line_state[SH2_INT_VBLOUT]; break;
r3957r3958
23972397      case CPUINFO_INT_REGISTER + SH2_EA:            info->i = sh2->ea;                  break;
23982398
23992399      /* --- the following bits of info are returned as pointers to data or functions --- */
2400      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh2);         break;
2401      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(sh2);               break;
2402      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(sh2);            break;
2403      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh2);         break;
2404      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2405      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh2);         break;
2400      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh2);         break;
2401      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(sh2);               break;
2402      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(sh2);            break;
2403      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh2);         break;
2404      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2405      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh2);         break;
24062406      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &sh2_icount;            break;
24072407
24082408      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
24562456   switch (state)
24572457   {
24582458      /* --- the following bits of info are returned as pointers to data or functions --- */
2459      case CPUINFO_PTR_RESET:                  info->reset = CPU_RESET_NAME(sh1);            break;
2459      case CPUINFO_FCT_RESET:                  info->reset = CPU_RESET_NAME(sh1);            break;
24602460
24612461      /* --- the following bits of info are returned as NULL-terminated strings --- */
24622462      case CPUINFO_STR_NAME:                      strcpy(info->s, "SH-1");            break;
24632463
2464      default:                     sh2_get_info(state, info);         break;
2464      default:                     CPU_GET_INFO_CALL(sh2);         break;
24652465   }
24662466}
24672467
src/emu/cpu/sm8500/sm8500.h
r3957r3958
66#include "cpuintrf.h"
77
88typedef struct {
9   void (*handle_dma)(int cycles);
10   void (*handle_timers)(int cycles);
9   void (*handle_dma)(const device_config *device, int cycles);
10   void (*handle_timers)(const device_config *device, int cycles);
1111} SM8500_CONFIG;
1212
1313/* interrupts */
r3957r3958
2525
2626enum
2727{
28   CPUINFO_PTR_SM8500_INTERNAL_RAM = CPUINFO_PTR_CPU_SPECIFIC
29};
30
31
32enum
33{
2834   /* "main" 16 bit register */
2935        SM8500_PC=1, SM8500_SP, SM8500_PS, SM8500_SYS16, SM8500_RR0, SM8500_RR2, SM8500_RR4, SM8500_RR6, SM8500_RR8, SM8500_RR10,
3036   SM8500_RR12, SM8500_RR14,
r3957r3958
3339   SM8500_SPH, SM8500_SPL, SM8500_PS0, SM8500_PS1, SM8500_P0C, SM8500_P1C, SM8500_P2C, SM8500_P3C,
3440};
3541
36extern UINT8* sm8500_internal_ram( void ) ;
37extern unsigned sm8500_get_reg( int regnum );
3842extern CPU_GET_INFO( sm8500 );
43#define CPU_SM8500 CPU_GET_INFO_NAME( sm8500 )
3944
40UINT8 sm85cpu_mem_readbyte( UINT32 offset );
41void sm85cpu_mem_writebyte( UINT32 offset, UINT8 data );
42
43INLINE UINT16 sm85cpu_mem_readword( UINT32 address )
44{
45   UINT16 value = (UINT16) sm85cpu_mem_readbyte( address ) << 8;
46   value |= sm85cpu_mem_readbyte( ( address + 1 ) & 0xffff );
47   return value;
48}
49
50INLINE void sm85cpu_mem_writeword( UINT32 address, UINT16 value )
51{
52   sm85cpu_mem_writebyte( address, value >> 8 );
53   sm85cpu_mem_writebyte( ( address + 1 ) & 0xffff, value & 0xff );
54}
55
5645extern CPU_DISASSEMBLE( sm8500 );
5746
5847#endif /* __SM8500_H__ */
src/emu/cpu/sm8500/sm85ops.h
r3957r3958
11
2#define ARG_R   r1 = sm85cpu_mem_readbyte( regs.PC++ );
2#define ARG_R   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
33
4#define ARG_RR   r2 = sm85cpu_mem_readbyte( regs.PC++ ); \
5      r1 = sm85cpu_mem_readbyte( regs.PC++ );
4#define ARG_RR   r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
5      r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
66
77#define ARG_rR   r1 = op & 0x07; \
8      r2 = sm85cpu_mem_readbyte( regs.PC++ );
8      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
99
10#define ARG_iR   r2 = sm85cpu_mem_readbyte( regs.PC++ ); \
11      r1 = sm85cpu_mem_readbyte( regs.PC++ );
10#define ARG_iR   r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
11      r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
1212
13#define ARG_Sw   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
14      s2 = sm85cpu_mem_readword( regs.PC ); regs.PC += 2;
13#define ARG_Sw   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
14      s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); cpustate->PC += 2;
1515
1616#define ARG_rrw   r1 = sm8500_b2w[op & 0x07]; \
17      s2 = sm85cpu_mem_readword( regs.PC ); regs.PC += 2;
17      s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); cpustate->PC += 2;
1818
1919#define ARG_ri   r1 = op & 0x07; \
20      r2 = sm85cpu_mem_readbyte( regs.PC++ );
20      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
2121
2222#define ARG_pi   r1 = 0x10 + ( op & 0x07 ); \
23      r2 = sm85cpu_mem_readbyte( regs.PC++ );
23      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
2424
25#define ARG_rmb r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
25#define ARG_rmb r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
2626      s2 = 0; \
2727      switch( r1 & 0xC0 ) { \
2828      case 0x00: \
29         s2 = sm85cpu_mem_readbyte( r1 & 0x07 ); \
29         s2 = sm85cpu_mem_readbyte( cpustate, r1 & 0x07 ); \
3030         break; \
3131      case 0x40: \
32         s2 = sm85cpu_mem_readbyte( r1 & 0x07 ); \
33         sm85cpu_mem_writebyte( r1 & 0x07, s2 + 1 ); \
32         s2 = sm85cpu_mem_readbyte( cpustate, r1 & 0x07 ); \
33         sm85cpu_mem_writebyte( cpustate, r1 & 0x07, s2 + 1 ); \
3434         break; \
3535      case 0x80: \
36         s2 = sm85cpu_mem_readbyte( regs.PC++ ); \
36         s2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
3737         if ( r1 & 0x07 ) { \
38            s2 = s2 + sm85cpu_mem_readbyte( r1 & 0x07 ); \
38            s2 = s2 + sm85cpu_mem_readbyte( cpustate, r1 & 0x07 ); \
3939         } \
4040         break; \
4141      case 0xC0: \
42         s2 = sm85cpu_mem_readbyte( r1 & 0x07 ); \
43         sm85cpu_mem_writebyte( r1 & 0x07, s2 - 1 ); \
42         s2 = sm85cpu_mem_readbyte( cpustate, r1 & 0x07 ); \
43         sm85cpu_mem_writebyte( cpustate, r1 & 0x07, s2 - 1 ); \
4444         break; \
4545      } \
4646      r2 = r1; \
4747      r1 = ( r1 >> 3 ) & 0x07;
4848
49#define ARG_rmw   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
49#define ARG_rmw   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
5050      s2 = 0; \
5151      switch( r1 & 0xC0 ) { \
5252      case 0x00: \
53         s2 = sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
53         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
5454         break; \
5555      case 0x40: \
56         s2 = sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
57         sm85cpu_mem_writeword( sm8500_b2w[r1 & 0x07], s2 + 1 ); \
56         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
57         sm85cpu_mem_writeword( cpustate, sm8500_b2w[r1 & 0x07], s2 + 1 ); \
5858         break; \
5959      case 0x80: \
60         s2 = sm85cpu_mem_readword( regs.PC ); regs.PC += 2; \
60         s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); cpustate->PC += 2; \
6161         if ( r1 & 0x07 ) { \
62            s2 = s2 + sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
62            s2 = s2 + sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
6363         } \
6464         break; \
6565      case 0xC0: \
66         s2 = sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
67         sm85cpu_mem_writeword( sm8500_b2w[r1 & 0x07], s2 - 1 ); \
66         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
67         sm85cpu_mem_writeword( cpustate, sm8500_b2w[r1 & 0x07], s2 - 1 ); \
6868         break; \
6969      } \
7070      r2 = r1; \
7171      r1 = ( r1 >> 3 ) & 0x07;
7272
73#define ARG_smw   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
73#define ARG_smw   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
7474      s2 = 0; \
7575      switch( r1 & 0xC0 ) { \
7676      case 0x00: \
77         s2 = sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
77         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
7878         break; \
7979      case 0x40: \
80         s2 = sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
81         sm85cpu_mem_writeword( sm8500_b2w[r1 & 0x07], s2 + 1 ); \
80         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
81         sm85cpu_mem_writeword( cpustate, sm8500_b2w[r1 & 0x07], s2 + 1 ); \
8282         break; \
8383      case 0x80: \
84         s2 = sm85cpu_mem_readword( regs.PC ); regs.PC += 2; \
84         s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); cpustate->PC += 2; \
8585         if ( r1 & 0x07 ) { \
86            s2 = s2 + sm85cpu_mem_readword( sm8500_b2w[r1 & 0x07] ); \
86            s2 = s2 + sm85cpu_mem_readword( cpustate, sm8500_b2w[r1 & 0x07] ); \
8787         } \
8888         break; \
8989      case 0xC0: \
90         s2 = sm85cpu_mem_readword( sm8500_b2w[ r1 & 0x07] ); \
91         sm85cpu_mem_writeword( sm8500_b2w[r1 & 0x07], s2 - 1 ); \
90         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[ r1 & 0x07] ); \
91         sm85cpu_mem_writeword( cpustate, sm8500_b2w[r1 & 0x07], s2 - 1 ); \
9292         break; \
9393      } \
9494      r2 = r1; \
9595      r1 = sm8500_b2w[ ( r1 >> 3 ) & 0x07 ];
9696
97#define ARG_d8   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
98      s2 = regs.PC + ((INT8)r1);
97#define ARG_d8   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
98      s2 = cpustate->PC + ((INT8)r1);
9999
100#define ARG_Rbr   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
101      r2 = sm85cpu_mem_readbyte( regs.PC++ ); \
102      s2 = regs.PC + ((INT8)r2);
100#define ARG_Rbr   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
101      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
102      s2 = cpustate->PC + ((INT8)r2);
103103
104#define ARG_ad16   s2 = sm85cpu_mem_readword( regs.PC ); \
105         regs.PC += 2;
104#define ARG_ad16   s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); \
105         cpustate->PC += 2;
106106
107#define ARG_rr   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
107#define ARG_rr   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
108108      r2 = 0x00; \
109109      switch( r1 & 0xC0 ) { \
110110      case 0x00: \
r3957r3958
117117         break; \
118118      }
119119
120#define ARG_ss   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
120#define ARG_ss   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
121121      r2 = 0x00; \
122122      switch( r1 & 0xC0 ) { \
123123      case 0x00: \
r3957r3958
130130         break; \
131131      }
132132
133#define ARG_2   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
133#define ARG_2   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
134134      s2 = 0; \
135135      switch( r1 & 0xC0 ) { \
136136      case 0x00: \
137         s2 = sm85cpu_mem_readword( sm8500_b2w[ r1 & 0x07 ] ); \
137         s2 = sm85cpu_mem_readword( cpustate, sm8500_b2w[ r1 & 0x07 ] ); \
138138         break; \
139139      case 0x40: \
140         s2 = sm85cpu_mem_readword( regs.PC ); regs.PC += 2; \
140         s2 = sm85cpu_mem_readword( cpustate, cpustate->PC ); cpustate->PC += 2; \
141141         if ( r1 & 0x38 ) { \
142            s2 = s2 + sm85cpu_mem_readbyte( ( r1 >> 3 ) & 0x07 ); \
142            s2 = s2 + sm85cpu_mem_readbyte( cpustate, ( r1 >> 3 ) & 0x07 ); \
143143         }  \
144         s2 = sm85cpu_mem_readword( s2 ); \
144         s2 = sm85cpu_mem_readword( cpustate, s2 ); \
145145      case 0x80: \
146146      case 0xC0: \
147147         break; \
148148      }
149149
150#define ARG_RiR   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
151      d1 = sm85cpu_mem_readbyte( regs.PC++ ); \
152      r2 = sm85cpu_mem_readbyte( regs.PC++ );
150#define ARG_RiR   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
151      d1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
152      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
153153
154#define ARG_Rii   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
155      d1 = sm85cpu_mem_readbyte( regs.PC++ ); \
156      r2 = sm85cpu_mem_readbyte( regs.PC++ );
154#define ARG_Rii   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
155      d1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
156      r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
157157
158#define ARG_riB r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
158#define ARG_riB r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
159159      s2 = 1 << ( r1 & 0x07 ); \
160      d1 = sm85cpu_mem_readbyte( regs.PC++ ); \
160      d1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
161161      if ( r1 & 0x38 ) { \
162         s1 = d1 + sm85cpu_mem_readbyte( ( r1 >> 3 ) & 0x07 ); \
162         s1 = d1 + sm85cpu_mem_readbyte( cpustate, ( r1 >> 3 ) & 0x07 ); \
163163      } else { \
164164         s1 = 0xFF00 + d1; \
165165      }
166166
167#define ARG_riBd   r1 = sm85cpu_mem_readbyte( regs.PC++ ); \
167#define ARG_riBd   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
168168         s2 = 1 << ( r1 & 0x07 ); \
169         d1 = sm85cpu_mem_readbyte( regs.PC++ ); \
169         d1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ ); \
170170         if ( r1 & 0x38 ) { \
171            s1 = d1 + sm85cpu_mem_readbyte( ( r1 >> 3 ) & 0x07 ); \
171            s1 = d1 + sm85cpu_mem_readbyte( cpustate, ( r1 >> 3 ) & 0x07 ); \
172172         } else { \
173173            s1 = 0xFF00 + d1; \
174174         } \
175         d1 = sm85cpu_mem_readbyte( regs.PC++ );
175         d1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
176176
177177#define OP_INTSUB8(X,Y,MASK)   d1 = X; \
178178            d2 = Y; \
179179            res = d1 - d2; \
180            regs.PS1 = regs.PS1 & ( MASK ); \
181            regs.PS1 = regs.PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
182            regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
183            regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
184            regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x80 ) ? FLAG_V : 0 );
180            cpustate->PS1 = cpustate->PS1 & ( MASK ); \
181            cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
182            cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
183            cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
184            cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x80 ) ? FLAG_V : 0 );
185185
186186#define OP_CMP8(X,Y)   OP_INTSUB8( X, Y, (FLAG_B | FLAG_I | FLAG_H | FLAG_D ) );
187187
188188#define OP_SUB8(X,Y)   OP_INTSUB8( X, Y, (FLAG_B | FLAG_I ) ); \
189         regs.PS1 = regs.PS1 | FLAG_D; \
190         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
189         cpustate->PS1 = cpustate->PS1 | FLAG_D; \
190         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
191191
192192#define OP_INTSUB16(X,Y,MASK)   d1 = X; \
193193            d2 = Y; \
194194            res = d1 - d2; \
195            regs.PS1 = regs.PS1 & ( MASK ); \
196            regs.PS1 = regs.PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
197            regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
198            regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
199            regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x8000 ) ? FLAG_V : 0 );
195            cpustate->PS1 = cpustate->PS1 & ( MASK ); \
196            cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
197            cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
198            cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
199            cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x8000 ) ? FLAG_V : 0 );
200200
201201#define OP_CMP16(X,Y)   OP_INTSUB16( X, Y, ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ) );
202202
203203#define OP_SUB16(X,Y)   OP_INTSUB16( X, Y, ( FLAG_B | FLAG_I ) ); \
204         regs.PS1 = regs.PS1 | FLAG_D; \
205         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x0010 ) ? FLAG_H : 0 );
204         cpustate->PS1 = cpustate->PS1 | FLAG_D; \
205         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x0010 ) ? FLAG_H : 0 );
206206
207207#define OP_SBC8(X,Y)   d1 = X; \
208208         d2 = Y; \
209         res = d1 - d2 - ((regs.PS1 & FLAG_C) ? 1 : 0); \
210         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
211         regs.PS1 = regs.PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
212         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
213         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
214         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
215         regs.PS1 = regs.PS1 | FLAG_D; \
216         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
209         res = d1 - d2 - ((cpustate->PS1 & FLAG_C) ? 1 : 0); \
210         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
211         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
212         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
213         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
214         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
215         cpustate->PS1 = cpustate->PS1 | FLAG_D; \
216         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
217217
218218#define OP_SBC16(X,Y)   d1 = X; \
219219         d2 = Y; \
220         res = d1 - d2 - ((regs.PS1 & FLAG_C) ? 1 : 0); \
221         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
222         regs.PS1 = regs.PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
223         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
224         regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
225         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x8000 ) ? FLAG_V : 0 ); \
226         regs.PS1 = regs.PS1 | FLAG_D; \
227         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
220         res = d1 - d2 - ((cpustate->PS1 & FLAG_C) ? 1 : 0); \
221         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
222         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
223         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
224         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
225         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x8000 ) ? FLAG_V : 0 ); \
226         cpustate->PS1 = cpustate->PS1 | FLAG_D; \
227         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
228228
229229#define OP_ADD8(X,Y)   d1 = X; \
230230         d2 = Y; \
231231         res = d1 + d2; \
232         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
233         regs.PS1 = regs.PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
234         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
235         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
236         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ^ 0x80 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
237         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
232         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
233         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
234         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
235         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
236         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ^ 0x80 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
237         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
238238
239239#define OP_ADD16(X,Y)   d1 = X; \
240240         d2 = Y; \
241241         res = d1 + d2; \
242         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
243         regs.PS1 = regs.PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
244         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
245         regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
246         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x8000 ) ? FLAG_V : 0 ); \
247         regs.PS1 = regs.PS1 | ( ( ( d2 ^ d1 ^ res ) & 0x0010 ) ? FLAG_H : 0 );
242         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
243         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
244         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
245         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
246         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1 ) ) & 0x8000 ) ? FLAG_V : 0 ); \
247         cpustate->PS1 = cpustate->PS1 | ( ( ( d2 ^ d1 ^ res ) & 0x0010 ) ? FLAG_H : 0 );
248248
249249#define OP_ADC8(X,Y)   d1 = X; \
250250         d2 = Y; \
251         res = d1 + d2 + ((regs.PS1 & FLAG_C) ? 1 : 0); \
252         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
253         regs.PS1 = regs.PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
254         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
255         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
256         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
257         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
251         res = d1 + d2 + ((cpustate->PS1 & FLAG_C) ? 1 : 0); \
252         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
253         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFF ) ? FLAG_C : 0 ); \
254         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
255         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0); \
256         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & (res ^ d1) ) & 0x80 ) ? FLAG_V : 0 ); \
257         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
258258
259259#define OP_ADC16(X,Y)   d1 = X; \
260260         d2 = Y; \
261         res = d1 + d2 + ((regs.PS1 & FLAG_C) ? 1 : 0); \
262         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I ); \
263         regs.PS1 = regs.PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
264         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
265         regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
266         regs.PS1 = regs.PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1) ) & 0x8000 ) ? FLAG_V : 0 ); \
267         regs.PS1 = regs.PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
261         res = d1 + d2 + ((cpustate->PS1 & FLAG_C) ? 1 : 0); \
262         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I ); \
263         cpustate->PS1 = cpustate->PS1 | ( ( res > 0xFFFF ) ? FLAG_C : 0 ); \
264         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
265         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
266         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d2 ^ d1 ) & ( res ^ d1) ) & 0x8000 ) ? FLAG_V : 0 ); \
267         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ d2 ^ res ) & 0x10 ) ? FLAG_H : 0 );
268268
269269#define OP_NEG8(X)   res = -X; \
270         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
271         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_C | FLAG_Z : 0 ); \
272         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
273         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0x80 ) ? FLAG_V : 0 );
270         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
271         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_C | FLAG_Z : 0 ); \
272         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
273         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0x80 ) ? FLAG_V : 0 );
274274
275275#define OP_COM8(X)   res = ~X; \
276         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
277         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
278         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
276         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
277         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
278         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
279279
280280#define OP_RR8(X)   d1 = X; \
281281         res = d1 >> 1; \
282282         if ( d1 & 0x01 ) { \
283283            res |= 0x80; \
284284         } \
285         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
286         regs.PS1 = regs.PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
287         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
288         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
289         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
285         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
286         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
287         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
288         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
289         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
290290
291291#define OP_RL8(X)   d1 = X; \
292292         res = d1 << 1; \
293293         if ( d1 & 0x80 ) { \
294294            res |= 0x01; \
295295         } \
296         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
297         regs.PS1 = regs.PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
298         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
299         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
300         regs.PS1 = regs.PS1 | ( ( ( d1 ^ res ) & 0x80 ) ? FLAG_V : 0 );
296         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
297         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
298         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
299         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
300         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ res ) & 0x80 ) ? FLAG_V : 0 );
301301
302302#define OP_RRC8(X)   d1 = X; \
303303         res = d1 >> 1; \
304         if ( regs.PS1 & FLAG_C ) { \
304         if ( cpustate->PS1 & FLAG_C ) { \
305305            res |= 0x80; \
306306         } \
307         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
308         regs.PS1 = regs.PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
309         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
310         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
311         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
307         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
308         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
309         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
310         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
311         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
312312
313313#define OP_RLC8(X)   d1 = X; \
314314         res = d1 << 1; \
315         if ( regs.PS1 & FLAG_C ) { \
315         if ( cpustate->PS1 & FLAG_C ) { \
316316            res |= 0x01; \
317317         } \
318         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
319         regs.PS1 = regs.PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
320         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
321         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
322         regs.PS1 = regs.PS1 | ( ( ( d1 ^ res ) & 0x80 ) ? FLAG_V : 0 );
318         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
319         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
320         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
321         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
322         cpustate->PS1 = cpustate->PS1 | ( ( ( d1 ^ res ) & 0x80 ) ? FLAG_V : 0 );
323323
324324#define OP_SRL8(X)   d1 = X; \
325325         res = d1 >> 1; \
326         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
327         regs.PS1 = regs.PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
328         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 );
326         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
327         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
328         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 );
329329
330330#define OP_SRA8(X)   d1 = X; \
331331         res = d1 >> 1; \
332332         if ( d1 & 0x80 ) { \
333333            res |= 0x80; \
334334         } \
335         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
336         regs.PS1 = regs.PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
337         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
338         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
335         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
336         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x01 ) ? FLAG_C : 0 ); \
337         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
338         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
339339
340340#define OP_SLL8(X)   d1 = X; \
341341         res = d1 << 1; \
342         regs.PS1 = regs.PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
343         regs.PS1 = regs.PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
344         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
345         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
342         cpustate->PS1 = cpustate->PS1 & ( FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
343         cpustate->PS1 = cpustate->PS1 | ( ( d1 & 0x80 ) ? FLAG_C : 0 ); \
344         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
345         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
346346
347347#define OP_INC8(X)   d1 = X; \
348348         res = d1 + 1; \
349         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
350         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
351         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
352         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
349         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
350         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
351         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
352         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ! ( res & 0x80 ) ) ? FLAG_V : 0 );
353353
354354#define OP_INC16(X)   d1 = X; \
355355         res = d1 + 1; \
356         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
357         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
358         regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
359         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x8000 ) && ! ( res & 0x8000 ) ) ? FLAG_V : 0 );
356         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
357         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
358         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
359         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x8000 ) && ! ( res & 0x8000 ) ) ? FLAG_V : 0 );
360360
361361#define OP_DEC8(X)   d1 = X; \
362362         res = d1 - 1; \
363         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
364         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
365         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
366         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ( res & 0x80 ) ) ? FLAG_V : 0 );
363         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
364         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
365         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 ); \
366         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x80 ) && ( res & 0x80 ) ) ? FLAG_V : 0 );
367367
368368#define OP_DEC16(X)   d1 = X; \
369369         res = d1 - 1; \
370         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
371         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
372         regs.PS1 = regs.PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
373         regs.PS1 = regs.PS1 | ( ( ( ( d1 ^ res ) & 0x8000 ) && ( res & 0x8000 ) ) ? FLAG_V : 0 );
370         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_D | FLAG_H | FLAG_B | FLAG_I ); \
371         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 ); \
372         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x8000 ) ? FLAG_S : 0 ); \
373         cpustate->PS1 = cpustate->PS1 | ( ( ( ( d1 ^ res ) & 0x8000 ) && ( res & 0x8000 ) ) ? FLAG_V : 0 );
374374
375375#define OP_AND8(X,Y)   d1 = X; \
376376         d2 = Y; \
377377         res = d1 & d2; \
378         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
379         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
380         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
378         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
379         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
380         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
381381
382382#define OP_AND16(X,Y)   d1 = X; \
383383         d2 = Y; \
384384         res = d1 & d2; \
385         regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_S | FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
386         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
385         cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_S | FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
386         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
387387
388388#define OP_OR8(X,Y)   d1 = X; \
389389         d2 = Y; \
390390         res = d1 | d2; \
391         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
392         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
393         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
391         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
392         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
393         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
394394
395395#define OP_OR16(X,Y)   d1 = X; \
396396         d2 = Y; \
397397         res = d1 | d2; \
398         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D | FLAG_C | FLAG_S ); \
399         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
398         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D | FLAG_C | FLAG_S ); \
399         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
400400
401401#define OP_XOR8(X,Y)   d1 = X; \
402402         d2 = Y; \
403403         res = d1 ^ d2; \
404         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
405         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
406         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
404         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D ); \
405         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0 ) ? FLAG_Z : 0 ); \
406         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
407407
408408#define OP_XOR16(X,Y)   d1 = X; \
409409         d2 = Y; \
410410         res = d1 ^ d2; \
411         regs.PS1 = regs.PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D | FLAG_C | FLAG_S ); \
412         regs.PS1 = regs.PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
411         cpustate->PS1 = cpustate->PS1 & ( FLAG_B | FLAG_I | FLAG_H | FLAG_D | FLAG_C | FLAG_S ); \
412         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFFFF ) == 0 ) ? FLAG_Z : 0 );
413413
414414#define OP_DA8(X)   d1 = X; \
415415         res = d1; \
416         if ( regs.PS1 & FLAG_D ) { \
417            if ( regs.PS1 & FLAG_C ) { \
418               if ( regs.PS1 & FLAG_H ) { \
416         if ( cpustate->PS1 & FLAG_D ) { \
417            if ( cpustate->PS1 & FLAG_C ) { \
418               if ( cpustate->PS1 & FLAG_H ) { \
419419                  res += 0x9A; \
420420               } else { \
421421                  res += 0xA0; \
422422               } \
423423            } else { \
424               if ( regs.PS1 & FLAG_H ) { \
424               if ( cpustate->PS1 & FLAG_H ) { \
425425                  res += 0xFA; \
426426               } \
427427            } \
428428         } else { \
429            if ( regs.PS1 & FLAG_C ) { \
430               if ( regs.PS1 & FLAG_H ) { \
429            if ( cpustate->PS1 & FLAG_C ) { \
430               if ( cpustate->PS1 & FLAG_H ) { \
431431                  res += 0x66; \
432432               } else { \
433433                  if ( ( res & 0x0F ) < 10 ) { \
r3957r3958
437437                  } \
438438               } \
439439            } else { \
440               if ( regs.PS1 & FLAG_H ) { \
440               if ( cpustate->PS1 & FLAG_H ) { \
441441                  if ( ( res & 0xF0 ) < 0xA0 ) { \
442442                     res += 0x06; \
443443                  } else { \
444444                     res += 0x66; \
445                     regs.PS1 = regs.PS1 | FLAG_C; \
445                     cpustate->PS1 = cpustate->PS1 | FLAG_C; \
446446                  } \
447447               } else { \
448448                  if ( ( res & 0x0F ) < 10 ) { \
449449                     if ( ( res & 0xF0 ) >= 0xA0 ) { \
450450                        res += 0x60; \
451                        regs.PS1 = regs.PS1 | FLAG_C; \
451                        cpustate->PS1 = cpustate->PS1 | FLAG_C; \
452452                     } \
453453                  } else { \
454454                     if ( ( res & 0xF0 ) < 0x90 ) { \
455455                        res += 0x06; \
456456                     } else { \
457457                        res += 0x66; \
458                        regs.PS1 = regs.PS1 | FLAG_C; \
458                        cpustate->PS1 = cpustate->PS1 | FLAG_C; \
459459                     } \
460460                  } \
461461               } \
462462            } \
463463         } \
464         regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_S ); \
465         regs.PS1 = regs.PS1 | ( ( ( res & 0xFF ) == 0x00 ) ? FLAG_Z : 0 ); \
466         regs.PS1 = regs.PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
464         cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_S ); \
465         cpustate->PS1 = cpustate->PS1 | ( ( ( res & 0xFF ) == 0x00 ) ? FLAG_Z : 0 ); \
466         cpustate->PS1 = cpustate->PS1 | ( ( res & 0x80 ) ? FLAG_S : 0 );
467467
468468#define OP_SWAP8(X)   d1 = X; \
469469         res = ( d1 << 4 ) | ( d1 >> 4 );
r3957r3958
471471#define CHECK_CC   res = 0; \
472472         switch( op & 0x0F ) { \
473473         case 0x00: /* F   */ res = 0; break; \
474         case 0x01: /* LT  */ if ( ( regs.PS1 & FLAG_S ) ^ ( ( regs.PS1 & FLAG_V ) << 1 ) ) res = 1; break; \
475         case 0x02: /* LE  */ if ( ( ( regs.PS1 & FLAG_S ) && ! ( regs.PS1 & FLAG_V ) ) || ( ( regs.PS1 & FLAG_S ) && ( regs.PS1 & FLAG_V ) && ( regs.PS1 & FLAG_Z ) ) || ( ! ( regs.PS1 & FLAG_S ) && ( ( regs.PS1 & FLAG_Z ) || (regs.PS1 & FLAG_V ) ) ) ) res = 1; break; \
476         case 0x03: /* ULE */ if ( regs.PS1 & FLAG_Z || regs.PS1 & FLAG_C ) res = 1; break; \
477         case 0x04: /* OV  */ if ( regs.PS1 & FLAG_V ) res = 1; break; \
478         case 0x05: /* MI  */ if ( regs.PS1 & FLAG_S ) res = 1; break; \
479         case 0x06: /* Z   */ if ( regs.PS1 & FLAG_Z ) res = 1; break; \
480         case 0x07: /* C   */ if ( regs.PS1 & FLAG_C ) res = 1; break; \
474         case 0x01: /* LT  */ if ( ( cpustate->PS1 & FLAG_S ) ^ ( ( cpustate->PS1 & FLAG_V ) << 1 ) ) res = 1; break; \
475         case 0x02: /* LE  */ if ( ( ( cpustate->PS1 & FLAG_S ) && ! ( cpustate->PS1 & FLAG_V ) ) || ( ( cpustate->PS1 & FLAG_S ) && ( cpustate->PS1 & FLAG_V ) && ( cpustate->PS1 & FLAG_Z ) ) || ( ! ( cpustate->PS1 & FLAG_S ) && ( ( cpustate->PS1 & FLAG_Z ) || (cpustate->PS1 & FLAG_V ) ) ) ) res = 1; break; \
476         case 0x03: /* ULE */ if ( cpustate->PS1 & FLAG_Z || cpustate->PS1 & FLAG_C ) res = 1; break; \
477         case 0x04: /* OV  */ if ( cpustate->PS1 & FLAG_V ) res = 1; break; \
478         case 0x05: /* MI  */ if ( cpustate->PS1 & FLAG_S ) res = 1; break; \
479         case 0x06: /* Z   */ if ( cpustate->PS1 & FLAG_Z ) res = 1; break; \
480         case 0x07: /* C   */ if ( cpustate->PS1 & FLAG_C ) res = 1; break; \
481481         case 0x08: /* T   */ res = 1; break; \
482         case 0x09: /* GE  */ if ( ! ( ( regs.PS1 & FLAG_S ) ^ ( ( regs.PS1 & FLAG_V ) << 1 ) ) ) res = 1; break; \
483         case 0x0A: /* GT  */ if ( ( ! ( regs.PS1 & FLAG_Z ) && ( regs.PS1 & FLAG_S ) && ( regs.PS1 & FLAG_V ) ) || ( ! ( regs.PS1 & FLAG_Z ) && ! ( regs.PS1 & FLAG_V ) && ! ( regs.PS1 & FLAG_S ) ) ) res = 1; break; \
484         case 0x0B: /* UGT */ if ( ! ( regs.PS1 & FLAG_Z || regs.PS1 & FLAG_C ) ) res = 1; break; \
485         case 0x0C: /* NOV */ if ( ! (regs.PS1 & FLAG_V) ) res = 1; break; \
486         case 0x0D: /* PL  */ if ( ! (regs.PS1 & FLAG_S) ) res = 1; break; \
487         case 0x0E: /* NZ  */ if ( ! (regs.PS1 & FLAG_Z) ) res = 1; break; \
488         case 0x0F: /* NC  */ if ( ! (regs.PS1 & FLAG_C) ) res = 1; break; \
482         case 0x09: /* GE  */ if ( ! ( ( cpustate->PS1 & FLAG_S ) ^ ( ( cpustate->PS1 & FLAG_V ) << 1 ) ) ) res = 1; break; \
483         case 0x0A: /* GT  */ if ( ( ! ( cpustate->PS1 & FLAG_Z ) && ( cpustate->PS1 & FLAG_S ) && ( cpustate->PS1 & FLAG_V ) ) || ( ! ( cpustate->PS1 & FLAG_Z ) && ! ( cpustate->PS1 & FLAG_V ) && ! ( cpustate->PS1 & FLAG_S ) ) ) res = 1; break; \
484         case 0x0B: /* UGT */ if ( ! ( cpustate->PS1 & FLAG_Z || cpustate->PS1 & FLAG_C ) ) res = 1; break; \
485         case 0x0C: /* NOV */ if ( ! (cpustate->PS1 & FLAG_V) ) res = 1; break; \
486         case 0x0D: /* PL  */ if ( ! (cpustate->PS1 & FLAG_S) ) res = 1; break; \
487         case 0x0E: /* NZ  */ if ( ! (cpustate->PS1 & FLAG_Z) ) res = 1; break; \
488         case 0x0F: /* NC  */ if ( ! (cpustate->PS1 & FLAG_C) ) res = 1; break; \
489489         }
490490
491#define PUSH8(X)   regs.SP = regs.SP - 1; \
492         if ( ( regs.SYS & 0x40 ) == 0 ) { \
493            regs.SP = regs.SP & 0xFF; \
491#define PUSH8(X)   cpustate->SP = cpustate->SP - 1; \
492         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
493            cpustate->SP = cpustate->SP & 0xFF; \
494494         } \
495         sm85cpu_mem_writebyte( regs.SP, X );
495         sm85cpu_mem_writebyte( cpustate, cpustate->SP, X );
496496
497#define POP8(X)      X = sm85cpu_mem_readbyte( regs.SP ); \
498         regs.SP = regs.SP + 1; \
499         if ( ( regs.SYS & 0x40 ) == 0 ) { \
500            regs.SP = regs.SP & 0xFF; \
497#define POP8(X)      X = sm85cpu_mem_readbyte( cpustate, cpustate->SP ); \
498         cpustate->SP = cpustate->SP + 1; \
499         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
500            cpustate->SP = cpustate->SP & 0xFF; \
501501         }
502502
503503case 0x00:   /* CLR R - 4 cycles - Flags affected: -------- */
504504   ARG_R;
505   sm85cpu_mem_writebyte( r1, 0 );
505   sm85cpu_mem_writebyte( cpustate, r1, 0 );
506506        mycycles += 4;
507507   break;
508508case 0x01:   /* NEG R - 5 cycles - Flags affected: CZSV---- */
509509   ARG_R;
510   OP_NEG8( sm85cpu_mem_readbyte( r1 ) );
511   sm85cpu_mem_writebyte( r1 , res & 0xFF );
510   OP_NEG8( sm85cpu_mem_readbyte( cpustate, r1 ) );
511   sm85cpu_mem_writebyte( cpustate, r1 , res & 0xFF );
512512   mycycles += 5;
513513   break;
514514case 0x02:   /* COM R - 4 cycles - Flags affected: -ZS0---- */
515515   ARG_R;
516   OP_COM8( sm85cpu_mem_readbyte( r1 ) );
517   sm85cpu_mem_writebyte( r1, res & 0xFF );
516   OP_COM8( sm85cpu_mem_readbyte( cpustate, r1 ) );
517   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
518518   mycycles += 4;
519519   break;
520520case 0x03:   /* RR R - 4 cycles - Flags affected: CZSV---- */
521521   ARG_R;
522   OP_RR8( sm85cpu_mem_readbyte( r1 ) );
523   sm85cpu_mem_writebyte( r1, res & 0xFF );
522   OP_RR8( sm85cpu_mem_readbyte( cpustate, r1 ) );
523   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
524524   mycycles += 4;
525525   break;
526526case 0x04:   /* RL R - 4 cycles - Flags affected: CZSV---- */
527527   ARG_R;
528   OP_RL8( sm85cpu_mem_readbyte( r1 ) );
529   sm85cpu_mem_writebyte( r1 , res & 0xFF );
528   OP_RL8( sm85cpu_mem_readbyte( cpustate, r1 ) );
529   sm85cpu_mem_writebyte( cpustate, r1 , res & 0xFF );
530530   mycycles += 4;
531531   break;
532532case 0x05:   /* RRC R - 4 cycles - Flags affected: CZSV---- */
533533   ARG_R;
534   OP_RRC8( sm85cpu_mem_readbyte( r1 ) );
535   sm85cpu_mem_writebyte( r1, res & 0xFF );
534   OP_RRC8( sm85cpu_mem_readbyte( cpustate, r1 ) );
535   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
536536   mycycles += 4;
537537   break;
538538case 0x06:   /* RLC R - 4 cycles - Flags affected: CZSV---- */
539539   ARG_R;
540   OP_RLC8( sm85cpu_mem_readbyte( r1 ) );
541   sm85cpu_mem_writebyte( r1, res & 0xFF );
540   OP_RLC8( sm85cpu_mem_readbyte( cpustate, r1 ) );
541   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
542542   mycycles += 4;
543543   break;
544544case 0x07:   /* SRL R - 4 cycles - Flags affected: CZ00---- */
545545   ARG_R;
546   OP_SRL8( sm85cpu_mem_readbyte( r1 ) );
547   sm85cpu_mem_writebyte( r1, res & 0xFF );
546   OP_SRL8( sm85cpu_mem_readbyte( cpustate, r1 ) );
547   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
548548   mycycles += 4;
549549   break;
550550case 0x08:   /* INC R - 4 cycles - Flags affected: -ZSV---- */
551551   ARG_R;
552   OP_INC8( sm85cpu_mem_readbyte( r1 ) );
553   sm85cpu_mem_writebyte( r1, res & 0xFF );
552   OP_INC8( sm85cpu_mem_readbyte( cpustate, r1 ) );
553   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
554554   mycycles += 4;
555555   break;
556556case 0x09:   /* DEC R - 4 cycles - Flags affected: -ZSV---- */
557557   ARG_R;
558   OP_DEC8( sm85cpu_mem_readbyte( r1 ) );
559   sm85cpu_mem_writebyte( r1, res & 0xFF );
558   OP_DEC8( sm85cpu_mem_readbyte( cpustate, r1 ) );
559   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
560560   mycycles += 4;
561561   break;
562562case 0x0A:   /* SRA R - 4 cycles - Flags affected: CZS0---- */
563563   ARG_R;
564   OP_SRA8( sm85cpu_mem_readbyte( r1 ) );
565   sm85cpu_mem_writebyte( r1, res & 0xFF );
564   OP_SRA8( sm85cpu_mem_readbyte( cpustate, r1 ) );
565   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
566566   mycycles += 4;
567567   break;
568568case 0x0B:   /* SLL R - 4 cycles - Flags affected: CZS0---- */
569569   ARG_R;
570   OP_SLL8( sm85cpu_mem_readbyte( r1 ) );
571   sm85cpu_mem_writebyte( r1, res & 0xFF );
570   OP_SLL8( sm85cpu_mem_readbyte( cpustate, r1 ) );
571   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
572572   mycycles += 4;
573573   break;
574574case 0x0C:   /* DA R - 4 cycles - Flags affected: CZS----- */
575575   ARG_R;
576   OP_DA8( sm85cpu_mem_readbyte( r1 ) );
577   sm85cpu_mem_writebyte( r1, res & 0xFF );
576   OP_DA8( sm85cpu_mem_readbyte( cpustate, r1 ) );
577   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
578578   mycycles += 4;
579579   break;
580580case 0x0D:   /* SWAP R - 7 cycles - Flags affected: -------- */
581581   ARG_R;
582   OP_SWAP8( sm85cpu_mem_readbyte( r1 ) );
583   sm85cpu_mem_writebyte( r1, res & 0xFF );
582   OP_SWAP8( sm85cpu_mem_readbyte( cpustate, r1 ) );
583   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
584584   mycycles += 7;
585585   break;
586586case 0x0E:   /* PUSH R - 5?/12? (8bit SP),10 (16bit SP) cycles */
587587   ARG_R;
588   PUSH8( sm85cpu_mem_readbyte( r1 ) );
589   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 10 );
588   PUSH8( sm85cpu_mem_readbyte( cpustate, r1 ) );
589   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 10 );
590590   break;
591591case 0x0F:   /* POP R - 9,8 cycles */
592592   ARG_R;
593593   POP8( r2 );
594   sm85cpu_mem_writebyte( r1, r2 );
595   mycycles += ( ( regs.SYS & 0x40 ) ? 9 : 8 );
594   sm85cpu_mem_writebyte( cpustate, r1, r2 );
595   mycycles += ( ( cpustate->SYS & 0x40 ) ? 9 : 8 );
596596   break;
597597case 0x10:   /* CMP Rr,Rs - 5 cycles - Flags affected: CZSV---- */
598598   ARG_rr;
599   OP_CMP8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
599   OP_CMP8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
600600   mycycles += 5;
601601   break;
602602case 0x11:   /* ADD Rr,Rs - 5 cycles - Flags affected: CZSV0H-- */
603603   ARG_rr;
604   OP_ADD8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
605   sm85cpu_mem_writebyte( r1, res & 0xFF );
604   OP_ADD8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
605   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
606606   mycycles += 5;
607607   break;
608608case 0x12:   /* SUB Rr,Rs - 5 cycles - Flags affected: CZSV1H-- */
609609   ARG_rr;
610   OP_SUB8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
611   sm85cpu_mem_writebyte( r1, res & 0xFF );
610   OP_SUB8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
611   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
612612   mycycles += 5;
613613   break;
614614case 0x13:   /* ADC Rr,Rs - 5 cycles - Flags affected: CZSV0H-- */
615615   ARG_rr;
616   OP_ADC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
617   sm85cpu_mem_writebyte( r1, res & 0xFF );
616   OP_ADC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
617   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
618618   mycycles += 5;
619619   break;
620620case 0x14:   /* SBC Rr,Rs - 5 cycles - Flags affected: CZSV1H-- */
621621   ARG_rr;
622   OP_SBC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
623   sm85cpu_mem_writebyte( r1, res & 0xFF );
622   OP_SBC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
623   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
624624   mycycles += 5;
625625   break;
626626case 0x15:   /* AND Rr,Rs - 5 cycles - Flags affected: -ZS0---- */
627627   ARG_rr;
628   OP_AND8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
629   sm85cpu_mem_writebyte( r1, res & 0xFF );
628   OP_AND8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
629   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
630630   mycycles += 5;
631631   break;
632632case 0x16:   /* OR Rr,Rs - 5 cycles - Flags affected: -ZS0---- */
633633   ARG_rr;
634   OP_OR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
635   sm85cpu_mem_writebyte( r1, res & 0xFF );
634   OP_OR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
635   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
636636   mycycles += 5;
637637   break;
638638case 0x17:   /* XOR Rr,Rs - 5 cycles - Flags affected: -ZS0---- */
639639   ARG_rr;
640   OP_XOR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
641   sm85cpu_mem_writebyte( r1, res & 0xFF );
640   OP_XOR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
641   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
642642   mycycles += 5;
643643   break;
644644case 0x18:   /* INCW S - 8 cycles - Flags affected: -ZSV---- */
645645   ARG_R;
646   OP_INC16( sm85cpu_mem_readword( r1 ) );
647   sm85cpu_mem_writeword( r1, res & 0xFFFF );
646   OP_INC16( sm85cpu_mem_readword( cpustate, r1 ) );
647   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
648648   mycycles += 8;
649649   break;
650650case 0x19:   /* DECW S - 8 cycles - Flags affected: -ZSV---- */
651651   ARG_R;
652   OP_DEC16( sm85cpu_mem_readword( r1 ) );
653   sm85cpu_mem_writeword( r1, res & 0xFFFF );
652   OP_DEC16( sm85cpu_mem_readword( cpustate, r1 ) );
653   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
654654   mycycles += 8;
655655   break;
656656case 0x1A:   /* CLR/NEG/COM/RR/RL/RRC/RLC/SRL @Rr - 7/8/7/7/7/7/7/6 cycles */
657657   ARG_rr;
658658   res = 0;
659   s1 = sm85cpu_mem_readbyte( r1 );
659   s1 = sm85cpu_mem_readbyte( cpustate, r1 );
660660   switch( r2 ) {
661661   case 0x00:   /* Flags affected: -------- */
662662      res = 0;
663663      mycycles += 7;
664664      break;
665665   case 0x01:   /* Flags affected: CZSV---- */
666      OP_NEG8( sm85cpu_mem_readbyte( s1 ) );
666      OP_NEG8( sm85cpu_mem_readbyte( cpustate, s1 ) );
667667      mycycles += 8;
668668      break;
669669   case 0x02:   /* Flags affected: -ZS0---- */
670      OP_COM8( sm85cpu_mem_readbyte( s1 ) );
670      OP_COM8( sm85cpu_mem_readbyte( cpustate, s1 ) );
671671      mycycles += 7;
672672      break;
673673   case 0x03:   /* Flags affected: CZSV---- */
674      OP_RR8( sm85cpu_mem_readbyte( s1 ) );
674      OP_RR8( sm85cpu_mem_readbyte( cpustate, s1 ) );
675675      mycycles += 7;
676676      break;
677677   case 0x04:   /* Flags affected: CZSV---- */
678      OP_RL8( sm85cpu_mem_readbyte( s1 ) );
678      OP_RL8( sm85cpu_mem_readbyte( cpustate, s1 ) );
679679      mycycles += 7;
680680      break;
681681   case 0x05:   /* Flags affected: CZSV---- */
682      OP_RRC8( sm85cpu_mem_readbyte( s1 ) );
682      OP_RRC8( sm85cpu_mem_readbyte( cpustate, s1 ) );
683683      mycycles += 7;
684684      break;
685685   case 0x06:   /* Flags affected: CZSV---- */
686      OP_RLC8( sm85cpu_mem_readbyte( s1 ) );
686      OP_RLC8( sm85cpu_mem_readbyte( cpustate, s1 ) );
687687      mycycles += 7;
688688      break;
689689   case 0x07:   /* Flags affected: CZ00---- */
690      OP_SRL8( sm85cpu_mem_readbyte( s1 ) );
690      OP_SRL8( sm85cpu_mem_readbyte( cpustate, s1 ) );
691691      mycycles += 6;
692692      break;
693693   }
694   sm85cpu_mem_writebyte( s1, res & 0xFF );
694   sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
695695   break;
696696case 0x1B:   /* INC/DEC/SRA/SLL/DA/SWAP/PUSH/POP @Rr - 7,7,6,7,9,13,8,12,11 cycles */
697697   ARG_rr;
698   s1 = sm85cpu_mem_readbyte( r1 );
698   s1 = sm85cpu_mem_readbyte( cpustate, r1 );
699699   switch( r2 ) {
700700   case 0x00:   /* Flags affected: -ZSV---- */
701      OP_INC8( sm85cpu_mem_readbyte( s1 ) );
702      sm85cpu_mem_writebyte( s1, res & 0xFF );
701      OP_INC8( sm85cpu_mem_readbyte( cpustate, s1 ) );
702      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
703703      mycycles += 7;
704704      break;
705705   case 0x01:   /* Flags affected: -ZSV---- */
706      OP_DEC8( sm85cpu_mem_readbyte( s1 ) );
707      sm85cpu_mem_writebyte( s1, res & 0xFF );
706      OP_DEC8( sm85cpu_mem_readbyte( cpustate, s1 ) );
707      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
708708      mycycles += 7;
709709      break;
710710   case 0x02:   /* Flags affected: CZS0---- */
711      OP_SRA8( sm85cpu_mem_readbyte( s1 ) );
712      sm85cpu_mem_writebyte( s1, res & 0xFF );
711      OP_SRA8( sm85cpu_mem_readbyte( cpustate, s1 ) );
712      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
713713      mycycles += 6;
714714      break;
715715   case 0x03:   /* Flags affected: CZS0---- */
716      OP_SLL8( sm85cpu_mem_readbyte( s1 ) );
717      sm85cpu_mem_writebyte( s1, res & 0xFF );
716      OP_SLL8( sm85cpu_mem_readbyte( cpustate, s1 ) );
717      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
718718      mycycles += 6;
719719      break;
720720   case 0x04:   /* Flags affected: CZS----- */
721      OP_DA8( sm85cpu_mem_readbyte( s1 ) );
722      sm85cpu_mem_writebyte( s1, res & 0xFF );
721      OP_DA8( sm85cpu_mem_readbyte( cpustate, s1 ) );
722      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
723723      mycycles += 7;
724724      break;
725725   case 0x05:   /* Flags affected: -------- */
726      OP_SWAP8( sm85cpu_mem_readbyte( s1 ) );
727      sm85cpu_mem_writebyte( s1, res & 0xFF );
726      OP_SWAP8( sm85cpu_mem_readbyte( cpustate, s1 ) );
727      sm85cpu_mem_writebyte( cpustate, s1, res & 0xFF );
728728      mycycles += 9;
729729      break;
730730   case 0x06:   /* Flags affected: -------- */
731      PUSH8( sm85cpu_mem_readbyte( s1 ) );
732      mycycles += ( ( regs.SYS & 0x40 ) ? 13 : 8 );
731      PUSH8( sm85cpu_mem_readbyte( cpustate, s1 ) );
732      mycycles += ( ( cpustate->SYS & 0x40 ) ? 13 : 8 );
733733      break;
734734   case 0x07:   /* Flags affected: -------- */
735735      POP8( res );
736      sm85cpu_mem_writebyte( s1, res );
737      mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 11 );
736      sm85cpu_mem_writebyte( cpustate, s1, res );
737      mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 11 );
738738      break;
739739   }
740740   break;
741741case 0x1C:   /* BCLR 0xFFdd/d8(r),#b - 12,8 cycles - Flags affected: -------- */
742742   ARG_riB;
743   sm85cpu_mem_writebyte( s1, sm85cpu_mem_readbyte( s1 ) & ~s2 );
743   sm85cpu_mem_writebyte( cpustate, s1, sm85cpu_mem_readbyte( cpustate, s1 ) & ~s2 );
744744   mycycles += ( ( r1 & 0x38 ) ? 8 : 12 );
745745   break;
746746case 0x1D:   /* BSET 0xFFdd/d8(r),#b - 12,8 cycles - Flags affected: -------- */
747747   ARG_riB;
748   sm85cpu_mem_writebyte( s1, sm85cpu_mem_readbyte( s1 ) | s2 );
748   sm85cpu_mem_writebyte( cpustate, s1, sm85cpu_mem_readbyte( cpustate, s1 ) | s2 );
749749   mycycles += ( ( r1 & 0x38 ) ? 8 : 12 );
750750   break;
751751case 0x1E:   /* PUSHW S - 12,9 cycles - Flags affected: -------- */
752752   ARG_R;
753   PUSH8( sm85cpu_mem_readbyte( r1 + 1 ) );
754   PUSH8( sm85cpu_mem_readbyte( r1 ) );
755   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 9 );
753   PUSH8( sm85cpu_mem_readbyte( cpustate, r1 + 1 ) );
754   PUSH8( sm85cpu_mem_readbyte( cpustate, r1 ) );
755   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 9 );
756756   break;
757757case 0x1F:   /* POPW S - 12,13 cycles - Flags affected: -------- */
758758   ARG_R;
759759   POP8( r2 );
760   sm85cpu_mem_writebyte( r1, r2 );
760   sm85cpu_mem_writebyte( cpustate, r1, r2 );
761761   POP8( r2 );
762   sm85cpu_mem_writebyte( r1 + 1, r2 );
763   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 13 );
762   sm85cpu_mem_writebyte( cpustate, r1 + 1, r2 );
763   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 13 );
764764   break;
765765case 0x20:   /* CMP r,@r / CMP r,(r)+ / CMP r,@w / CMP r,w(r) / CMP r,-(r) - 7,8,10,8,9 cycles - Flags affected: CZSV---- */
766766   ARG_rmb;
767   OP_CMP8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
767   OP_CMP8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
768768   switch( r2 & 0xC0 ) {
769769   case 0x00:   mycycles += 7; break;
770770   case 0x40:   mycycles += 8; break;
r3957r3958
774774   break;
775775case 0x21:   /* ADD r,@r / ADD r,(r)+ / ADD r,@w / ADD r,w(r) / ADD r,-(r) - 7,8,10,8,9 cycles - Flags affected: CZSV0H-- */
776776   ARG_rmb;
777   OP_ADD8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
778   sm85cpu_mem_writebyte( r1, res & 0xFF );
777   OP_ADD8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
778   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
779779   switch( r2 & 0xC0 ) {
780780   case 0x00:   mycycles += 7; break;
781781   case 0x40:   mycycles += 8; break;
r3957r3958
785785   break;
786786case 0x22:   /* SUB r,@r / SUB r,(r)+ / SUB r,@w / SUB r,w(r) / SUB r,-(r) - 7,8,10,8,9 cycles - Flags affected: CZSV1H-- */
787787   ARG_rmb;
788   OP_SUB8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
789   sm85cpu_mem_writebyte( r1, res & 0xFF );
788   OP_SUB8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
789   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
790790   switch( r2 & 0xC0 ) {
791791   case 0x00:   mycycles += 7; break;
792792   case 0x40:   mycycles += 8; break;
r3957r3958
796796   break;
797797case 0x23:   /* ADC r,@r / ADC r,(r)+ / ADC r,@w / ADC r,w(r) / ADC r,-(r) - 7,8,10,8,9 cycles - Flags affected: CZSV0H-- */
798798   ARG_rmb;
799   OP_ADC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
800   sm85cpu_mem_writebyte( r1, res & 0xFF );
799   OP_ADC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
800   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
801801   switch( r2 & 0xC0 ) {
802802   case 0x00:   mycycles += 7; break;
803803   case 0x40:   mycycles += 8; break;
r3957r3958
807807   break;
808808case 0x24:   /* SBC r,@r / SBC r,(r)+ / SBC r,@w / SBC r,w(r) / SBC r,-(r) - 7,8,10,8,9 cycles - Flags affected: CZSV1H-- */
809809   ARG_rmb;
810   OP_SBC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
811   sm85cpu_mem_writebyte( r1, res & 0xFF );
810   OP_SBC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
811   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
812812   switch( r2 & 0xC0 ) {
813813   case 0x00:   mycycles += 7; break;
814814   case 0x40:   mycycles += 8; break;
r3957r3958
818818   break;
819819case 0x25:   /* AND r,@r / AND r,(r)+ / AND r,@w / AND r,w(r) / AND r,-(r) - 7,8,10,8,9 cycles - Flags affected: -ZS0---- */
820820   ARG_rmb;
821   OP_AND8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
822   sm85cpu_mem_writebyte( r1, res & 0xFF );
821   OP_AND8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
822   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
823823   switch( r2 & 0xC0 ) {
824824   case 0x00:   mycycles += 7; break;
825825   case 0x40:   mycycles += 8; break;
r3957r3958
829829   break;
830830case 0x26:   /* OR r,@r / OR r,(r)+ / OR r,@w / OR r,w(r) / OR r,-(r) - 7,8,10,8,9 cycles - Flags affected: -ZS0---- */
831831   ARG_rmb;
832   OP_OR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
833   sm85cpu_mem_writebyte( r1, res & 0xFF );
832   OP_OR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
833   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
834834   switch( r2 & 0xC0 ) {
835835   case 0x00:   mycycles += 7; break;
836836   case 0x40:   mycycles += 8; break;
r3957r3958
840840   break;
841841case 0x27:   /* XOR r,@r / XOR r,(r)+ / XOR r,@w / XOR r,w(r) / XOR r,-(r) - 7,8,10,8,9 cycles - Flags affected: -ZS0---- */
842842   ARG_rmb;
843   OP_XOR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
844   sm85cpu_mem_writebyte( r1, res & 0xFF );
843   OP_XOR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
844   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
845845   switch( r2 & 0xC0 ) {
846846   case 0x00:   mycycles += 7; break;
847847   case 0x40:   mycycles += 8; break;
r3957r3958
851851   break;
852852case 0x28:   /* MOV r,@r / MOV r,(r)+ / MOV r,@w / MOV r,w(r) / MOV r,-(r) - 6,7,10,7,8 cycles - Flags affected: -------- */
853853   ARG_rmb;
854   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( s2 ) );
854   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, s2 ) );
855855   switch( r2 & 0xC0 ) {
856856   case 0x00:   mycycles += 6; break;
857857   case 0x40:   mycycles += 7; break;
r3957r3958
861861   break;
862862case 0x29:   /* MOV @r,r / MOV (r)+,r / MOV @w,r / MOV w(r),r / MOV -(r),r - 8,8,10,9,9 cycles - Flags affected: -------- */
863863   ARG_rmb;
864   sm85cpu_mem_writebyte( s2, sm85cpu_mem_readbyte( r1 ) );
864   sm85cpu_mem_writebyte( cpustate, s2, sm85cpu_mem_readbyte( cpustate, r1 ) );
865865   switch( r2 & 0xC0 ) {
866866   case 0x00:   mycycles += 8; break;
867867   case 0x40:   mycycles += 8; break;
r3957r3958
871871   break;
872872case 0x2A:   /* BBC FFii/i(Rr),#b,d8 - 16,12/14,10 cycles - Flags affected: -------- */
873873   ARG_riBd;
874   if ( sm85cpu_mem_readbyte( s1 ) & s2 ) {
874   if ( sm85cpu_mem_readbyte( cpustate, s1 ) & s2 ) {
875875      mycycles += 10;
876876   } else {
877      regs.PC = regs.PC + ((INT8)d1);
877      cpustate->PC = cpustate->PC + ((INT8)d1);
878878      mycycles += 14;
879879   }
880880   if ( ( r1 & 0x38 ) == 0 ) {
r3957r3958
883883   break;
884884case 0x2B:   /* BBS FFii/i(Rr),#b,d8 - 16,12/14,10 cycles - Flags affected: -------- */
885885   ARG_riBd;
886   if ( sm85cpu_mem_readbyte( s1 ) & s2 ) {
887      regs.PC = regs.PC + ((INT8)d1);
886   if ( sm85cpu_mem_readbyte( cpustate, s1 ) & s2 ) {
887      cpustate->PC = cpustate->PC + ((INT8)d1);
888888      mycycles += 14;
889889   } else {
890890      mycycles += 10;
r3957r3958
895895   break;
896896case 0x2C:   /* EXTS Rr - 6 cycles - Flags affected: -------- */
897897   ARG_R;
898   res = sm85cpu_mem_readword( r1 );
898   res = sm85cpu_mem_readword( cpustate, r1 );
899899   if ( res & 0x80 ) {
900900      res = res | 0xFF00;
901901   } else {
902902      res = res & 0x00FF;
903903   }
904   sm85cpu_mem_writeword( r1, res );
904   sm85cpu_mem_writeword( cpustate, r1, res );
905905   mycycles += 6;
906906   break;
907907case 0x2D:   /* unk2D - 4 cycles */
908logerror( "%04X: unk%02x\n", regs.PC-1,op );
908logerror( "%04X: unk%02x\n", cpustate->PC-1,op );
909909   mycycles += 4;
910910   break;
911911case 0x2E:   /* MOV PS0,#00 - 4 cycles - Flags affected: -------- */
912912   ARG_R;
913   regs.PS0 = r1; regs.register_base = regs.internal_ram + ( r1 & 0xF8 );
913   cpustate->PS0 = r1; cpustate->register_base = cpustate->internal_ram + ( r1 & 0xF8 );
914914        mycycles += 4;
915915   break;
916916case 0x2F:   /* BTST R,i - 6 cycles - Flags affected: -Z-0---- */
917917   ARG_RR;
918   regs.PS1 = regs.PS1 & ~ FLAG_V;
919   if ( ( sm85cpu_mem_readbyte( r2 ) & r1 ) == 0x00 ) {
920      regs.PS1 = regs.PS1 | FLAG_Z;
918   cpustate->PS1 = cpustate->PS1 & ~ FLAG_V;
919   if ( ( sm85cpu_mem_readbyte( cpustate, r2 ) & r1 ) == 0x00 ) {
920      cpustate->PS1 = cpustate->PS1 | FLAG_Z;
921921   } else {
922      regs.PS1 = regs.PS1 & ( ~ FLAG_Z );
922      cpustate->PS1 = cpustate->PS1 & ( ~ FLAG_Z );
923923   }
924924   mycycles += 6;
925925   break;
926926case 0x30:   /* CMP r,@rr / CMP r,(rr)+ / CMP r,@ww / CMP r,ww(rr) / CMP r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV---- */
927927   ARG_rmw;
928   OP_CMP8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
928   OP_CMP8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
929929   switch( r2 & 0xC0 ) {
930930   case 0x00:   mycycles += 8; break;
931931   case 0x40:   mycycles += 13; break;
r3957r3958
935935   break;
936936case 0x31:   /* ADD r,@rr / ADD r,(rr)+ / ADD r,@ww / ADD r,ww(rr) / ADD r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV0H-- */
937937   ARG_rmw;
938   OP_ADD8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
939   sm85cpu_mem_writebyte( r1, res & 0xFF );
938   OP_ADD8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
939   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
940940   switch( r2 & 0xC0 ) {
941941   case 0x00:   mycycles += 8; break;
942942   case 0x40:   mycycles += 13; break;
r3957r3958
946946   break;
947947case 0x32:   /* SUB r,@rr / SUB r,(rr)+ / SUB r,@ww / SUB r,ww(rr) / SUB r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV1H-- */
948948   ARG_rmw;
949   OP_SUB8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
949   OP_SUB8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
950950   switch( r2 & 0xC0 ) {
951951   case 0x00:   mycycles += 8; break;
952952   case 0x40:   mycycles += 13; break;
r3957r3958
956956   break;
957957case 0x33:   /* ADC r,@rr / ADC r,(rr)+ / ADC r,@ww / ADC r,ww(rr) / ADC r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV0H-- */
958958   ARG_rmw;
959   OP_ADC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
960   sm85cpu_mem_writebyte( r1, res & 0xFF );
959   OP_ADC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
960   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
961961   switch( r2 & 0xC0 ) {
962962   case 0x00:   mycycles += 8; break;
963963   case 0x40:   mycycles += 13; break;
r3957r3958
967967   break;
968968case 0x34:   /* SBC r,@rr / SBC r,(rr)+ / SBC r,@ww / SBC r,ww(rr) / SBC r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV1H-- */
969969   ARG_rmw;
970   OP_SBC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
971   sm85cpu_mem_writebyte( r1, res & 0xFF );
970   OP_SBC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
971   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
972972   switch( r2 & 0xC0 ) {
973973   case 0x00:   mycycles += 8; break;
974974   case 0x40:   mycycles += 13; break;
r3957r3958
978978   break;
979979case 0x35:   /* AND r,@rr / AND r,(rr)+ / AND r,@ww / AND r,ww(rr) / AND r,-(rr) - 8,13,11,15,13 cycles - Flags affected: -ZS0---- */
980980   ARG_rmw;
981   OP_AND8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
982   sm85cpu_mem_writebyte( r1, res & 0xFF );
981   OP_AND8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
982   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
983983   switch( r2 & 0xC0 ) {
984984   case 0x00:   mycycles += 8; break;
985985   case 0x40:   mycycles += 13; break;
r3957r3958
989989   break;
990990case 0x36:   /* OR r,@rr / OR r,(rr)+ / OR r,@ww / OR r,ww(rr) / OR r,-(rr) - 8,13,11,15,13 cycles - Flags affected: -ZS0---- */
991991   ARG_rmw;
992   OP_OR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
993   sm85cpu_mem_writebyte( r1, res & 0xFF );
992   OP_OR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
993   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
994994   switch( r2 & 0xC0 ) {
995995   case 0x00:   mycycles += 8; break;
996996   case 0x40:   mycycles += 13; break;
r3957r3958
10001000   break;
10011001case 0x37:   /* XOR? r,@rr / XOR r,(rr)+ / XOR r,@ww / XOR r,ww(rr) / XOR r,-(rr) - 8,13,11,15,13 cycles - Flagsaffected: -ZS0---- */
10021002   ARG_rmw;
1003   OP_XOR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( s2 ) );
1004   sm85cpu_mem_writebyte( r1, res & 0xFF );
1003   OP_XOR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, s2 ) );
1004   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
10051005   switch( r2 & 0xC0 ) {
10061006   case 0x00:   mycycles += 8; break;
10071007   case 0x40:   mycycles += 13; break;
r3957r3958
10111011   break;
10121012case 0x38:   /* MOV r,@rr / MOV r,(rr)+ / MOV r,@ww / MOV r,ww(rr) / MOV r,-(rr) - 8,13,11,15,13 cycles - Flags affected: -------- */
10131013   ARG_rmw;
1014   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( s2 ) );
1014   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, s2 ) );
10151015   switch( r2 & 0xC0 ) {
10161016   case 0x00:   mycycles += 8; break;
10171017   case 0x40:   mycycles += 13; break;
r3957r3958
10211021   break;
10221022case 0x39:   /* MOV @rr,r / MOV (rr)+,r / MOV @ww,r / MOV ww(rr),r /  MOV -(rr),r - 8,13,11,15,13 cycles - Flags affected: -------- */
10231023   ARG_rmw;
1024   sm85cpu_mem_writebyte( s2, sm85cpu_mem_readbyte( r1 ) );
1024   sm85cpu_mem_writebyte( cpustate, s2, sm85cpu_mem_readbyte( cpustate, r1 ) );
10251025   switch( r2 & 0xC0 ) {
10261026   case 0x00:   mycycles += 8; break;
10271027   case 0x40:   mycycles += 13; break;
r3957r3958
10311031   break;
10321032case 0x3A:   /* MOVW rr,@rr / MOV rr,(rr)+ / MOV rr,@ww / MOV rr,ww(rr) / MOV rr,-(rr) - 11,16,14,18,16 cycles - Flags affected: -------- */
10331033   ARG_smw;
1034   sm85cpu_mem_writeword( r1, sm85cpu_mem_readword( s2 ) );
1034   sm85cpu_mem_writeword( cpustate, r1, sm85cpu_mem_readword( cpustate, s2 ) );
10351035   switch( r2 & 0xC0 ) {
10361036   case 0x00:   mycycles += 11; break;
10371037   case 0x40:   mycycles += 16; break;
r3957r3958
10411041   break;
10421042case 0x3B:   /* MOVW @rr,rr / MOV (rr)+,rr / MOV @ww,rr / MOV ww(rr),rr / MOV -(rr),rr - 11,16,14,18,16 cycles - Flags affected: -------- */
10431043   ARG_smw;
1044   sm85cpu_mem_writeword( s2, sm85cpu_mem_readword( r1 ) );
1044   sm85cpu_mem_writeword( cpustate, s2, sm85cpu_mem_readword( cpustate, r1 ) );
10451045   switch( r2 & 0xC0 ) {
10461046   case 0x00:   mycycles += 11; break;
10471047   case 0x40:   mycycles += 16; break;
r3957r3958
10511051   break;
10521052case 0x3C:   /* MOVW RRr,RRs - 7 cycles - Flags affected: -------- */
10531053   ARG_ss;
1054   sm85cpu_mem_writeword( r1, sm85cpu_mem_readword( r2 ) );
1054   sm85cpu_mem_writeword( cpustate, r1, sm85cpu_mem_readword( cpustate, r2 ) );
10551055   mycycles += 7;
10561056   break;
10571057case 0x3D:   /* unk3D DM??? 3D 0E -> DM R0Eh ?? - 4,4 cycles */
1058logerror( "%04X: unk%02x\n", regs.PC-1,op );
1058logerror( "%04X: unk%02x\n", cpustate->PC-1,op );
10591059   mycycles += 4;
10601060   break;
10611061case 0x3E:   /* JMP RRr/@ww/ww(RRr) - 7/15/19 cycles - Flags affected: -------- */
10621062   ARG_2;
1063   regs.PC = s2;
1063   cpustate->PC = s2;
10641064   switch( r1 & 0xc0 ) {
10651065   case 0x00:   mycycles += 7; break;
10661066   case 0x40:   mycycles += ( ( r1 & 0x38 ) ? 19 : 15 ); break;
r3957r3958
10691069   break;
10701070case 0x3F:   /* CALL RRr/@ww/ww(RRr) - 11,14/22,19/26,23 cycles - Flags affected: -------- */
10711071   ARG_2;
1072   PUSH8( regs.PC & 0xFF );
1073   PUSH8( regs.PC >> 8 );
1074   regs.PC = s2;
1072   PUSH8( cpustate->PC & 0xFF );
1073   PUSH8( cpustate->PC >> 8 );
1074   cpustate->PC = s2;
10751075   switch( r1 & 0xc0 ) {
1076   case 0x00:   mycycles += ( ( regs.SYS & 0x40 ) ? 14 : 11 ); break;
1077   case 0x40:   mycycles += ( ( r1 & 0x38 ) ? ( ( regs.SYS & 0x40 ) ? 26 : 23 ) : ( ( regs.SYS & 0x40 ) ? 22 : 19 ) );break;
1076   case 0x00:   mycycles += ( ( cpustate->SYS & 0x40 ) ? 14 : 11 ); break;
1077   case 0x40:   mycycles += ( ( r1 & 0x38 ) ? ( ( cpustate->SYS & 0x40 ) ? 26 : 23 ) : ( ( cpustate->SYS & 0x40 ) ? 22 : 19 ) );break;
10781078   default:   mycycles += 4;
10791079   }
10801080   break;
10811081case 0x40:   /* CMP Rr,Rs - 6 cycles - Flags affected: CZSV---- */
10821082   ARG_RR;
1083   OP_CMP8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1083   OP_CMP8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
10841084   mycycles += 6;
10851085   break;
10861086case 0x41:   /* ADD Rr,Rs - 6 cycles - Flags affected: CZSV0H-- */
10871087   ARG_RR;
1088   OP_ADD8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1089   sm85cpu_mem_writebyte( r1, res & 0xFF );
1088   OP_ADD8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1089   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
10901090   mycycles += 6;
10911091   break;
10921092case 0x42:   /* SUB Rr,Rs - 6 cycles - Flags affected: CZSV1H-- */
10931093   ARG_RR;
1094   OP_SUB8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1095   sm85cpu_mem_writebyte( r1, res & 0xFF );
1094   OP_SUB8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1095   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
10961096   mycycles += 6;
10971097   break;
10981098case 0x43:   /* ADC Rr,Rs - 6 cycles - Flags affected: CZSV0H-- */
10991099   ARG_RR;
1100   OP_ADC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1101   sm85cpu_mem_writebyte( r1, res & 0xFF );
1100   OP_ADC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1101   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11021102   mycycles += 6;
11031103   break;
11041104case 0x44:   /* SBC Rr,Rs - 6 cycles - Flags affected: CZSV1H-- */
11051105   ARG_RR;
1106   OP_SBC8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1107   sm85cpu_mem_writebyte( r1, res & 0xFF );
1106   OP_SBC8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1107   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11081108   mycycles += 6;
11091109   break;
11101110case 0x45:   /* AND Rr,Rs - 6 cycles - Flags affected: -ZS0---- */
11111111   ARG_RR;
1112   OP_AND8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1113   sm85cpu_mem_writebyte( r1, res & 0xFF );
1112   OP_AND8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1113   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11141114   mycycles += 6;
11151115   break;
11161116case 0x46:   /* OR Rr,Rs - 6 cycles - Flags affected: -ZS0---- */
11171117   ARG_RR;
1118   OP_OR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1119   sm85cpu_mem_writebyte( r1, res & 0xFF );
1118   OP_OR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1119   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11201120   mycycles += 6;
11211121   break;
11221122case 0x47:   /* XOR Rr,Rs - 6 cycles - Flags affected: -ZS0---- */
11231123   ARG_RR;
1124   OP_XOR8( sm85cpu_mem_readbyte( r1 ), sm85cpu_mem_readbyte( r2 ) );
1125   sm85cpu_mem_writebyte( r1, res & 0xFF );
1124   OP_XOR8( sm85cpu_mem_readbyte( cpustate, r1 ), sm85cpu_mem_readbyte( cpustate, r2 ) );
1125   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11261126   mycycles += 6;
11271127   break;
11281128case 0x48:   /* MOV Rr,Rs - 6 cycles - Flags affected: -------- */
11291129   ARG_RR;
1130   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( r2 ) );
1130   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, r2 ) );
11311131   mycycles += 6;
11321132   break;
11331133case 0x49:   /* CALL ad16 - 12,10 - Flags affected: -------- */
11341134   ARG_ad16;
1135   PUSH8( regs.PC & 0xFF );
1136   PUSH8( regs.PC >> 8 );
1137   regs.PC = s2;
1138   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 10 );
1135   PUSH8( cpustate->PC & 0xFF );
1136   PUSH8( cpustate->PC >> 8 );
1137   cpustate->PC = s2;
1138   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 10 );
11391139   break;
11401140case 0x4A:   /* MOVW RRr,RRs - 8 cycles - Flags affected: -------- */
11411141   ARG_RR;
1142   sm85cpu_mem_writeword( r1, sm85cpu_mem_readword( r2 ) );
1142   sm85cpu_mem_writeword( cpustate, r1, sm85cpu_mem_readword( cpustate, r2 ) );
11431143   mycycles += 8;
11441144   break;
11451145case 0x4B:   /* MOVW RRr,ww - 9 cycles - Flags affected: -------- */
11461146   ARG_Sw;
1147   sm85cpu_mem_writeword( r1, s2 );
1147   sm85cpu_mem_writeword( cpustate, r1, s2 );
11481148        mycycles += 9;
11491149   break;
11501150case 0x4C:   /* MULT Rrr,Rs - 24 cycles - Flags affected: -Z-0---- */
11511151   ARG_RR;
1152   res = sm85cpu_mem_readword( r1 ) * sm85cpu_mem_readbyte( r2 );
1153   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1154   regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V );
1155   regs.PS1 |= ( ( res & 0xFFFF ) == 0x00 ? FLAG_Z : 0 );
1152   res = sm85cpu_mem_readword( cpustate, r1 ) * sm85cpu_mem_readbyte( cpustate, r2 );
1153   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
1154   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V );
1155   cpustate->PS1 |= ( ( res & 0xFFFF ) == 0x00 ? FLAG_Z : 0 );
11561156   mycycles += 24;
11571157   break;
11581158case 0x4D:   /* MULT RRr,i - 24 cycles - Flags affected: -Z-0---- */
11591159   ARG_iR;
1160   res = sm85cpu_mem_readbyte( r1 + 1 ) * r2;
1161   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1162   regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V );
1163   regs.PS1 |= ( ( res & 0xFFFF ) == 0x00 ? FLAG_Z : 0 );
1160   res = sm85cpu_mem_readbyte( cpustate, r1 + 1 ) * r2;
1161   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
1162   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V );
1163   cpustate->PS1 |= ( ( res & 0xFFFF ) == 0x00 ? FLAG_Z : 0 );
11641164   mycycles += 24;
11651165   break;
11661166case 0x4E:   /* BMOV Rr,#b,BF/BF,Rr,#b - 6 cycles - Flags affected: --------/-Z-0--B- */
1167   r2 = sm85cpu_mem_readbyte( regs.PC++ );
1168   r1 = sm85cpu_mem_readbyte( regs.PC++ );
1167   r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
1168   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
11691169   switch( r2 & 0xC0 ) {
11701170   case 0x00:
1171      res = sm85cpu_mem_readbyte( r1 );
1172      if ( regs.PS1 & FLAG_B ) {
1171      res = sm85cpu_mem_readbyte( cpustate, r1 );
1172      if ( cpustate->PS1 & FLAG_B ) {
11731173         res = res | ( 1 << ( r2 & 0x07 ) );
11741174      } else {
11751175         res = res & ~( 1 << ( r2 & 0x07 ) );
11761176      }
1177      sm85cpu_mem_writebyte( r1, res & 0xFF );
1177      sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
11781178      break;
11791179   case 0x40:
1180      regs.PS1 = regs.PS1 & ( FLAG_C | FLAG_S | FLAG_D | FLAG_H | FLAG_I );
1181      if ( sm85cpu_mem_readbyte( r1 ) & ( 1 << ( r2 & 0x07 ) ) ) {
1182         regs.PS1 = regs.PS1 | FLAG_B;
1180      cpustate->PS1 = cpustate->PS1 & ( FLAG_C | FLAG_S | FLAG_D | FLAG_H | FLAG_I );
1181      if ( sm85cpu_mem_readbyte( cpustate, r1 ) & ( 1 << ( r2 & 0x07 ) ) ) {
1182         cpustate->PS1 = cpustate->PS1 | FLAG_B;
11831183      } else {
1184         regs.PS1 = regs.PS1 | FLAG_Z;
1184         cpustate->PS1 = cpustate->PS1 | FLAG_Z;
11851185      }
11861186      break;
11871187   case 0x80:
r3957r3958
11911191   mycycles += 6;
11921192   break;
11931193case 0x4F:   /* BCMP/BAND/BOR/BXOR BF,Rr,#b - 6 cycles - Flags affected: -Z-0---- / -Z-0--B- */
1194   r2 = sm85cpu_mem_readbyte( regs.PC++ );
1195   r1 = sm85cpu_mem_readbyte( regs.PC++ );
1196   s1 = sm85cpu_mem_readbyte( r1 ) & ( 1 << ( r2 & 0x07 ) );
1197   s2 = ( ( regs.PS1 & FLAG_B ) >> 1 ) << ( r2 & 0x07 );
1194   r2 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
1195   r1 = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
1196   s1 = sm85cpu_mem_readbyte( cpustate, r1 ) & ( 1 << ( r2 & 0x07 ) );
1197   s2 = ( ( cpustate->PS1 & FLAG_B ) >> 1 ) << ( r2 & 0x07 );
11981198   switch( r2 & 0xC0 ) {
11991199   case 0x00:
1200      regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V );
1200      cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V );
12011201      if ( s1 == s2 ) {
1202         regs.PS1 = regs.PS1 | FLAG_Z;
1202         cpustate->PS1 = cpustate->PS1 | FLAG_Z;
12031203      }
12041204      break;
12051205   case 0x40:
1206      regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1207      regs.PS1 = regs.PS1 | ( ( s1 & s2 ) ? FLAG_B : FLAG_Z );
1206      cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1207      cpustate->PS1 = cpustate->PS1 | ( ( s1 & s2 ) ? FLAG_B : FLAG_Z );
12081208      break;
12091209   case 0x80:
1210      regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1211      regs.PS1 = regs.PS1 | ( ( s1 | s2 ) ? FLAG_B : FLAG_Z );
1210      cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1211      cpustate->PS1 = cpustate->PS1 | ( ( s1 | s2 ) ? FLAG_B : FLAG_Z );
12121212      break;
12131213   case 0xC0:
1214      regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1215      regs.PS1 = regs.PS1 | ( ( s1 ^ s2 ) ? FLAG_B : FLAG_Z );
1214      cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V | FLAG_B );
1215      cpustate->PS1 = cpustate->PS1 | ( ( s1 ^ s2 ) ? FLAG_B : FLAG_Z );
12161216      break;
12171217   }
12181218   mycycles += 6;
12191219   break;
12201220case 0x50:   /* CMP Rr,i - 6 cycles - Flags affected: CZSV---- */
12211221   ARG_iR;
1222   OP_CMP8( sm85cpu_mem_readbyte( r1 ), r2 );
1222   OP_CMP8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
12231223   mycycles += 6;
12241224   break;
12251225case 0x51:   /* ADD Rr,i - 6 cycles - Flags affected: CZSV0H-- */
12261226   ARG_iR;
1227   OP_ADD8( sm85cpu_mem_readbyte( r1 ), r2 );
1228   sm85cpu_mem_writebyte( r1, res & 0xFF );
1227   OP_ADD8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1228   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12291229   mycycles += 6;
12301230   break;
12311231case 0x52:   /* SUB Rr,i - 6 cycles - Flags affected: CZSV1H-- */
12321232   ARG_iR;
1233   OP_SUB8( sm85cpu_mem_readbyte( r1 ), r2 );
1234   sm85cpu_mem_writebyte( r1, res & 0xFF );
1233   OP_SUB8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1234   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12351235   mycycles += 6;
12361236   break;
12371237case 0x53:   /* ADC Rr,i - 6 cycles - Flags affected: CZSV0H-- */
12381238   ARG_iR;
1239   OP_ADC8( sm85cpu_mem_readbyte( r1 ), r2 );
1240   sm85cpu_mem_writebyte( r1, res & 0xFF );
1239   OP_ADC8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1240   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12411241   mycycles += 6;
12421242   break;
12431243case 0x54:   /* SBC Rr,i - 6 cycles - Flags affected: CZSV1H-- */
12441244   ARG_iR;
1245   OP_SBC8( sm85cpu_mem_readbyte( r1 ), r2 );
1246   sm85cpu_mem_writebyte( r1, res & 0xFF );
1245   OP_SBC8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1246   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12471247   mycycles += 6;
12481248   break;
12491249case 0x55:   /* AND Rr,i - 6 cycles - Flags affected: -ZS0---- */
12501250   ARG_iR;
1251   OP_AND8( sm85cpu_mem_readbyte( r1 ), r2 );
1252   sm85cpu_mem_writebyte( r1, res & 0xFF );
1251   OP_AND8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1252   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12531253   mycycles += 6;
12541254   break;
12551255case 0x56:   /* OR Rr,i - 6 cycles - Flags affected: -ZS0---- */
12561256   ARG_iR;
1257   OP_OR8( sm85cpu_mem_readbyte( r1 ), r2 );
1258   sm85cpu_mem_writebyte( r1, res & 0xFF );
1257   OP_OR8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1258   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12591259   mycycles += 6;
12601260   break;
12611261case 0x57:   /* XOR Rr,i - 6 cycles - Flags affected: -ZS0---- */
12621262   ARG_iR;
1263   OP_XOR8( sm85cpu_mem_readbyte( r1 ), r2 );
1264   sm85cpu_mem_writebyte( r1, res & 0xFF );
1263   OP_XOR8( sm85cpu_mem_readbyte( cpustate, r1 ), r2 );
1264   sm85cpu_mem_writebyte( cpustate, r1, res & 0xFF );
12651265   mycycles += 6;
12661266   break;
12671267case 0x58:   /* MOV Rr,i - 6 cycles - Flags affected: -------- */
12681268   ARG_iR;
1269   sm85cpu_mem_writebyte( r1, r2 );
1269   sm85cpu_mem_writebyte( cpustate, r1, r2 );
12701270        mycycles += 6;
12711271   break;
12721272case 0x59:   /* Invalid - 2? cycles - Flags affected: --------? */
1273   logerror( "%04X: 59h: Invalid instruction\n", regs.PC-1 );
1273   logerror( "%04X: 59h: Invalid instruction\n", cpustate->PC-1 );
12741274   mycycles += 2;
12751275   break;
12761276case 0x5A:   /* unk5A - 7,8,12,9,8 cycles */
1277logerror( "%04X: unk%02x\n", regs.PC-1,op );
1277logerror( "%04X: unk%02x\n", cpustate->PC-1,op );
12781278   ARG_ad16;
12791279   mycycles += 7;
12801280   break;
12811281case 0x5B:   /* unk5B - 6,7,11,8,7 cycles */
1282logerror( "%04X: unk%02x\n", regs.PC-1,op );
1282logerror( "%04X: unk%02x\n", cpustate->PC-1,op );
12831283   ARG_ad16;
12841284   mycycles += 6;
12851285   break;
12861286case 0x5C:   /* DIV RRr,RRs - 47 cycles - Flags affected: -Z-V---- */
12871287      /* lower 8 bits of RRs is used to divide */
12881288      /* remainder in stored upper 8 bits of RRs */
1289logerror( "%04X: DIV RRr,Rs!\n", regs.PC-1 );
1289logerror( "%04X: DIV RRr,Rs!\n", cpustate->PC-1 );
12901290   ARG_RR;
1291   regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V );
1292   s1 = sm85cpu_mem_readbyte( r2 + 1 );
1291   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V );
1292   s1 = sm85cpu_mem_readbyte( cpustate, r2 + 1 );
12931293   if ( s1 ) {
1294      UINT16 div = sm85cpu_mem_readword( r1 );
1294      UINT16 div = sm85cpu_mem_readword( cpustate, r1 );
12951295      res = div / s1;
1296      sm85cpu_mem_writebyte( r2, div % s1 );
1297      sm85cpu_mem_writeword( r1, res );
1298      regs.PS1 = regs.PS1 | ( ( res == 0 ) ? FLAG_Z : 0 );
1296      sm85cpu_mem_writebyte( cpustate, r2, div % s1 );
1297      sm85cpu_mem_writeword( cpustate, r1, res );
1298      cpustate->PS1 = cpustate->PS1 | ( ( res == 0 ) ? FLAG_Z : 0 );
12991299   } else {
1300      regs.PS1 = regs.PS1 | FLAG_V;
1300      cpustate->PS1 = cpustate->PS1 | FLAG_V;
13011301   }
13021302   mycycles += 47;
13031303   break;
13041304case 0x5D:   /* DIV RRr,i - 44 cycles - Flags affected: -Z-V---- */
1305logerror( "%04X: DIV RRr,i!\n", regs.PC-1 );
1305logerror( "%04X: DIV RRr,i!\n", cpustate->PC-1 );
13061306   ARG_iR;
1307   regs.PS1 = regs.PS1 & ~ ( FLAG_Z | FLAG_V );
1307   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_Z | FLAG_V );
13081308   if ( r2 ) {
1309      res = sm85cpu_mem_readword( r1 ) / r2;
1310      sm85cpu_mem_writeword( r1, res );
1311      regs.PS1 = regs.PS1 | ( ( res == 0 ) ? FLAG_Z : 0 );
1309      res = sm85cpu_mem_readword( cpustate, r1 ) / r2;
1310      sm85cpu_mem_writeword( cpustate, r1, res );
1311      cpustate->PS1 = cpustate->PS1 | ( ( res == 0 ) ? FLAG_Z : 0 );
13121312   } else {
1313      regs.PS1 = regs.PS1 | FLAG_V;
1313      cpustate->PS1 = cpustate->PS1 | FLAG_V;
13141314   }
13151315   mycycles += 44;
13161316   break;
13171317case 0x5E:   /* MOVM Rr,i,Rs - 9 cycles - Flags affected: -------- */
13181318   ARG_RiR;
1319   sm85cpu_mem_writebyte( r1, ( sm85cpu_mem_readbyte( r1 ) & d1 ) | sm85cpu_mem_readbyte( r2 ) );
1319   sm85cpu_mem_writebyte( cpustate, r1, ( sm85cpu_mem_readbyte( cpustate, r1 ) & d1 ) | sm85cpu_mem_readbyte( cpustate, r2 ) );
13201320   mycycles += 9;
13211321   break;
13221322case 0x5F:   /* MOVM Rr,i,j - 8 cycles - Flags affected: -------- */
13231323   ARG_Rii;
1324   sm85cpu_mem_writebyte( r1, ( sm85cpu_mem_readbyte( r1 ) & d1 ) | r2 );
1324   sm85cpu_mem_writebyte( cpustate, r1, ( sm85cpu_mem_readbyte( cpustate, r1 ) & d1 ) | r2 );
13251325   mycycles += 8;
13261326   break;
13271327case 0x60:   /* CMPW RRr,RRs - 9 cycles - Flags affected: CZSV---- */
13281328   ARG_RR;
1329   OP_CMP16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1329   OP_CMP16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
13301330   mycycles += 9;
13311331   break;
13321332case 0x61:   /* ADDW RRr,RRs - 10 cycles - Flags affected: CZSV0H-- */
13331333   ARG_RR;
1334   OP_ADD16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1335   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1334   OP_ADD16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1335   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13361336   mycycles += 10;
13371337   break;
13381338case 0x62:   /* SUBW RRr,RRs - 10 cycles - Flags affected: CZSV1H-- */
13391339   ARG_RR;
1340   OP_SUB16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1341   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1340   OP_SUB16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1341   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13421342   mycycles += 10;
13431343   break;
13441344case 0x63:   /* ADCW RRr,RRs - 10 cycles - Flags affected: CZSV0H-- */
13451345   ARG_RR;
1346   OP_ADC16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1347   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1346   OP_ADC16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1347   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13481348   mycycles += 10;
13491349   break;
13501350case 0x64:   /* SBCW RRr,RRs - 10 cycles - Flags affected: CZSV1H-- */
13511351   ARG_RR;
1352   OP_SBC16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1353   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1352   OP_SBC16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1353   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13541354   mycycles += 10;
13551355   break;
13561356case 0x65:   /* ANDW RRr,RRs - 14 cycles - Flags affected: -Z-0---- */
13571357   ARG_RR;
1358   OP_AND16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1359   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1358   OP_AND16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1359   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13601360   mycycles += 14;
13611361   break;
13621362case 0x66:   /* ORW RRr,RRs - 14 cycles - Flags affected: -Z-0---- */
13631363   ARG_RR;
1364   OP_OR16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1365   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1364   OP_OR16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1365   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13661366   mycycles += 14;
13671367   break;
13681368case 0x67:   /* XORW RRr,RRs - 14 cycles - Flags affected: -Z-0---- */
13691369   ARG_RR;
1370   OP_XOR16( sm85cpu_mem_readword( r1 ), sm85cpu_mem_readword( r2 ) );
1371   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1370   OP_XOR16( sm85cpu_mem_readword( cpustate, r1 ), sm85cpu_mem_readword( cpustate, r2 ) );
1371   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13721372   mycycles += 14;
13731373   break;
13741374case 0x68:   /* CMPW RRr,w - 9 cycles - Flags affected: CZSV---- */
13751375   ARG_Sw;
1376   OP_CMP16( sm85cpu_mem_readword( r1 ), s2 );
1376   OP_CMP16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
13771377   mycycles += 9;
13781378   break;
13791379case 0x69:   /* ADDW RRr,w - 10 cycles - Flags affected: CZSV0H-- */
13801380   ARG_Sw;
1381   OP_ADD16( sm85cpu_mem_readword( r1 ), s2 );
1382   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1381   OP_ADD16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1382   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13831383   mycycles += 10;
13841384   break;
13851385case 0x6A:   /* SUBW RRr,w - 10 cycles - Flags affected: CZSV1H-- */
13861386   ARG_Sw;
1387   OP_SUB16( sm85cpu_mem_readword( r1 ), s2 );
1388   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1387   OP_SUB16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1388   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13891389   mycycles += 10;
13901390   break;
13911391case 0x6B:   /* ADCW RRr,w - 10 cycles - Flags affected: CZSV0H-- */
13921392   ARG_Sw;
1393   OP_ADC16( sm85cpu_mem_readword( r1 ), s2 );
1394   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1393   OP_ADC16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1394   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
13951395   mycycles += 10;
13961396   break;
13971397case 0x6C:   /* SBCW RRr,w - 10 cycles - Flags affected: CZSV1H-- */
13981398   ARG_Sw;
1399   OP_SBC16( sm85cpu_mem_readword( r1 ), s2 );
1400   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1399   OP_SBC16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1400   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
14011401   mycycles += 10;
14021402   break;
14031403case 0x6D:   /* ANDW RRr,w - 13 cycles - Flags affected: -Z-0---- */
14041404   ARG_Sw;
1405   OP_AND16( sm85cpu_mem_readword( r1 ), s2 );
1406   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1405   OP_AND16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1406   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
14071407   mycycles += 13;
14081408   break;
14091409case 0x6E:   /* ORW RRr,w - 13 cycles - Flags affected: -Z-0---- */
14101410   ARG_Sw;
1411   OP_OR16( sm85cpu_mem_readword( r1 ), s2 );
1412   sm85cpu_mem_writeword( r1, res & 0xFFFF );
1411   OP_OR16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1412   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF );
14131413   mycycles += 13;
14141414   break;
14151415case 0x6F:   /* XORW RRr,w - 13 cycles - Flags affected: -Z-0---- */
14161416   ARG_Sw;
1417   OP_XOR16( sm85cpu_mem_readword( r1 ), s2 );
1418   sm85cpu_mem_writeword( r1, res & 0xFFFF);
1417   OP_XOR16( sm85cpu_mem_readword( cpustate, r1 ), s2 );
1418   sm85cpu_mem_writeword( cpustate, r1, res & 0xFFFF);
14191419   mycycles += 13;
14201420   break;
14211421case 0x70:   /* DBNZ r,rel8 - 10,6 cycles - Flags affected: -------- */
r3957r3958
14271427case 0x76:
14281428case 0x77:
14291429   ARG_d8;
1430   r1 = sm85cpu_mem_readbyte( op & 0x07 );
1430   r1 = sm85cpu_mem_readbyte( cpustate, op & 0x07 );
14311431   r1--;
1432   sm85cpu_mem_writebyte( op & 0x07, r1 );
1432   sm85cpu_mem_writebyte( cpustate, op & 0x07, r1 );
14331433   if ( r1 != 0 ) {
1434      regs.PC = s2;
1434      cpustate->PC = s2;
14351435      mycycles += 10;
14361436   } else {
14371437      mycycles += 6;
r3957r3958
14461446case 0x7E:
14471447case 0x7F:
14481448   ARG_rrw;
1449   sm85cpu_mem_writeword( r1, s2 );
1449   sm85cpu_mem_writeword( cpustate, r1, s2 );
14501450        mycycles += 6;
14511451   break;
14521452case 0x80:   /* BBC R,#b,d8 - 10,6 cycles - Flags affected: -------- */
r3957r3958
14581458case 0x86:
14591459case 0x87:
14601460   ARG_Rbr;
1461   if ( ( sm85cpu_mem_readbyte( r1 ) & ( 1 << (op & 0x07) ) ) == 0 ) {
1462      regs.PC = s2;
1461   if ( ( sm85cpu_mem_readbyte( cpustate, r1 ) & ( 1 << (op & 0x07) ) ) == 0 ) {
1462      cpustate->PC = s2;
14631463      mycycles += 10;
14641464   } else {
14651465      mycycles += 6;
r3957r3958
14741474case 0x8E:
14751475case 0x8F:
14761476   ARG_Rbr;
1477   if ( ( sm85cpu_mem_readbyte( r1 ) & ( 1 << (op & 0x07) ) ) ) {
1478      regs.PC = s2;
1477   if ( ( sm85cpu_mem_readbyte( cpustate, r1 ) & ( 1 << (op & 0x07) ) ) ) {
1478      cpustate->PC = s2;
14791479      mycycles += 10;
14801480   } else {
14811481      mycycles += 6;
r3957r3958
15001500   ARG_ad16;
15011501   CHECK_CC;
15021502   if ( res ) {
1503      regs.PC = s2;
1503      cpustate->PC = s2;
15041504   }
15051505   mycycles += 6;
15061506   break;
r3957r3958
15131513case 0xA6:
15141514case 0xA7:
15151515   ARG_R;
1516   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( r1 ) & ~ ( 1 << (op & 0x07) ) );
1516   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, r1 ) & ~ ( 1 << (op & 0x07) ) );
15171517   mycycles += 4;
15181518   break;
15191519case 0xA8:   /* BSET R,#b - 4 cycles - Flags affected: -------- */
r3957r3958
15251525case 0xAE:
15261526case 0xAF:
15271527   ARG_R;
1528   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( r1 ) | ( 1 << (op & 0x07) ) );
1528   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, r1 ) | ( 1 << (op & 0x07) ) );
15291529   mycycles += 4;
15301530   break;
15311531case 0xB0:   /* MOV Rx,Rr - 4 cycles - Flags affected: -------- */
r3957r3958
15371537case 0xB6:
15381538case 0xB7:
15391539   ARG_rR;
1540   sm85cpu_mem_writebyte( r1, sm85cpu_mem_readbyte( r2 ) );
1540   sm85cpu_mem_writebyte( cpustate, r1, sm85cpu_mem_readbyte( cpustate, r2 ) );
15411541   mycycles += 4;
15421542   break;
15431543case 0xB8:   /* MOV Rr,Rx - 4 cycles - Flags affected: -------- */
r3957r3958
15491549case 0xBE:
15501550case 0xBF:
15511551   ARG_rR;
1552   sm85cpu_mem_writebyte( r2, sm85cpu_mem_readbyte( r1 ) );
1552   sm85cpu_mem_writebyte( cpustate, r2, sm85cpu_mem_readbyte( cpustate, r1 ) );
15531553   mycycles += 4;
15541554   break;
15551555case 0xC0:   /* MOV Rx,i - 4 cycles - Flags affected: -------- */
r3957r3958
15611561case 0xC6:
15621562case 0xC7:
15631563   ARG_ri;
1564   sm85cpu_mem_writebyte( r1, r2 );
1564   sm85cpu_mem_writebyte( cpustate, r1, r2 );
15651565        mycycles += 4;
15661566   break;
15671567case 0xC8:   /* MOV IE0/IE1/IR0/IR1/P0/P1/P2/P3,i - 4 cycles - Flags affected: -------- */
r3957r3958
15731573case 0xCE:
15741574case 0xCF:
15751575   ARG_pi;
1576   sm85cpu_mem_writebyte( r1, r2 );
1576   sm85cpu_mem_writebyte( cpustate, r1, r2 );
15771577   mycycles += 4;
15781578   break;
15791579case 0xD0:   /* BR cc,rel8 - 8,4 cycles - Flags affected: -------- */
r3957r3958
15951595   ARG_d8;
15961596   CHECK_CC;
15971597   if ( res ) {
1598      regs.PC = s2;
1598      cpustate->PC = s2;
15991599      mycycles += 8;
16001600   } else {
16011601      mycycles += 4;
r3957r3958
16191619case 0xEF:   /* CALS 1xWW - 12,9 cycles - Flags affected: -------- */
16201620   ARG_R;
16211621   s2 = 0x1000 + ( ( op & 0x0F ) << 8 ) + r1;
1622   PUSH8( regs.PC & 0xFF );
1623   PUSH8( regs.PC >> 8 );
1624   regs.PC = s2;
1625   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 9 );
1622   PUSH8( cpustate->PC & 0xFF );
1623   PUSH8( cpustate->PC >> 8 );
1624   cpustate->PC = s2;
1625   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 9 );
16261626   break;
16271627case 0xF0:   /* STOP - 2 cycles - Flags affected: -------- */
16281628   mycycles += 2;
1629   if ( regs.clock_changed ) {
1629   if ( cpustate->clock_changed ) {
16301630      /* TODO: Set system clock divider */
16311631      /* TODO: Add a bunch of additional cycles */
1632      regs.clock_changed = 0;
1632      cpustate->clock_changed = 0;
16331633        }
16341634   break;
16351635case 0xF1:   /* HALT - 2 cycles - Flags affected: -------- */
1636   regs.halted = 1;
1636   cpustate->halted = 1;
16371637   mycycles += 2;
16381638   break;
16391639case 0xF2:   /* Invalid - 2? cycles - Flags affected: --------? */
r3957r3958
16471647case 0xF8:   /* RET - 10,8 cycles - Flags affected: -------- */
16481648   POP8( r1 );
16491649   POP8( r2 );
1650   regs.PC = ( r1 << 8 ) | r2;
1651   mycycles += ( ( regs.SYS & 0x40 ) ? 10 : 8 );
1650   cpustate->PC = ( r1 << 8 ) | r2;
1651   mycycles += ( ( cpustate->SYS & 0x40 ) ? 10 : 8 );
16521652   break;
16531653case 0xF9:   /* IRET - 12,10 cycles - Flags affected: CZSVDHBI */
1654   POP8( regs.PS1 );
1654   POP8( cpustate->PS1 );
16551655   POP8( r1 );
16561656   POP8( r2 );
1657   regs.PC = ( r1 << 8 ) | r2;
1658   mycycles += ( ( regs.SYS & 0x40 ) ? 12 : 10 );
1657   cpustate->PC = ( r1 << 8 ) | r2;
1658   mycycles += ( ( cpustate->SYS & 0x40 ) ? 12 : 10 );
16591659   break;
16601660case 0xFA:   /* CLRC - 2 cycles - Flags affected: C------- */
1661   regs.PS1 = regs.PS1 & ~ ( FLAG_C );
1661   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_C );
16621662   mycycles += 2;
16631663   break;
16641664case 0xFB:   /* COMC - 2 cycles - Flags affected: C------- */
1665   regs.PS1 = regs.PS1 ^ FLAG_C;
1665   cpustate->PS1 = cpustate->PS1 ^ FLAG_C;
16661666   mycycles += 2;
16671667   break;
16681668case 0xFC:   /* SETC - 2 cycles - Flags affected: C------- */
1669   regs.PS1 = regs.PS1 | FLAG_C;
1669   cpustate->PS1 = cpustate->PS1 | FLAG_C;
16701670   mycycles += 2;
16711671   break;
16721672case 0xFD:   /* EI - 2 cycles - Flags affected: -------I */
1673   regs.PS1 = regs.PS1 | FLAG_I;
1673   cpustate->PS1 = cpustate->PS1 | FLAG_I;
16741674        mycycles += 2;
16751675   break;
16761676case 0xFE:   /* DI - 2 cycles - Flags affected: -------I */
1677   regs.PS1 = regs.PS1 & ~ ( FLAG_I );
1677   cpustate->PS1 = cpustate->PS1 & ~ ( FLAG_I );
16781678        mycycles += 2;
16791679   break;
16801680case 0xFF:   /* NOP - 2 cycles - Flags affected: -------- */
src/emu/cpu/sm8500/sm8500.c
r3957r3958
2121#define FLAG_B   0x02
2222#define FLAG_I   0x01
2323
24typedef struct {
24typedef struct _sm8500_state sm8500_state;
25struct _sm8500_state
26{
2527   SM8500_CONFIG config;
2628   UINT16 PC;
2729   UINT8 *register_base;
r3957r3958
4648   UINT8 IFLAGS;
4749   UINT8 CheckInterrupts;
4850   int halted;
51   int icount;
4952   cpu_irq_callback irq_callback;
5053   const device_config *device;
5154   const address_space *program;
5255   UINT8 internal_ram[0x500];
53} sm8500_regs;
56};
5457
55static sm8500_regs regs;
56
57/* nr of cycles to run */
58static int sm8500_icount;
59
6058static const UINT8 sm8500_b2w[8] = {
6159        0, 8, 2, 10, 4, 12, 6, 14
6260};
6361
64UINT8 sm85cpu_mem_readbyte( UINT32 offset ) {
65   return ( offset < 0x10 ) ? regs.register_base[offset] : memory_read_byte_8be( regs.program, offset );
62UINT8 sm85cpu_mem_readbyte( sm8500_state *cpustate, UINT32 offset ) {
63   return ( offset < 0x10 ) ? cpustate->register_base[offset] : memory_read_byte_8be( cpustate->program, offset );
6664}
6765
68void sm85cpu_mem_writebyte( UINT32 offset, UINT8 data ) {
66void sm85cpu_mem_writebyte( sm8500_state *cpustate, UINT32 offset, UINT8 data ) {
6967   if ( offset < 0x10 ) {
70      regs.register_base[offset] = data;
68      cpustate->register_base[offset] = data;
7169   } else {
72      memory_write_byte_8be( regs.program, offset, data );
70      memory_write_byte_8be( cpustate->program, offset, data );
7371   }
7472}
7573
76UINT8* sm8500_internal_ram( void )
74INLINE UINT16 sm85cpu_mem_readword( sm8500_state *cpustate, UINT32 address )
7775{
78   return regs.internal_ram;
76   UINT16 value = (UINT16) sm85cpu_mem_readbyte( cpustate, address ) << 8;
77   value |= sm85cpu_mem_readbyte( cpustate, ( address + 1 ) & 0xffff );
78   return value;
7979}
8080
81static CPU_INIT( sm8500 ) {
82   regs.irq_callback = irqcallback;
83   regs.device = device;
84   regs.program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
81INLINE void sm85cpu_mem_writeword( sm8500_state *cpustate, UINT32 address, UINT16 value )
82{
83   sm85cpu_mem_writebyte( cpustate, address, value >> 8 );
84   sm85cpu_mem_writebyte( cpustate, ( address + 1 ) & 0xffff, value & 0xff );
85}
86
87static CPU_INIT( sm8500 )
88{
89   sm8500_state *cpustate = device->token;
90
91   cpustate->irq_callback = irqcallback;
92   cpustate->device = device;
93   cpustate->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
8594   if ( device->static_config != NULL ) {
86      regs.config.handle_dma = ((SM8500_CONFIG *)device->static_config)->handle_dma;
87      regs.config.handle_timers = ((SM8500_CONFIG *)device->static_config)->handle_timers;
95      cpustate->config.handle_dma = ((SM8500_CONFIG *)device->static_config)->handle_dma;
96      cpustate->config.handle_timers = ((SM8500_CONFIG *)device->static_config)->handle_timers;
8897   } else {
89      regs.config.handle_dma = NULL;
90      regs.config.handle_timers = NULL;
98      cpustate->config.handle_dma = NULL;
99      cpustate->config.handle_timers = NULL;
91100   }
92   regs.register_base = regs.internal_ram;
101   cpustate->register_base = cpustate->internal_ram;
93102}
94103
95104static CPU_RESET( sm8500 )
96105{
97   regs.PC = 0x1020;
98   regs.IE0 = 0;
99   regs.IE1 = 0;
100   regs.IR0 = 0;
101   regs.IR1 = 0;
102   regs.P0 = 0xFF;
103   regs.P1 = 0xFF;
104   regs.P2 = 0xFF;
105   regs.P3 = 0;
106   regs.SYS = 0;
107   regs.CKC = 0; regs.clock_changed = 0;
108   regs.PS1 = 0;
109   regs.register_base = regs.internal_ram;
110   regs.halted = 0;
106   sm8500_state *cpustate = device->token;
107
108   cpustate->PC = 0x1020;
109   cpustate->IE0 = 0;
110   cpustate->IE1 = 0;
111   cpustate->IR0 = 0;
112   cpustate->IR1 = 0;
113   cpustate->P0 = 0xFF;
114   cpustate->P1 = 0xFF;
115   cpustate->P2 = 0xFF;
116   cpustate->P3 = 0;
117   cpustate->SYS = 0;
118   cpustate->CKC = 0; cpustate->clock_changed = 0;
119   cpustate->PS1 = 0;
120   cpustate->register_base = cpustate->internal_ram;
121   cpustate->halted = 0;
111122}
112123
113124static CPU_EXIT( sm8500 )
114125{
115126}
116127
117#define PUSH_BYTE(X)   regs.SP = regs.SP - 1; \
118         if ( ( regs.SYS & 0x40 ) == 0 ) { \
119            regs.SP = regs.SP & 0xFF; \
128#define PUSH_BYTE(X)   cpustate->SP = cpustate->SP - 1; \
129         if ( ( cpustate->SYS & 0x40 ) == 0 ) { \
130            cpustate->SP = cpustate->SP & 0xFF; \
120131         } \
121         sm85cpu_mem_writebyte( regs.SP, X );
132         sm85cpu_mem_writebyte( cpustate, cpustate->SP, X );
122133
123INLINE void sm8500_do_interrupt(UINT16 vector) {
134INLINE void sm8500_do_interrupt(sm8500_state *cpustate, UINT16 vector) {
124135   /* Push PC */
125   PUSH_BYTE( regs.PC & 0xFF );
126   PUSH_BYTE( regs.PC >> 8 );
136   PUSH_BYTE( cpustate->PC & 0xFF );
137   PUSH_BYTE( cpustate->PC >> 8 );
127138   /* Push PS1 */
128   PUSH_BYTE( regs.PS1 );
139   PUSH_BYTE( cpustate->PS1 );
129140   /* Clear I flag */
130   regs.PS1 &= ~ 0x01;
141   cpustate->PS1 &= ~ 0x01;
131142   /* Change PC to address stored at "vector" */
132   regs.PC = sm85cpu_mem_readword( vector );
143   cpustate->PC = sm85cpu_mem_readword( cpustate, vector );
133144}
134145
135INLINE void sm8500_process_interrupts(void) {
136   if ( regs.CheckInterrupts ) {
146INLINE void sm8500_process_interrupts(sm8500_state *cpustate) {
147   if ( cpustate->CheckInterrupts ) {
137148      int irqline = 0;
138149      while( irqline < 11 ) {
139         if ( regs.IFLAGS & ( 1 << irqline ) ) {
140            regs.halted = 0;
150         if ( cpustate->IFLAGS & ( 1 << irqline ) ) {
151            cpustate->halted = 0;
141152            switch( irqline ) {
142153            case ILL_INT:
143               sm8500_do_interrupt( 0x101C );
154               sm8500_do_interrupt( cpustate, 0x101C );
144155               break;
145156            case WDT_INT:
146               sm8500_do_interrupt( 0x101E );
157               sm8500_do_interrupt( cpustate, 0x101E );
147158               break;
148159            case NMI_INT:
149               sm8500_do_interrupt( 0x101E );
160               sm8500_do_interrupt( cpustate, 0x101E );
150161               break;
151162            case DMA_INT:
152               regs.IR0 |= 0x80;
153               if ( ( regs.IE0 & 0x80 ) && ( ( regs.PS0 & 0x07 ) < 8 ) && ( regs.PS1 & 0x01 ) ) {
154                  sm8500_do_interrupt( 0x1000 );
163               cpustate->IR0 |= 0x80;
164               if ( ( cpustate->IE0 & 0x80 ) && ( ( cpustate->PS0 & 0x07 ) < 8 ) && ( cpustate->PS1 & 0x01 ) ) {
165                  sm8500_do_interrupt( cpustate, 0x1000 );
155166               }
156167               break;
157168            case TIM0_INT:
158               regs.IR0 |= 0x40;
159               if ( ( regs.IE0 & 0x40 ) && ( ( regs.PS0 & 0x07 ) < 8 ) && ( regs.PS1 & 0x01 ) ) {
160                  sm8500_do_interrupt( 0x1002 );
169               cpustate->IR0 |= 0x40;
170               if ( ( cpustate->IE0 & 0x40 ) && ( ( cpustate->PS0 & 0x07 ) < 8 ) && ( cpustate->PS1 & 0x01 ) ) {
171                  sm8500_do_interrupt( cpustate, 0x1002 );
161172               }
162173               break;
163174            case EXT_INT:
164               regs.IR0 |= 0x10;
165               if ( ( regs.IE0 & 0x10 ) && ( ( regs.PS0 & 0x07 ) < 7 ) && ( regs.PS1 & 0x01 ) ) {
166                  sm8500_do_interrupt( 0x1006 );
175               cpustate->IR0 |= 0x10;
176               if ( ( cpustate->IE0 & 0x10 ) && ( ( cpustate->PS0 & 0x07 ) < 7 ) && ( cpustate->PS1 & 0x01 ) ) {
177                  sm8500_do_interrupt( cpustate, 0x1006 );
167178               }
168179               break;
169180            case UART_INT:
170               regs.IR0 |= 0x08;
171               if ( ( regs.IE0 & 0x08 ) && ( ( regs.PS0 & 0x07 ) < 6 ) && ( regs.PS1 & 0x01 ) ) {
172                  sm8500_do_interrupt( 0x1008 );
181               cpustate->IR0 |= 0x08;
182               if ( ( cpustate->IE0 & 0x08 ) && ( ( cpustate->PS0 & 0x07 ) < 6 ) && ( cpustate->PS1 & 0x01 ) ) {
183                  sm8500_do_interrupt( cpustate, 0x1008 );
173184               }
174185               break;
175186            case LCDC_INT:
176               regs.IR0 |= 0x01;
177               if ( ( regs.IE0 & 0x01 ) && ( ( regs.PS0 & 0x07 ) < 5 ) && ( regs.PS1 & 0x01 ) ) {
178                  sm8500_do_interrupt( 0x100E );
187               cpustate->IR0 |= 0x01;
188               if ( ( cpustate->IE0 & 0x01 ) && ( ( cpustate->PS0 & 0x07 ) < 5 ) && ( cpustate->PS1 & 0x01 ) ) {
189                  sm8500_do_interrupt( cpustate, 0x100E );
179190               }
180191               break;
181192            case TIM1_INT:
182               regs.IR1 |= 0x40;
183               if ( ( regs.IE1 & 0x40 ) && ( ( regs.PS0 & 0x07 ) < 4 ) && ( regs.PS1 & 0x01 ) ) {
184                  sm8500_do_interrupt( 0x1012 );
193               cpustate->IR1 |= 0x40;
194               if ( ( cpustate->IE1 & 0x40 ) && ( ( cpustate->PS0 & 0x07 ) < 4 ) && ( cpustate->PS1 & 0x01 ) ) {
195                  sm8500_do_interrupt( cpustate, 0x1012 );
185196               }
186197               break;
187198            case CK_INT:
188               regs.IR1 |= 0x10;
189               if ( ( regs.IE1 & 0x10 ) && ( ( regs.PS0 & 0x07 ) < 3 ) && ( regs.PS1 & 0x01 ) ) {
190                  sm8500_do_interrupt( 0x1016 );
199               cpustate->IR1 |= 0x10;
200               if ( ( cpustate->IE1 & 0x10 ) && ( ( cpustate->PS0 & 0x07 ) < 3 ) && ( cpustate->PS1 & 0x01 ) ) {
201                  sm8500_do_interrupt( cpustate, 0x1016 );
191202               }
192203               break;
193204            case PIO_INT:
194               regs.IR1 |= 0x04;
195               if ( ( regs.IE1 & 0x04 ) && ( ( regs.PS0 & 0x07 ) < 2 ) && ( regs.PS1 & 0x01 ) ) {
196                  sm8500_do_interrupt( 0x101A );
205               cpustate->IR1 |= 0x04;
206               if ( ( cpustate->IE1 & 0x04 ) && ( ( cpustate->PS0 & 0x07 ) < 2 ) && ( cpustate->PS1 & 0x01 ) ) {
207                  sm8500_do_interrupt( cpustate, 0x101A );
197208               }
198209               break;
199210            }
200            regs.IFLAGS &= ~ ( 1 << irqline );
211            cpustate->IFLAGS &= ~ ( 1 << irqline );
201212         }
202213         irqline++;
203214      }
r3957r3958
206217
207218static CPU_EXECUTE( sm8500 )
208219{
220   sm8500_state *cpustate = device->token;
209221   UINT8   op;
210222   UINT16 oldpc;
211223   int   mycycles;
212224
213   sm8500_icount = cycles;
225   cpustate->icount = cycles;
214226
215227   do
216228   {
r3957r3958
219231      UINT32   d1,d2;
220232      UINT32   res;
221233
222      debugger_instruction_hook(device, regs.PC);
223      oldpc = regs.PC;
234      debugger_instruction_hook(device, cpustate->PC);
235      oldpc = cpustate->PC;
224236      mycycles = 0;
225      sm8500_process_interrupts();
226      if ( !regs.halted ) {
227         op = sm85cpu_mem_readbyte( regs.PC++ );
237      sm8500_process_interrupts(cpustate);
238      if ( !cpustate->halted ) {
239         op = sm85cpu_mem_readbyte( cpustate, cpustate->PC++ );
228240         switch( op )
229241         {
230242#include "sm85ops.h"
231243         }
232244      } else {
233245         mycycles = 4;
234         if ( regs.config.handle_dma ) {
235            regs.config.handle_dma( mycycles );
246         if ( cpustate->config.handle_dma ) {
247            cpustate->config.handle_dma( device, mycycles );
236248         }
237249      }
238      if ( regs.config.handle_timers ) {
239         regs.config.handle_timers( mycycles );
250      if ( cpustate->config.handle_timers ) {
251         cpustate->config.handle_timers( device, mycycles );
240252      }
241      sm8500_icount -= mycycles;
242   } while ( sm8500_icount > 0 );
253      cpustate->icount -= mycycles;
254   } while ( cpustate->icount > 0 );
243255
244   return cycles - sm8500_icount;
256   return cycles - cpustate->icount;
245257}
246258
247259static CPU_BURN( sm8500 )
248260{
261   sm8500_state *cpustate = device->token;
262
249263   if ( cycles > 0 ) {
250264      /* burn a number of 4 cycles */
251265      int n = ( cycles + 3 ) / 4;
252      sm8500_icount -= 4 * n;
266      cpustate->icount -= 4 * n;
253267   }
254268}
255269
256unsigned sm8500_get_reg( int regnum )
270unsigned sm8500_get_reg( sm8500_state *cpustate, int regnum )
257271{
258272   switch( regnum )
259273   {
260   case REG_PC:
261   case SM8500_PC:      return regs.PC;
262   case REG_SP:
263   case SM8500_SP:      return ( regs.SYS & 0x40 ) ? regs.SP : regs.SP & 0xFF ;
264   case SM8500_PS:      return ( regs.PS0 << 8 ) | regs.PS1;
265   case SM8500_SYS16:   return regs.SYS;
266   case SM8500_RR0:   return sm85cpu_mem_readword( 0x00 );
267   case SM8500_RR2:   return sm85cpu_mem_readword( 0x02 );
268   case SM8500_RR4:   return sm85cpu_mem_readword( 0x04 );
269   case SM8500_RR6:   return sm85cpu_mem_readword( 0x06 );
270   case SM8500_RR8:   return sm85cpu_mem_readword( 0x08 );
271   case SM8500_RR10:   return sm85cpu_mem_readword( 0x0A );
272   case SM8500_RR12:   return sm85cpu_mem_readword( 0x0C );
273   case SM8500_RR14:   return sm85cpu_mem_readword( 0x0E );
274   case SM8500_IE0:   return regs.IE0;
275   case SM8500_IE1:   return regs.IE1;
276   case SM8500_IR0:   return regs.IR0;
277   case SM8500_IR1:   return regs.IR1;
278   case SM8500_P0:      return regs.P0;
279   case SM8500_P1:      return regs.P1;
280   case SM8500_P2:      return regs.P2;
281   case SM8500_P3:      return regs.P3;
282   case SM8500_SYS:   return regs.SYS;
283   case SM8500_CKC:   return regs.CKC;
284   case SM8500_SPH:   return (regs.SP >> 8);
285   case SM8500_SPL:   return regs.SP & 0xFF;
286   case SM8500_PS0:   return regs.PS0;
287   case SM8500_PS1:   return regs.PS1;
288   case SM8500_P0C:   return regs.P0C;
289   case SM8500_P1C:   return regs.P1C;
290   case SM8500_P2C:   return regs.P2C;
291   case SM8500_P3C:   return regs.P3C;
274   case REG_GENPC:
275   case SM8500_PC:      return cpustate->PC;
276   case REG_GENSP:
277   case SM8500_SP:      return ( cpustate->SYS & 0x40 ) ? cpustate->SP : cpustate->SP & 0xFF ;
278   case SM8500_PS:      return ( cpustate->PS0 << 8 ) | cpustate->PS1;
279   case SM8500_SYS16:   return cpustate->SYS;
280   case SM8500_RR0:   return sm85cpu_mem_readword( cpustate, 0x00 );
281   case SM8500_RR2:   return sm85cpu_mem_readword( cpustate, 0x02 );
282   case SM8500_RR4:   return sm85cpu_mem_readword( cpustate, 0x04 );
283   case SM8500_RR6:   return sm85cpu_mem_readword( cpustate, 0x06 );
284   case SM8500_RR8:   return sm85cpu_mem_readword( cpustate, 0x08 );
285   case SM8500_RR10:   return sm85cpu_mem_readword( cpustate, 0x0A );
286   case SM8500_RR12:   return sm85cpu_mem_readword( cpustate, 0x0C );
287   case SM8500_RR14:   return sm85cpu_mem_readword( cpustate, 0x0E );
288   case SM8500_IE0:   return cpustate->IE0;
289   case SM8500_IE1:   return cpustate->IE1;
290   case SM8500_IR0:   return cpustate->IR0;
291   case SM8500_IR1:   return cpustate->IR1;
292   case SM8500_P0:      return cpustate->P0;
293   case SM8500_P1:      return cpustate->P1;
294   case SM8500_P2:      return cpustate->P2;
295   case SM8500_P3:      return cpustate->P3;
296   case SM8500_SYS:   return cpustate->SYS;
297   case SM8500_CKC:   return cpustate->CKC;
298   case SM8500_SPH:   return (cpustate->SP >> 8);
299   case SM8500_SPL:   return cpustate->SP & 0xFF;
300   case SM8500_PS0:   return cpustate->PS0;
301   case SM8500_PS1:   return cpustate->PS1;
302   case SM8500_P0C:   return cpustate->P0C;
303   case SM8500_P1C:   return cpustate->P1C;
304   case SM8500_P2C:   return cpustate->P2C;
305   case SM8500_P3C:   return cpustate->P3C;
292306   }
293307   return 0;
294308}
295309
296static void sm8500_set_reg( int regnum, unsigned val )
310static void sm8500_set_reg( sm8500_state *cpustate, int regnum, unsigned val )
297311{
298312   switch( regnum )
299313   {
300   case REG_PC:
301   case SM8500_PC:      regs.PC = val; break;
302   case REG_SP:
303   case SM8500_SP:      regs.SP = val; break;
304   case SM8500_PS:      sm8500_set_reg( SM8500_PS0, ( val >> 8 ) & 0xFF ); sm8500_set_reg( SM8500_PS1, val & 0xFF ); break;
305   case SM8500_SYS16:   regs.SYS = val; break;
306   case SM8500_RR0:   sm85cpu_mem_writeword( 0x00, val); break;
307   case SM8500_RR2:   sm85cpu_mem_writeword( 0x02, val); break;
308   case SM8500_RR4:   sm85cpu_mem_writeword( 0x04, val); break;
309   case SM8500_RR6:   sm85cpu_mem_writeword( 0x06, val); break;
310   case SM8500_RR8:   sm85cpu_mem_writeword( 0x08, val); break;
311   case SM8500_RR10:   sm85cpu_mem_writeword( 0x0A, val); break;
312   case SM8500_RR12:   sm85cpu_mem_writeword( 0x0C, val); break;
313   case SM8500_RR14:   sm85cpu_mem_writeword( 0x0E, val); break;
314   case SM8500_IE0:   regs.IE0 = val; break;
315   case SM8500_IE1:   regs.IE1 = val; break;
316   case SM8500_IR0:   regs.IR0 = val; break;
317   case SM8500_IR1:   regs.IR1 = val; break;
318   case SM8500_P0:      regs.P0 = val; break;
319   case SM8500_P1:      regs.P1 = val; break;
320   case SM8500_P2:      regs.P2 = val; break;
321   case SM8500_P3:      regs.P3 = val; break;
322   case SM8500_SYS:   regs.SYS = val; break;
323   case SM8500_CKC:   regs.CKC = val; if ( val & 0x80 ) { regs.clock_changed = 1; }; break;
324   case SM8500_SPH:   regs.SP = ( ( val & 0xFF ) << 8 ) | ( regs.SP & 0xFF ); break;
325   case SM8500_SPL:   regs.SP = ( regs.SP & 0xFF00 ) | ( val & 0xFF ); break;
326   case SM8500_PS0:   regs.PS0 = val; regs.register_base = regs.internal_ram + ( val & 0xF8 ); break;
327   case SM8500_PS1:   regs.PS1 = val; break;
328   case SM8500_P0C:   regs.P0C = val; break;
329   case SM8500_P1C:   regs.P1C = val; break;
330   case SM8500_P2C:   regs.P2C = val; break;
331   case SM8500_P3C:   regs.P3C = val; break;
314   case REG_GENPC:
315   case SM8500_PC:      cpustate->PC = val; break;
316   case REG_GENSP:
317   case SM8500_SP:      cpustate->SP = val; break;
318   case SM8500_PS:      sm8500_set_reg( cpustate, SM8500_PS0, ( val >> 8 ) & 0xFF ); sm8500_set_reg( cpustate, SM8500_PS1, val & 0xFF ); break;
319   case SM8500_SYS16:   cpustate->SYS = val; break;
320   case SM8500_RR0:   sm85cpu_mem_writeword( cpustate, 0x00, val); break;
321   case SM8500_RR2:   sm85cpu_mem_writeword( cpustate, 0x02, val); break;
322   case SM8500_RR4:   sm85cpu_mem_writeword( cpustate, 0x04, val); break;
323   case SM8500_RR6:   sm85cpu_mem_writeword( cpustate, 0x06, val); break;
324   case SM8500_RR8:   sm85cpu_mem_writeword( cpustate, 0x08, val); break;
325   case SM8500_RR10:   sm85cpu_mem_writeword( cpustate, 0x0A, val); break;
326   case SM8500_RR12:   sm85cpu_mem_writeword( cpustate, 0x0C, val); break;
327   case SM8500_RR14:   sm85cpu_mem_writeword( cpustate, 0x0E, val); break;
328   case SM8500_IE0:   cpustate->IE0 = val; break;
329   case SM8500_IE1:   cpustate->IE1 = val; break;
330   case SM8500_IR0:   cpustate->IR0 = val; break;
331   case SM8500_IR1:   cpustate->IR1 = val; break;
332   case SM8500_P0:      cpustate->P0 = val; break;
333   case SM8500_P1:      cpustate->P1 = val; break;
334   case SM8500_P2:      cpustate->P2 = val; break;
335   case SM8500_P3:      cpustate->P3 = val; break;
336   case SM8500_SYS:   cpustate->SYS = val; break;
337   case SM8500_CKC:   cpustate->CKC = val; if ( val & 0x80 ) { cpustate->clock_changed = 1; }; break;
338   case SM8500_SPH:   cpustate->SP = ( ( val & 0xFF ) << 8 ) | ( cpustate->SP & 0xFF ); break;
339   case SM8500_SPL:   cpustate->SP = ( cpustate->SP & 0xFF00 ) | ( val & 0xFF ); break;
340   case SM8500_PS0:   cpustate->PS0 = val; cpustate->register_base = cpustate->internal_ram + ( val & 0xF8 ); break;
341   case SM8500_PS1:   cpustate->PS1 = val; break;
342   case SM8500_P0C:   cpustate->P0C = val; break;
343   case SM8500_P1C:   cpustate->P1C = val; break;
344   case SM8500_P2C:   cpustate->P2C = val; break;
345   case SM8500_P3C:   cpustate->P3C = val; break;
332346   }
333347}
334348
335static void sm8500_set_irq_line( int irqline, int state )
349static void sm8500_set_irq_line( sm8500_state *cpustate, int irqline, int state )
336350{
337351   if ( state == ASSERT_LINE ) {
338      regs.IFLAGS |= ( 0x01 << irqline );
339      regs.CheckInterrupts = 1;
352      cpustate->IFLAGS |= ( 0x01 << irqline );
353      cpustate->CheckInterrupts = 1;
340354      switch( irqline ) {
341      case DMA_INT:   regs.IR0 |= 0x80; break;
342      case TIM0_INT:   regs.IR0 |= 0x40; break;
343      case EXT_INT:   regs.IR0 |= 0x10; break;
344      case UART_INT:   regs.IR0 |= 0x08; break;
345      case LCDC_INT:   regs.IR0 |= 0x01; break;
346      case TIM1_INT:   regs.IR1 |= 0x40; break;
347      case CK_INT:   regs.IR1 |= 0x10; break;
348      case PIO_INT:   regs.IR1 |= 0x04; break;
355      case DMA_INT:   cpustate->IR0 |= 0x80; break;
356      case TIM0_INT:   cpustate->IR0 |= 0x40; break;
357      case EXT_INT:   cpustate->IR0 |= 0x10; break;
358      case UART_INT:   cpustate->IR0 |= 0x08; break;
359      case LCDC_INT:   cpustate->IR0 |= 0x01; break;
360      case TIM1_INT:   cpustate->IR1 |= 0x40; break;
361      case CK_INT:   cpustate->IR1 |= 0x10; break;
362      case PIO_INT:   cpustate->IR1 |= 0x04; break;
349363      }
350364   } else {
351      regs.IFLAGS &= ~( 0x01 << irqline );
365      cpustate->IFLAGS &= ~( 0x01 << irqline );
352366      switch( irqline ) {
353      case DMA_INT:   regs.IR0 &= ~0x80; break;
354      case TIM0_INT:   regs.IR0 &= ~0x40; break;
355      case EXT_INT:   regs.IR0 &= ~0x10; break;
356      case UART_INT:   regs.IR0 &= ~0x08; break;
357      case LCDC_INT:   regs.IR0 &= ~0x01; break;
358      case TIM1_INT:   regs.IR1 &= ~0x40; break;
359      case CK_INT:   regs.IR1 &= ~0x10; break;
360      case PIO_INT:   regs.IR1 &= ~0x04; break;
367      case DMA_INT:   cpustate->IR0 &= ~0x80; break;
368      case TIM0_INT:   cpustate->IR0 &= ~0x40; break;
369      case EXT_INT:   cpustate->IR0 &= ~0x10; break;
370      case UART_INT:   cpustate->IR0 &= ~0x08; break;
371      case LCDC_INT:   cpustate->IR0 &= ~0x01; break;
372      case TIM1_INT:   cpustate->IR1 &= ~0x40; break;
373      case CK_INT:   cpustate->IR1 &= ~0x10; break;
374      case PIO_INT:   cpustate->IR1 &= ~0x04; break;
361375      }
362      if ( 0 == regs.IFLAGS ) {
363         regs.CheckInterrupts = 0;
376      if ( 0 == cpustate->IFLAGS ) {
377         cpustate->CheckInterrupts = 0;
364378      }
365379   }
366380}
367381
368382static CPU_SET_INFO( sm8500 )
369383{
384   sm8500_state *cpustate = device->token;
385
370386   switch(state)
371387   {
372388   case CPUINFO_INT_INPUT_STATE + 0:
r3957r3958
380396   case CPUINFO_INT_INPUT_STATE + 8:
381397   case CPUINFO_INT_INPUT_STATE + 9:
382398   case CPUINFO_INT_INPUT_STATE + 10:
383      sm8500_set_irq_line( state - CPUINFO_INT_INPUT_STATE, info->i ); break;
399      sm8500_set_irq_line( cpustate, state - CPUINFO_INT_INPUT_STATE, info->i ); break;
384400
385401   case CPUINFO_INT_REGISTER + SM8500_RR0:
386402   case CPUINFO_INT_REGISTER + SM8500_RR2:
r3957r3958
412428   case CPUINFO_INT_REGISTER + SM8500_P1C:
413429   case CPUINFO_INT_REGISTER + SM8500_P2C:
414430   case CPUINFO_INT_REGISTER + SM8500_P3C:
415                     sm8500_set_reg( state - CPUINFO_INT_REGISTER, info->i ); break;
431                     sm8500_set_reg( cpustate, state - CPUINFO_INT_REGISTER, info->i ); break;
416432
417433   }
418434}
419435
420436CPU_GET_INFO( sm8500 )
421437{
438   sm8500_state *cpustate = (device != NULL) ? device->token : NULL;
439
422440   switch(state)
423441   {
424   case CPUINFO_INT_CONTEXT_SIZE:            info->i = sizeof(sm8500_regs); break;
442   case CPUINFO_INT_CONTEXT_SIZE:            info->i = sizeof(sm8500_state); break;
425443   case CPUINFO_INT_INPUT_LINES:            info->i = 8; break;
426444   case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0xff; break;
427445   case CPUINFO_INT_ENDIANNESS:            info->i = ENDIANNESS_BIG; break;
r3957r3958
431449   case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 5; break;
432450   case CPUINFO_INT_MIN_CYCLES:            info->i = 1; break;
433451   case CPUINFO_INT_MAX_CYCLES:            info->i = 16; break;
434   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8; break;
435   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16; break;
436   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0; break;
437   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0; break;
438   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0; break;
439   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0; break;
440   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 0; break;
441   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 0; break;
442   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:   info->i = 0; break;
452   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8; break;
453   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 16; break;
454   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0; break;
455   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0; break;
456   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0; break;
457   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0; break;
458   case CPUINFO_INT_DATABUS_WIDTH_IO:   info->i = 0; break;
459   case CPUINFO_INT_ADDRBUS_WIDTH_IO:   info->i = 0; break;
460   case CPUINFO_INT_ADDRBUS_SHIFT_IO:   info->i = 0; break;
443461   case CPUINFO_INT_INPUT_STATE + 0:
444462   case CPUINFO_INT_INPUT_STATE + 1:
445463   case CPUINFO_INT_INPUT_STATE + 2:
r3957r3958
447465   case CPUINFO_INT_INPUT_STATE + 4:
448466   case CPUINFO_INT_INPUT_STATE + 5:
449467   case CPUINFO_INT_INPUT_STATE + 6:
450   case CPUINFO_INT_INPUT_STATE + 7:         info->i = regs.IFLAGS & ( 1 << (state - CPUINFO_INT_INPUT_STATE)); break;
468   case CPUINFO_INT_INPUT_STATE + 7:         info->i = cpustate->IFLAGS & ( 1 << (state - CPUINFO_INT_INPUT_STATE)); break;
451469   case CPUINFO_INT_REGISTER + SM8500_RR0:
452470   case CPUINFO_INT_REGISTER + SM8500_RR2:
453471   case CPUINFO_INT_REGISTER + SM8500_RR4:
r3957r3958
478496   case CPUINFO_INT_REGISTER + SM8500_P1C:
479497   case CPUINFO_INT_REGISTER + SM8500_P2C:
480498   case CPUINFO_INT_REGISTER + SM8500_P3C:
481                        info->i = sm8500_get_reg( state - CPUINFO_INT_REGISTER ); break;
482   case CPUINFO_INT_REGISTER + REG_PC:         info->i = sm8500_get_reg( SM8500_PC ); break;
483   case CPUINFO_INT_REGISTER + REG_SP:         info->i = sm8500_get_reg( SM8500_SP ); break;
499                        info->i = sm8500_get_reg( cpustate, state - CPUINFO_INT_REGISTER ); break;
500   case CPUINFO_INT_REGISTER + REG_GENPC:         info->i = sm8500_get_reg( cpustate, SM8500_PC ); break;
501   case CPUINFO_INT_REGISTER + REG_GENSP:         info->i = sm8500_get_reg( cpustate, SM8500_SP ); break;
484502   case CPUINFO_INT_PREVIOUSPC:            info->i = 0x0000; break;
485503
486504
487   case CPUINFO_PTR_SET_INFO:            info->setinfo = CPU_SET_INFO_NAME(sm8500); break;
488   case CPUINFO_PTR_INIT:               info->init = CPU_INIT_NAME(sm8500); break;
489   case CPUINFO_PTR_RESET:               info->reset = CPU_RESET_NAME(sm8500); break;
490   case CPUINFO_PTR_EXIT:               info->exit = CPU_EXIT_NAME(sm8500); break;
491   case CPUINFO_PTR_EXECUTE:            info->execute = CPU_EXECUTE_NAME(sm8500); break;
492   case CPUINFO_PTR_BURN:               info->burn = CPU_BURN_NAME(sm8500); break;
493   case CPUINFO_PTR_DISASSEMBLE:         info->disassemble = CPU_DISASSEMBLE_NAME(sm8500); break;
494   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &sm8500_icount; break;
505   case CPUINFO_FCT_SET_INFO:            info->setinfo = CPU_SET_INFO_NAME(sm8500); break;
506   case CPUINFO_FCT_INIT:               info->init = CPU_INIT_NAME(sm8500); break;
507   case CPUINFO_FCT_RESET:               info->reset = CPU_RESET_NAME(sm8500); break;
508   case CPUINFO_FCT_EXIT:               info->exit = CPU_EXIT_NAME(sm8500); break;
509   case CPUINFO_FCT_EXECUTE:            info->execute = CPU_EXECUTE_NAME(sm8500); break;
510   case CPUINFO_FCT_BURN:               info->burn = CPU_BURN_NAME(sm8500); break;
511   case CPUINFO_FCT_DISASSEMBLE:         info->disassemble = CPU_DISASSEMBLE_NAME(sm8500); break;
512   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount; break;
513   case CPUINFO_PTR_SM8500_INTERNAL_RAM:   info->p = cpustate->internal_ram; break;
495514
496515   case CPUINFO_STR_NAME:               strcpy( info->s, "sm8500" ); break;
497516   case CPUINFO_STR_CORE_FAMILY:            strcpy( info->s, "Sharp SM8500" ); break;
r3957r3958
500519   case CPUINFO_STR_CORE_CREDITS:            strcpy( info->s, "Copyright The MESS Team." ); break;
501520   case CPUINFO_STR_FLAGS:
502521      sprintf( info->s, "%c%c%c%c%c%c%c%c",
503         regs.PS1 & FLAG_C ? 'C' : '.',
504         regs.PS1 & FLAG_Z ? 'Z' : '.',
505         regs.PS1 & FLAG_S ? 'S' : '.',
506         regs.PS1 & FLAG_V ? 'V' : '.',
507         regs.PS1 & FLAG_D ? 'D' : '.',
508         regs.PS1 & FLAG_H ? 'H' : '.',
509         regs.PS1 & FLAG_B ? 'B' : '.',
510         regs.PS1 & FLAG_I ? 'I' : '.' );
522         cpustate->PS1 & FLAG_C ? 'C' : '.',
523         cpustate->PS1 & FLAG_Z ? 'Z' : '.',
524         cpustate->PS1 & FLAG_S ? 'S' : '.',
525         cpustate->PS1 & FLAG_V ? 'V' : '.',
526         cpustate->PS1 & FLAG_D ? 'D' : '.',
527         cpustate->PS1 & FLAG_H ? 'H' : '.',
528         cpustate->PS1 & FLAG_B ? 'B' : '.',
529         cpustate->PS1 & FLAG_I ? 'I' : '.' );
511530      break;
512   case CPUINFO_STR_REGISTER + SM8500_RR0:         sprintf(info->s, "RR0:%04X", sm85cpu_mem_readword( 0x00 ) ); break;
513   case CPUINFO_STR_REGISTER + SM8500_RR2:         sprintf(info->s, "RR2:%04X", sm85cpu_mem_readword( 0x02 ) ); break;
514   case CPUINFO_STR_REGISTER + SM8500_RR4:         sprintf(info->s, "RR4:%04X", sm85cpu_mem_readword( 0x04 ) ); break;
515   case CPUINFO_STR_REGISTER + SM8500_RR6:         sprintf(info->s, "RR6:%04X", sm85cpu_mem_readword( 0x06 ) ); break;
516   case CPUINFO_STR_REGISTER + SM8500_RR8:         sprintf(info->s, "RR8:%04X", sm85cpu_mem_readword( 0x08 ) ); break;
517   case CPUINFO_STR_REGISTER + SM8500_RR10:      sprintf(info->s, "RR10:%04X", sm85cpu_mem_readword( 0x0A ) ); break;
518   case CPUINFO_STR_REGISTER + SM8500_RR12:      sprintf(info->s, "RR12:%04X", sm85cpu_mem_readword( 0x0C ) ); break;
519   case CPUINFO_STR_REGISTER + SM8500_RR14:      sprintf(info->s, "RR14:%04X", sm85cpu_mem_readword( 0x0E ) ); break;
520   case CPUINFO_STR_REGISTER + SM8500_PC:         sprintf(info->s, "PC:%04X", regs.PC); break;
521   case CPUINFO_STR_REGISTER + SM8500_SP:         sprintf(info->s, "SP:%04X", regs.SP); break;
522   case CPUINFO_STR_REGISTER + SM8500_PS:         sprintf(info->s, "PS:%04X", ( regs.PS0 << 8 ) | regs.PS1 ); break;
523   case CPUINFO_STR_REGISTER + SM8500_SYS16:      sprintf(info->s, "SYS:%04X", regs.SYS ); break;
531   case CPUINFO_STR_REGISTER + SM8500_RR0:         sprintf(info->s, "RR0:%04X", sm85cpu_mem_readword( cpustate, 0x00 ) ); break;
532   case CPUINFO_STR_REGISTER + SM8500_RR2:         sprintf(info->s, "RR2:%04X", sm85cpu_mem_readword( cpustate, 0x02 ) ); break;
533   case CPUINFO_STR_REGISTER + SM8500_RR4:         sprintf(info->s, "RR4:%04X", sm85cpu_mem_readword( cpustate, 0x04 ) ); break;
534   case CPUINFO_STR_REGISTER + SM8500_RR6:         sprintf(info->s, "RR6:%04X", sm85cpu_mem_readword( cpustate, 0x06 ) ); break;
535   case CPUINFO_STR_REGISTER + SM8500_RR8:         sprintf(info->s, "RR8:%04X", sm85cpu_mem_readword( cpustate, 0x08 ) ); break;
536   case CPUINFO_STR_REGISTER + SM8500_RR10:      sprintf(info->s, "RR10:%04X", sm85cpu_mem_readword( cpustate, 0x0A ) ); break;
537   case CPUINFO_STR_REGISTER + SM8500_RR12:      sprintf(info->s, "RR12:%04X", sm85cpu_mem_readword( cpustate, 0x0C ) ); break;
538   case CPUINFO_STR_REGISTER + SM8500_RR14:      sprintf(info->s, "RR14:%04X", sm85cpu_mem_readword( cpustate, 0x0E ) ); break;
539   case CPUINFO_STR_REGISTER + SM8500_PC:         sprintf(info->s, "PC:%04X", cpustate->PC); break;
540   case CPUINFO_STR_REGISTER + SM8500_SP:         sprintf(info->s, "SP:%04X", cpustate->SP); break;
541   case CPUINFO_STR_REGISTER + SM8500_PS:         sprintf(info->s, "PS:%04X", ( cpustate->PS0 << 8 ) | cpustate->PS1 ); break;
542   case CPUINFO_STR_REGISTER + SM8500_SYS16:      sprintf(info->s, "SYS:%04X", cpustate->SYS ); break;
524543   }
525544}
526545
src/emu/cpu/mb88xx/mb88xx.c
r3957r3958
792792      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
793793      case CPUINFO_INT_MAX_CYCLES:               info->i = 3;                     break;
794794
795      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
796      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 11;               break;
797      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
798      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
799      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
800      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
801      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
802      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 3;               break;
803      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
795      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
796      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
797      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
798      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
799      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
800      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
801      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
802      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 3;               break;
803      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
804804
805805      case CPUINFO_INT_INPUT_STATE + MB88_IRQ_LINE:   info->i = cpustate->pending_interrupt ? ASSERT_LINE : CLEAR_LINE; break;
806806
r3957r3958
828828      case CPUINFO_INT_REGISTER + MB88_SB:          info->i = cpustate->SB;                  break;
829829
830830      /* --- the following bits of info are returned as pointers to data or functions --- */
831      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mb88);         break;
832      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(mb88);               break;
833      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(mb88);            break;
834      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                  break;
835      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mb88);         break;
836      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
837      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mb88);         break;
831      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mb88);         break;
832      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(mb88);               break;
833      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(mb88);            break;
834      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                  break;
835      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mb88);         break;
836      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
837      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mb88);         break;
838838      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
839839
840840      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
882882   switch (state)
883883   {
884884      /* --- the following bits of info are returned as 64-bit signed integers --- */
885      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 11;               break;
886      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
885      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
886      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
887887
888888      /* --- the following bits of info are returned as NULL-terminated strings --- */
889889      case CPUINFO_STR_NAME:                     strcpy(info->s, "MB8841");            break;
r3957r3958
897897   switch (state)
898898   {
899899      /* --- the following bits of info are returned as 64-bit signed integers --- */
900      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 11;               break;
901      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
900      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
901      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
902902
903903      /* --- the following bits of info are returned as NULL-terminated strings --- */
904904      case CPUINFO_STR_NAME:                     strcpy(info->s, "MB8842");            break;
r3957r3958
912912   switch (state)
913913   {
914914      /* --- the following bits of info are returned as 64-bit signed integers --- */
915      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
916      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 6;               break;
915      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
916      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 6;               break;
917917
918918      /* --- the following bits of info are returned as NULL-terminated strings --- */
919919      case CPUINFO_STR_NAME:                     strcpy(info->s, "MB8843");            break;
r3957r3958
927927   switch (state)
928928   {
929929      /* --- the following bits of info are returned as 64-bit signed integers --- */
930      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
931      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 6;               break;
930      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
931      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 6;               break;
932932
933933      /* --- the following bits of info are returned as NULL-terminated strings --- */
934934      case CPUINFO_STR_NAME:                     strcpy(info->s, "MB8844");            break;
src/emu/cpu/mb88xx/mb88xx.h
r3957r3958
7474CPU_GET_INFO( mb8843 );
7575CPU_GET_INFO( mb8844 );
7676
77#define CPU_MB88 CPU_GET_INFO_NAME( mb88 )
78#define CPU_MB8841 CPU_GET_INFO_NAME( mb8841 )
79#define CPU_MB8842 CPU_GET_INFO_NAME( mb8842 )
80#define CPU_MB8843 CPU_GET_INFO_NAME( mb8843 )
81#define CPU_MB8844 CPU_GET_INFO_NAME( mb8844 )
82
7783CPU_DISASSEMBLE( mb88 );
7884
7985#endif /* __MB88XX_H__ */
src/emu/cpu/sh4/sh4.c
r3957r3958
36433643      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                  break;
36443644      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                  break;
36453645
3646      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:      info->i = 64;            break;
3647      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:    info->i = 32;            break;
3648      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = 0;            break;
3649      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:      info->i = 0;            break;
3650      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:       info->i = 0;            break;
3651      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:       info->i = 0;            break;
3652      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 64;               break;
3653      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;               break;
3654      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
3646      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:      info->i = 64;            break;
3647      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:    info->i = 32;            break;
3648      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:    info->i = 0;            break;
3649      case CPUINFO_INT_DATABUS_WIDTH_DATA:      info->i = 0;            break;
3650      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:       info->i = 0;            break;
3651      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:       info->i = 0;            break;
3652      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 64;               break;
3653      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 8;               break;
3654      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
36553655
3656      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map64 = ADDRESS_MAP_NAME(sh4_internal_map); break;
3656      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map64 = ADDRESS_MAP_NAME(sh4_internal_map); break;
36573657
36583658      case CPUINFO_INT_INPUT_STATE + SH4_IRL0:      info->i = sh4->irq_line_state[SH4_IRL0]; break;
36593659      case CPUINFO_INT_INPUT_STATE + SH4_IRL1:      info->i = sh4->irq_line_state[SH4_IRL1]; break;
r3957r3958
36923692      case CPUINFO_INT_REGISTER + SH4_EA:            info->i = sh4->ea;                  break;
36933693
36943694      /* --- the following bits of info are returned as pointers to data or functions --- */
3695      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh4);         break;
3696      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(sh4);               break;
3697      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(sh4);            break;
3698      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh4);         break;
3699      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
3700      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh4);         break;
3695      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(sh4);         break;
3696      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(sh4);               break;
3697      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(sh4);            break;
3698      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(sh4);         break;
3699      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
3700      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(sh4);         break;
37013701      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &sh4->sh4_icount;            break;
37023702
37033703      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/sh4/sh4.h
r3957r3958
102102};
103103
104104extern CPU_GET_INFO( sh4 );
105#define CPU_SH4 CPU_GET_INFO_NAME( sh4 )
105106
106107WRITE32_HANDLER( sh4_internal_w );
107108READ32_HANDLER( sh4_internal_r );
src/emu/cpu/tms32051/tms32051.c
r3957r3958
583583      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
584584      case CPUINFO_INT_MAX_CYCLES:               info->i = 5;                     break;
585585
586      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
587      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
588      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
589      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;               break;
590      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 16;               break;
591      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;               break;
592      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
593      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
594      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
586      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
587      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
588      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
589      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 16;               break;
590      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 16;               break;
591      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -1;               break;
592      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
593      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
594      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
595595
596596      case CPUINFO_INT_INPUT_STATE:               info->i = CLEAR_LINE;               break;
597597
r3957r3958
624624      case CPUINFO_INT_REGISTER + TMS32051_AR7:      info->i = cpustate->ar[7];               break;
625625
626626      /* --- the following bits of info are returned as pointers to data or functions --- */
627      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms);               break;
628      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms);            break;
629      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms);               break;
630      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms);         break;
631      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
632      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32051);      break;
633      case CPUINFO_PTR_READ:                     info->read = CPU_READ_NAME(tms);         break;
627      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tms);               break;
628      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms);            break;
629      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(tms);               break;
630      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms);         break;
631      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
632      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32051);      break;
633      case CPUINFO_FCT_READ:                     info->read = CPU_READ_NAME(tms);         break;
634634      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
635      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(internal_pgm); break;
636      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA: info->internal_map16 = ADDRESS_MAP_NAME(internal_data); break;
635      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map16 = ADDRESS_MAP_NAME(internal_pgm); break;
636      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA: info->internal_map16 = ADDRESS_MAP_NAME(internal_data); break;
637637
638638      /* --- the following bits of info are returned as NULL-terminated strings --- */
639639      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "TMS3205x");         break;
r3957r3958
715715   switch(state)
716716   {
717717      /* --- the following bits of info are returned as pointers to data or functions --- */
718      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32051);      break;
718      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32051);      break;
719719
720720      /* --- the following bits of info are returned as NULL-terminated strings --- */
721721      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS32051");         break;
src/emu/cpu/tms32051/tms32051.h
r3957r3958
55
66#if (HAS_TMS32051)
77CPU_GET_INFO( tms32051 );
8#define CPU_TMS32051 CPU_GET_INFO_NAME( tms32051 )
89#endif
910
1011CPU_DISASSEMBLE( tms32051 );
src/emu/cpu/alph8201/alph8201.c
r3957r3958
891891      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
892892      case CPUINFO_INT_MAX_CYCLES:               info->i = 16;                     break;
893893
894      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
895      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
896      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
897      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
898      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
899      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
900      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
901      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 6;               break;
902      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
894      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
895      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
896      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
897      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
898      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
899      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
900      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
901      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 6;               break;
902      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
903903#if HANDLE_HALT_LINE
904904      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_HALT:      info->i = cpustate->halt ? ASSERT_LINE : CLEAR_LINE; break;
905905#endif
r3957r3958
930930      case CPUINFO_INT_REGISTER + ALPHA8201_R7:         info->i = RD_REG(7);            break;
931931
932932      /* --- the following bits of info are returned as pointers to data or functions --- */
933      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(alpha8201);      break;
934      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(alpha8201);         break;
935      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(alpha8201);         break;
936      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(alpha8201);         break;
937      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
938      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(alpha8201);      break;
933      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(alpha8201);      break;
934      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(alpha8201);         break;
935      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(alpha8201);         break;
936      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(alpha8201);         break;
937      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
938      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(alpha8201);      break;
939939      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
940940
941941      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
976976   switch (state)
977977   {
978978   case CPUINFO_STR_NAME:                     strcpy(info->s, "ALPHA-8201");            break;
979   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(alpha8201);         break;
979   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(alpha8201);         break;
980980   default:
981981      /* 8201 / 8301 */
982982      CPU_GET_INFO_CALL(alpha8xxx);
r3957r3958
990990   switch (state)
991991   {
992992   case CPUINFO_STR_NAME:                     strcpy(info->s, "ALPHA-8301");            break;
993   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ALPHA8301);         break;
993   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(ALPHA8301);         break;
994994   default:
995995      /* 8201 / 8301 */
996996      CPU_GET_INFO_CALL(alpha8xxx);
src/emu/cpu/alph8201/alph8201.h
r3957r3958
4444extern CPU_GET_INFO( alpha8201 );
4545extern CPU_GET_INFO( alpha8301 );
4646
47#define CPU_ALPHA8201 CPU_GET_INFO_NAME( alpha8201 )
48#define CPU_ALPHA8301 CPU_GET_INFO_NAME( alpha8301 )
49
4750CPU_DISASSEMBLE( alpha8201 );
4851
4952#endif  /* __ALPH8201_H__ */
src/emu/cpu/apexc/apexc.c
r3957r3958
882882   case CPUINFO_INT_MIN_CYCLES:               info->i = 2;   /* IIRC */            break;
883883   case CPUINFO_INT_MAX_CYCLES:               info->i = 75;   /* IIRC */            break;
884884
885   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
886   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 15;   /*13+2 ignored bits to make double word address*/   break;
887   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
888   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
889   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
890   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
891   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = /*5*/8;   /* no I/O bus, but we use address 0 for punchtape I/O */   break;
892   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = /*0*/1;   /*0 is quite enough but the MAME core does not understand*/   break;
893   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
885   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
886   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 15;   /*13+2 ignored bits to make double word address*/   break;
887   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
888   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
889   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
890   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
891   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = /*5*/8;   /* no I/O bus, but we use address 0 for punchtape I/O */   break;
892   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = /*0*/1;   /*0 is quite enough but the MAME core does not understand*/   break;
893   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
894894
895895   case CPUINFO_INT_SP:                     info->i = 0;   /* no SP */            break;
896896   case CPUINFO_INT_PC:
r3957r3958
910910   case CPUINFO_INT_REGISTER + APEXC_STATE:      info->i = cpustate->running;            break;
911911   case CPUINFO_INT_REGISTER + APEXC_ML_FULL:      info->i = effective_address(cpustate, cpustate->ml);   break;
912912
913   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(apexc);         break;
914   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(apexc);            break;
915   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(apexc);            break;
916   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(apexc);         break;
917   case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
918   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(apexc);         break;
913   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(apexc);         break;
914   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(apexc);            break;
915   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(apexc);            break;
916   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(apexc);         break;
917   case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
918   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(apexc);         break;
919919   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
920920
921921   case CPUINFO_STR_NAME:                     strcpy(info->s, "APEXC"); break;
src/emu/cpu/apexc/apexc.h
r3957r3958
1919};
2020
2121CPU_GET_INFO( apexc );
22#define CPU_APEXC CPU_GET_INFO_NAME( apexc )
2223
2324CPU_DISASSEMBLE( apexc );
2425
src/emu/cpu/g65816/g65816.c
r3957r3958
417417      case CPUINFO_INT_MIN_CYCLES:            info->i = 1;                     break;
418418      case CPUINFO_INT_MAX_CYCLES:            info->i = 20; /* rough guess */         break;
419419
420      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
421      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 24;               break;
422      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
423      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
424      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
425      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
426      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 0;               break;
427      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:    info->i = 0;               break;
428      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:    info->i = 0;               break;
420      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
421      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 24;               break;
422      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
423      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
424      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
425      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
426      case CPUINFO_INT_DATABUS_WIDTH_IO:   info->i = 0;               break;
427      case CPUINFO_INT_ADDRBUS_WIDTH_IO:    info->i = 0;               break;
428      case CPUINFO_INT_ADDRBUS_SHIFT_IO:    info->i = 0;               break;
429429
430430      case CPUINFO_INT_INPUT_STATE + G65816_LINE_IRQ:      info->i = LINE_IRQ;               break;
431431      case CPUINFO_INT_INPUT_STATE + G65816_LINE_NMI:      info->i = LINE_NMI;               break;
r3957r3958
453453      case CPUINFO_INT_REGISTER + G65816_IRQ_STATE:   info->i = g65816_get_reg(cpustate, G65816_IRQ_STATE); break;
454454
455455      /* --- the following bits of info are returned as pointers to data or functions --- */
456      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(g65816);      break;
457      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(g65816);            break;
458      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(g65816);            break;
459      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(g65816);            break;
460      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(g65816);         break;
461      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
462      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(g65816);      break;
456      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(g65816);      break;
457      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(g65816);            break;
458      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(g65816);            break;
459      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(g65816);            break;
460      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(g65816);         break;
461      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
462      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(g65816);      break;
463463      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->ICount;         break;
464464      case CPUINFO_PTR_G65816_READVECTOR_CALLBACK:   info->f = (genf *) READ_VECTOR;         break;
465465
466      case CPUINFO_PTR_READOP:                  info->readop = CPU_READOP_NAME(g65816);         break;
466      case CPUINFO_FCT_READOP:                  info->readop = CPU_READOP_NAME(g65816);         break;
467467
468468      /* --- the following bits of info are returned as NULL-terminated strings --- */
469469      case CPUINFO_STR_NAME:                     strcpy(info->s, "G65C816");            break;
src/emu/cpu/g65816/g65816op.h
r3957r3958
23512351      case G65816_A: return REGISTER_B | REGISTER_A;
23522352      case G65816_X: return REGISTER_X;
23532353      case G65816_Y: return REGISTER_Y;
2354      case REG_SP: return REGISTER_S;
2354      case REG_GENSP: return REGISTER_S;
23552355      case G65816_S: return REGISTER_S;
2356      case REG_PC: return REGISTER_PC;
2356      case REG_GENPC: return REGISTER_PC;
23572357      case G65816_PC: return REGISTER_PC;
23582358      case G65816_PB: return REGISTER_PB >> 16;
23592359      case G65816_DB: return REGISTER_DB >> 16;
r3957r3958
23612361      case G65816_P: return g65816i_get_reg_p(cpustate);
23622362      case G65816_NMI_STATE: return LINE_NMI;
23632363      case G65816_IRQ_STATE: return LINE_IRQ;
2364      case REG_PREVIOUSPC: return REGISTER_PPC;
2364      case REG_GENPCBASE: return REGISTER_PPC;
23652365   }
23662366   return 0;
23672367}
r3957r3958
23722372{
23732373   switch(regnum)
23742374   {
2375      case REG_PC: case G65816_PC: REGISTER_PC = MAKE_UINT_16(val); break;
2375      case REG_GENPC: case G65816_PC: REGISTER_PC = MAKE_UINT_16(val); break;
23762376#if FLAG_SET_E
2377      case REG_SP: case G65816_S: REGISTER_S = MAKE_UINT_8(val) | 0x100; break;
2377      case REG_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_8(val) | 0x100; break;
23782378#else
2379      case REG_SP: case G65816_S: REGISTER_S = MAKE_UINT_16(val); break;
2379      case REG_GENSP: case G65816_S: REGISTER_S = MAKE_UINT_16(val); break;
23802380#endif
23812381      case G65816_P: g65816i_set_reg_p(cpustate, val); break;
23822382#if FLAG_SET_M
src/emu/cpu/g65816/g65816.h
r3957r3958
6565
6666/* Main interface function */
6767CPU_GET_INFO( g65816 );
68#define CPU_G65816 CPU_GET_INFO_NAME( g65816 )
6869
69#undef G65816_CALL_DEBUGGER
70#define G65816_CALL_DEBUGGER(x) debugger_instruction_hook(cpustate->device, x)
7170
72#define g65816_read_8(addr)          memory_read_byte_8be(cpustate->program, addr)
73#define g65816_write_8(addr,data)      memory_write_byte_8be(cpustate->program, addr,data)
74#define g65816_read_8_immediate(A)      memory_read_byte_8be(cpustate->program, A)
75#define g65816_jumping(A)
76#define g65816_branching(A)
7771
78
79
8072/* ======================================================================== */
8173/* ============================== END OF FILE ============================= */
8274/* ======================================================================== */
src/emu/cpu/g65816/g65816cm.h
r3957r3958
99#define g65816i_jumping(A)
1010
1111
12#undef G65816_CALL_DEBUGGER
13#define G65816_CALL_DEBUGGER(x) debugger_instruction_hook(cpustate->device, x)
14
15#define g65816_read_8(addr)          memory_read_byte_8be(cpustate->program, addr)
16#define g65816_write_8(addr,data)      memory_write_byte_8be(cpustate->program, addr,data)
17#define g65816_read_8_immediate(A)      memory_read_byte_8be(cpustate->program, A)
18#define g65816_jumping(A)
19#define g65816_branching(A)
20
21
1222/* ======================================================================== */
1323/* ================================ INCLUDES ============================== */
1424/* ======================================================================== */
src/emu/cpu/nec/nec.c
r3957r3958
110110typedef UINT16 WORD;
111111typedef UINT32 DWORD;
112112
113#include "necpriv.h"
113114#include "nec.h"
114#include "necintrf.h"
115115
116116#define PC(n)      (((n)->sregs[PS]<<4)+(n)->ip)
117117
r3957r3958
10871087   return necv_dasm_one(buffer, pc, oprom, nec_state->config);
10881088}
10891089
1090static void nec_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback, int type)
1090static void nec_init(const device_config *device, cpu_irq_callback irqcallback, int type)
10911091{
10921092   const nec_config *config = device->static_config ? device->static_config : &default_config;
10931093   nec_state_t *nec_state = device->token;
r3957r3958
12121212{
12131213   nec_state_t *nec_state = device->token;
12141214
1215   nec_init(device, index, clock, irqcallback, 0);
1215   nec_init(device, irqcallback, 0);
12161216   configure_memory_8bit(nec_state);
12171217   nec_state->chip_type=V20;
12181218   nec_state->prefetch_size = 4;      /* 3 words */
r3957r3958
12251225{
12261226   nec_state_t *nec_state = device->token;
12271227
1228   nec_init(device, index, clock, irqcallback, 1);
1228   nec_init(device, irqcallback, 1);
12291229   configure_memory_16bit(nec_state);
12301230   nec_state->chip_type=V30;
12311231   nec_state->prefetch_size = 6;      /* 3 words */
r3957r3958
12391239{
12401240   nec_state_t *nec_state = device->token;
12411241
1242   nec_init(device, index, clock, irqcallback, 2);
1242   nec_init(device, irqcallback, 2);
12431243   nec_state->chip_type=V33;
12441244   nec_state->prefetch_size = 6;
12451245   /* FIXME: Need information about prefetch size and cycles for V33.
r3957r3958
13341334      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
13351335      case CPUINFO_INT_MAX_CYCLES:               info->i = 80;                     break;
13361336
1337      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
1338      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
1339      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1340      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1341      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1342      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1343      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
1344      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 16;               break;
1345      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1337      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
1338      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
1339      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1340      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1341      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1342      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1343      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
1344      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 16;               break;
1345      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
13461346
13471347      case CPUINFO_INT_INPUT_STATE + 0:               info->i = (nec_state->pending_irq & INT_IRQ) ? ASSERT_LINE : CLEAR_LINE; break;
13481348      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:      info->i = nec_state->nmi_state;            break;
r3957r3958
13711371      case CPUINFO_INT_REGISTER + NEC_PENDING:      info->i = nec_state->pending_irq;            break;
13721372
13731373      /* --- the following bits of info are returned as pointers to data or functions --- */
1374      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(nec);         break;
1375      case CPUINFO_PTR_INIT:                     /* set per-CPU */                  break;
1376      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(nec);            break;
1377      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(nec);               break;
1378      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(necv);         break;
1379      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1380      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nec);         break;
1374      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(nec);         break;
1375      case CPUINFO_FCT_INIT:                     /* set per-CPU */                  break;
1376      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(nec);            break;
1377      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(nec);               break;
1378      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(necv);         break;
1379      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1380      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nec);         break;
13811381      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &nec_state->icount;            break;
13821382
13831383      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
14381438   switch (state)
14391439   {
14401440      /* --- the following bits of info are returned as 64-bit signed integers --- */
1441      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1442      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1441      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1442      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
14431443
14441444      /* --- the following bits of info are returned as pointers to data or functions --- */
1445      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v20);               break;
1445      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v20);               break;
14461446
14471447      /* --- the following bits of info are returned as NULL-terminated strings --- */
14481448      case CPUINFO_STR_NAME:                     strcpy(info->s, "V20");               break;
r3957r3958
14631463   switch (state)
14641464   {
14651465      /* --- the following bits of info are returned as 64-bit signed integers --- */
1466      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1467      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1466      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1467      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
14681468
14691469      /* --- the following bits of info are returned as pointers to data or functions --- */
1470      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v20);               break;
1470      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v20);               break;
14711471
14721472      /* --- the following bits of info are returned as NULL-terminated strings --- */
14731473      case CPUINFO_STR_NAME:                     strcpy(info->s, "V25");               break;
r3957r3958
14881488   switch (state)
14891489   {
14901490      /* --- the following bits of info are returned as pointers to data or functions --- */
1491      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v30);               break;
1491      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v30);               break;
14921492
14931493      /* --- the following bits of info are returned as NULL-terminated strings --- */
14941494      case CPUINFO_STR_NAME:                     strcpy(info->s, "V30");               break;
r3957r3958
15091509   switch (state)
15101510   {
15111511      /* --- the following bits of info are returned as pointers to data or functions --- */
1512      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v33);               break;
1512      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v33);               break;
15131513
15141514      /* --- the following bits of info are returned as NULL-terminated strings --- */
15151515      case CPUINFO_STR_NAME:                     strcpy(info->s, "V33");               break;
r3957r3958
15301530   switch (state)
15311531   {
15321532      /* --- the following bits of info are returned as pointers to data or functions --- */
1533      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v30);               break;
1533      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v30);               break;
15341534
15351535      /* --- the following bits of info are returned as NULL-terminated strings --- */
15361536      case CPUINFO_STR_NAME:                     strcpy(info->s, "V35");               break;
src/emu/cpu/nec/nec.h
r3957r3958
1/* ASG 971222 -- rewrote this interface */
2#ifndef __NEC_H_
3#define __NEC_H_
4
15#include "cpuintrf.h"
26
37typedef struct _nec_config nec_config;
r3957r3958
610   const UINT8*   v25v35_decryptiontable; // internal decryption table
711};
812
9
10typedef enum { DS1, PS, SS, DS0 } SREGS;
11typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS;
12
13#define NEC_NMI_INT_VECTOR   2
1413#define NEC_INPUT_LINE_POLL 20
1514
16/* Cpu types, steps of 8 to help the cycle count calculation */
17#define V33 0
18#define V30 8
19#define V20 16
15enum
16{
17   NEC_PC=0,
18   NEC_IP, NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
19   NEC_FLAGS, NEC_ES, NEC_CS, NEC_SS, NEC_DS,
20   NEC_VECTOR, NEC_PENDING
21};
2022
21#ifndef FALSE
22#define FALSE 0
23#define TRUE 1
24#endif
23/* Public functions */
24extern CPU_GET_INFO( v20 );
25extern CPU_GET_INFO( v25 );
26extern CPU_GET_INFO( v30 );
27extern CPU_GET_INFO( v33 );
28extern CPU_GET_INFO( v35 );
2529
26#ifdef LSB_FIRST
27typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,IXL,IXH,IYL,IYH } BREGS;
28#else
29typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,IXH,IXL,IYH,IYL } BREGS;
30#endif
30#define CPU_V20 CPU_GET_INFO_NAME( v20 )
31#define CPU_V25 CPU_GET_INFO_NAME( v25 )
32#define CPU_V30 CPU_GET_INFO_NAME( v30 )
33#define CPU_V33 CPU_GET_INFO_NAME( v33 )
34#define CPU_V35 CPU_GET_INFO_NAME( v35 )
3135
32/* parameter x = result, y = source 1, z = source 2 */
33
34#define SetTF(x)      (nec_state->TF = (x))
35#define SetIF(x)      (nec_state->IF = (x))
36#define SetDF(x)      (nec_state->DF = (x))
37#define SetMD(x)      (nec_state->MF = (x))   /* OB [19.07.99] Mode Flag V30 */
38
39#define SetCFB(x)      (nec_state->CarryVal = (x) & 0x100)
40#define SetCFW(x)      (nec_state->CarryVal = (x) & 0x10000)
41#define SetAF(x,y,z)   (nec_state->AuxVal = ((x) ^ ((y) ^ (z))) & 0x10)
42#define SetSF(x)      (nec_state->SignVal = (x))
43#define SetZF(x)      (nec_state->ZeroVal = (x))
44#define SetPF(x)      (nec_state->ParityVal = (x))
45
46#define SetSZPF_Byte(x) (nec_state->SignVal=nec_state->ZeroVal=nec_state->ParityVal=(INT8)(x))
47#define SetSZPF_Word(x) (nec_state->SignVal=nec_state->ZeroVal=nec_state->ParityVal=(INT16)(x))
48
49#define SetOFW_Add(x,y,z)   (nec_state->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x8000)
50#define SetOFB_Add(x,y,z)   (nec_state->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x80)
51#define SetOFW_Sub(x,y,z)   (nec_state->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x8000)
52#define SetOFB_Sub(x,y,z)   (nec_state->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x80)
53
54#define ADDB { UINT32 res=dst+src; SetCFB(res); SetOFB_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
55#define ADDW { UINT32 res=dst+src; SetCFW(res); SetOFW_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
56
57#define SUBB { UINT32 res=dst-src; SetCFB(res); SetOFB_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
58#define SUBW { UINT32 res=dst-src; SetCFW(res); SetOFW_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
59
60#define ORB dst|=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
61#define ORW dst|=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
62
63#define ANDB dst&=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
64#define ANDW dst&=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
65
66#define XORB dst^=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
67#define XORW dst^=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
68
69#define CF      (nec_state->CarryVal!=0)
70#define SF      (nec_state->SignVal<0)
71#define ZF      (nec_state->ZeroVal==0)
72#define PF      parity_table[(BYTE)nec_state->ParityVal]
73#define AF      (nec_state->AuxVal!=0)
74#define OF      (nec_state->OverVal!=0)
75#define MD      (nec_state->MF!=0)
76
77/************************************************************************/
78
79#define read_byte(a)         (*nec_state->mem.rbyte)(nec_state->program, a)
80#define read_word(a)         (*nec_state->mem.rword)(nec_state->program, a)
81#define write_byte(a,d)         (*nec_state->mem.wbyte)(nec_state->program, (a),(d))
82#define write_word(a,d)         (*nec_state->mem.wword)(nec_state->program, (a),(d))
83
84#define read_port_byte(a)      (*nec_state->mem.rbyte)(nec_state->io, a)
85#define read_port_word(a)      (*nec_state->mem.rword)(nec_state->io, a)
86#define write_port_byte(a,d)   (*nec_state->mem.wbyte)(nec_state->io, (a),(d))
87#define write_port_word(a,d)   (*nec_state->mem.wword)(nec_state->io, (a),(d))
88
89/************************************************************************/
90
91#define CHANGE_PC do { EMPTY_PREFETCH(); } while (0)
92
93#define SegBase(Seg) (nec_state->sregs[Seg] << 4)
94
95#define DefaultBase(Seg) ((nec_state->seg_prefix && (Seg==DS0 || Seg==SS)) ? nec_state->prefix_base : nec_state->sregs[Seg] << 4)
96
97#define GetMemB(Seg,Off) (read_byte(DefaultBase(Seg) + (Off)))
98#define GetMemW(Seg,Off) (read_word(DefaultBase(Seg) + (Off)))
99
100#define PutMemB(Seg,Off,x) { write_byte(DefaultBase(Seg) + (Off), (x)); }
101#define PutMemW(Seg,Off,x) { write_word(DefaultBase(Seg) + (Off), (x)); }
102
103/* prefetch timing */
104
105#define FETCH()          fetch(nec_state)
106#define FETCH_XOR(a)      ((a) ^ nec_state->mem.fetch_xor)
107#define FETCHWORD()         fetchword(nec_state)
108#define EMPTY_PREFETCH()   nec_state->prefetch_reset = 1
109
110
111#define PUSH(val) { nec_state->regs.w[SP]-=2; write_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP])),val); }
112#define POP(var) { var = read_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP]))); nec_state->regs.w[SP]+=2; }
113
114#define GetModRM UINT32 ModRM=FETCH()
115
116/* Cycle count macros:
117    CLK  - cycle count is the same on all processors
118    CLKS - cycle count differs between processors, list all counts
119    CLKW - cycle count for word read/write differs for odd/even source/destination address
120    CLKM - cycle count for reg/mem instructions
121    CLKR - cycle count for reg/mem instructions with different counts for odd/even addresses
122
123
124    Prefetch & buswait time is not emulated.
125    Extra cycles for PUSH'ing or POP'ing registers to odd addresses is not emulated.
126*/
127
128#define CLK(all) nec_state->icount-=all
129#define CLKS(v20,v30,v33) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33; nec_state->icount-=(ccount>>nec_state->chip_type)&0x7f; }
130#define CLKW(v20o,v30o,v33o,v20e,v30e,v33e,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; nec_state->icount-=(addr&1)?((ocount>>nec_state->chip_type)&0x7f):((ecount>>nec_state->chip_type)&0x7f); }
131#define CLKM(v20,v30,v33,v20m,v30m,v33m) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33, mcount=(v20m<<16)|(v30m<<8)|v33m; nec_state->icount-=( ModRM >=0xc0 )?((ccount>>nec_state->chip_type)&0x7f):((mcount>>nec_state->chip_type)&0x7f); }
132#define CLKR(v20o,v30o,v33o,v20e,v30e,v33e,vall,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; if (ModRM >=0xc0) nec_state->icount-=vall; else nec_state->icount-=(addr&1)?((ocount>>nec_state->chip_type)&0x7f):((ecount>>nec_state->chip_type)&0x7f); }
133
134/************************************************************************/
135#define CompressFlags() (WORD)(CF | (PF << 2) | (AF << 4) | (ZF << 6) \
136            | (SF << 7) | (nec_state->TF << 8) | (nec_state->IF << 9) \
137            | (nec_state->DF << 10) | (OF << 11)| (MD << 15))
138
139#define ExpandFlags(f) \
140{ \
141   nec_state->CarryVal = (f) & 1; \
142   nec_state->ParityVal = !((f) & 4); \
143   nec_state->AuxVal = (f) & 16; \
144   nec_state->ZeroVal = !((f) & 64); \
145   nec_state->SignVal = (f) & 128 ? -1 : 0; \
146   nec_state->TF = ((f) & 256) == 256; \
147   nec_state->IF = ((f) & 512) == 512; \
148   nec_state->DF = ((f) & 1024) == 1024; \
149   nec_state->OverVal = (f) & 2048; \
150   nec_state->MF = ((f) & 0x8000) == 0x8000; \
151}
152
153#define IncWordReg(Reg)                \
154   unsigned tmp = (unsigned)nec_state->regs.w[Reg]; \
155   unsigned tmp1 = tmp+1;               \
156   nec_state->OverVal = (tmp == 0x7fff);          \
157   SetAF(tmp1,tmp,1);                  \
158   SetSZPF_Word(tmp1);                \
159   nec_state->regs.w[Reg]=tmp1
160
161#define DecWordReg(Reg)                \
162   unsigned tmp = (unsigned)nec_state->regs.w[Reg]; \
163    unsigned tmp1 = tmp-1;                \
164   nec_state->OverVal = (tmp == 0x8000);          \
165    SetAF(tmp1,tmp,1);                   \
166    SetSZPF_Word(tmp1);                \
167   nec_state->regs.w[Reg]=tmp1
168
169#define JMP(flag)                     \
170   int tmp;                        \
171   EMPTY_PREFETCH();                  \
172   tmp = (int)((INT8)FETCH());            \
173   if (flag)                        \
174   {                              \
175      static const UINT8 table[3]={3,10,10};    \
176      nec_state->ip = (WORD)(nec_state->ip+tmp);         \
177      nec_state->icount-=table[nec_state->chip_type/8];   \
178      CHANGE_PC;                     \
179      return;                        \
180   }
181
182#define ADJ4(param1,param2)               \
183   if (AF || ((nec_state->regs.b[AL] & 0xf) > 9))   \
184   {                              \
185      UINT16 tmp;                     \
186      tmp = nec_state->regs.b[AL] + param1;      \
187      nec_state->regs.b[AL] = tmp;               \
188      nec_state->AuxVal = 1;                  \
189      nec_state->CarryVal |= tmp & 0x100;         \
190   }                              \
191   if (CF || (nec_state->regs.b[AL]>0x9f))         \
192   {                              \
193      nec_state->regs.b[AL] += param2;            \
194      nec_state->CarryVal = 1;                  \
195   }                              \
196   SetSZPF_Byte(nec_state->regs.b[AL])
197
198#define ADJB(param1,param2)               \
199   if (AF || ((nec_state->regs.b[AL] & 0xf) > 9))   \
200    {                              \
201      nec_state->regs.b[AL] += param1;            \
202      nec_state->regs.b[AH] += param2;            \
203      nec_state->AuxVal = 1;                  \
204      nec_state->CarryVal = 1;                  \
205    }                              \
206   else                           \
207   {                              \
208      nec_state->AuxVal = 0;                  \
209      nec_state->CarryVal = 0;                  \
210    }                              \
211   nec_state->regs.b[AL] &= 0x0F
212
213#define BITOP_BYTE                     \
214   ModRM = FETCH();                     \
215   if (ModRM >= 0xc0) {               \
216      tmp=nec_state->regs.b[Mod_RM.RM.b[ModRM]];   \
217   }                              \
218   else {                           \
219      (*GetEA[ModRM])(nec_state);               \
220      tmp=read_byte(EA);               \
221    }
222
223#define BITOP_WORD                     \
224   ModRM = FETCH();                     \
225   if (ModRM >= 0xc0) {               \
226      tmp=nec_state->regs.w[Mod_RM.RM.w[ModRM]];   \
227   }                              \
228   else {                           \
229      (*GetEA[ModRM])(nec_state);               \
230      tmp=read_word(EA);               \
231    }
232
233#define BIT_NOT                        \
234   if (tmp & (1<<tmp2))               \
235      tmp &= ~(1<<tmp2);               \
236   else                           \
237      tmp |= (1<<tmp2)
238
239#define XchgAWReg(Reg)                   \
240    WORD tmp;                         \
241   tmp = nec_state->regs.w[Reg];                \
242   nec_state->regs.w[Reg] = nec_state->regs.w[AW];          \
243   nec_state->regs.w[AW] = tmp
244
245#define ROL_BYTE nec_state->CarryVal = dst & 0x80; dst = (dst << 1)+CF
246#define ROL_WORD nec_state->CarryVal = dst & 0x8000; dst = (dst << 1)+CF
247#define ROR_BYTE nec_state->CarryVal = dst & 0x1; dst = (dst >> 1)+(CF<<7)
248#define ROR_WORD nec_state->CarryVal = dst & 0x1; dst = (dst >> 1)+(CF<<15)
249#define ROLC_BYTE dst = (dst << 1) + CF; SetCFB(dst)
250#define ROLC_WORD dst = (dst << 1) + CF; SetCFW(dst)
251#define RORC_BYTE dst = (CF<<8)+dst; nec_state->CarryVal = dst & 0x01; dst >>= 1
252#define RORC_WORD dst = (CF<<16)+dst; nec_state->CarryVal = dst & 0x01; dst >>= 1
253#define SHL_BYTE(c) nec_state->icount-=c; dst <<= c;   SetCFB(dst); SetSZPF_Byte(dst);   PutbackRMByte(ModRM,(BYTE)dst)
254#define SHL_WORD(c) nec_state->icount-=c; dst <<= c;   SetCFW(dst); SetSZPF_Word(dst);   PutbackRMWord(ModRM,(WORD)dst)
255#define SHR_BYTE(c) nec_state->icount-=c; dst >>= c-1; nec_state->CarryVal = dst & 0x1; dst >>= 1; SetSZPF_Byte(dst); PutbackRMByte(ModRM,(BYTE)dst)
256#define SHR_WORD(c) nec_state->icount-=c; dst >>= c-1; nec_state->CarryVal = dst & 0x1; dst >>= 1; SetSZPF_Word(dst); PutbackRMWord(ModRM,(WORD)dst)
257#define SHRA_BYTE(c) nec_state->icount-=c; dst = ((INT8)dst) >> (c-1);   nec_state->CarryVal = dst & 0x1;   dst = ((INT8)((BYTE)dst)) >> 1; SetSZPF_Byte(dst); PutbackRMByte(ModRM,(BYTE)dst)
258#define SHRA_WORD(c) nec_state->icount-=c; dst = ((INT16)dst) >> (c-1);   nec_state->CarryVal = dst & 0x1;   dst = ((INT16)((WORD)dst)) >> 1; SetSZPF_Word(dst); PutbackRMWord(ModRM,(WORD)dst)
259
260#define DIVUB                                    \
261   uresult = nec_state->regs.w[AW];                           \
262   uresult2 = uresult % tmp;                        \
263   if ((uresult /= tmp) > 0xff) {                     \
264      nec_interrupt(nec_state, 0,0); break;                     \
265   } else {                                    \
266      nec_state->regs.b[AL] = uresult;                        \
267      nec_state->regs.b[AH] = uresult2;                     \
268   }
269
270#define DIVB                                    \
271   result = (INT16)nec_state->regs.w[AW];                     \
272   result2 = result % (INT16)((INT8)tmp);               \
273   if ((result /= (INT16)((INT8)tmp)) > 0xff) {         \
274      nec_interrupt(nec_state, 0,0); break;                     \
275   } else {                                    \
276      nec_state->regs.b[AL] = result;                        \
277      nec_state->regs.b[AH] = result2;                        \
278   }
279
280#define DIVUW                                    \
281   uresult = (((UINT32)nec_state->regs.w[DW]) << 16) | nec_state->regs.w[AW];\
282   uresult2 = uresult % tmp;                        \
283   if ((uresult /= tmp) > 0xffff) {                  \
284      nec_interrupt(nec_state, 0,0); break;                     \
285   } else {                                    \
286      nec_state->regs.w[AW]=uresult;                        \
287      nec_state->regs.w[DW]=uresult2;                        \
288   }
289
290#define DIVW                                    \
291   result = ((UINT32)nec_state->regs.w[DW] << 16) + nec_state->regs.w[AW];   \
292   result2 = result % (INT32)((INT16)tmp);               \
293   if ((result /= (INT32)((INT16)tmp)) > 0xffff) {         \
294      nec_interrupt(nec_state, 0,0); break;                     \
295   } else {                                    \
296      nec_state->regs.w[AW]=result;                        \
297      nec_state->regs.w[DW]=result2;                        \
298   }
299
300#define ADD4S {                                    \
301   int i,v1,v2,result;                              \
302   int count = (nec_state->regs.b[CL]+1)/2;                     \
303   unsigned di = nec_state->regs.w[IY];                        \
304   unsigned si = nec_state->regs.w[IX];                        \
305   static const UINT8 table[3]={18,19,19};                \
306   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for add4s\n",PC(nec_state));   \
307   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
308   for (i=0;i<count;i++) {                           \
309      nec_state->icount-=table[nec_state->chip_type/8];               \
310      tmp = GetMemB(DS0, si);                        \
311      tmp2 = GetMemB(DS1, di);                     \
312      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
313      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
314      result = v1+v2+nec_state->CarryVal;                     \
315      nec_state->CarryVal = result > 99 ? 1 : 0;               \
316      result = result % 100;                        \
317      v1 = ((result/10)<<4) | (result % 10);            \
318      PutMemB(DS1, di,v1);                        \
319      if (v1) nec_state->ZeroVal = 1;                        \
320      si++;                                    \
321      di++;                                    \
322   }                                          \
323}
324
325#define SUB4S {                                    \
326   int count = (nec_state->regs.b[CL]+1)/2;                     \
327   int i,v1,v2,result;                              \
328    unsigned di = nec_state->regs.w[IY];                        \
329   unsigned si = nec_state->regs.w[IX];                        \
330   static const UINT8 table[3]={18,19,19};               \
331   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for sub4s\n",PC(nec_state));   \
332   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
333   for (i=0;i<count;i++) {                           \
334      nec_state->icount-=table[nec_state->chip_type/8];               \
335      tmp = GetMemB(DS1, di);                        \
336      tmp2 = GetMemB(DS0, si);                     \
337      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
338      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
339      if (v1 < (v2+nec_state->CarryVal)) {                     \
340         v1+=100;                              \
341         result = v1-(v2+nec_state->CarryVal);               \
342         nec_state->CarryVal = 1;                           \
343      } else {                                 \
344         result = v1-(v2+nec_state->CarryVal);               \
345         nec_state->CarryVal = 0;                           \
346      }                                       \
347      v1 = ((result/10)<<4) | (result % 10);            \
348      PutMemB(DS1, di,v1);                        \
349      if (v1) nec_state->ZeroVal = 1;                        \
350      si++;                                    \
351      di++;                                    \
352   }                                          \
353}
354
355#define CMP4S {                                    \
356   int count = (nec_state->regs.b[CL]+1)/2;                     \
357   int i,v1,v2,result;                              \
358    unsigned di = nec_state->regs.w[IY];                        \
359   unsigned si = nec_state->regs.w[IX];                        \
360   static const UINT8 table[3]={14,19,19};               \
361   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for cmp4s\n",PC(nec_state));   \
362   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
363   for (i=0;i<count;i++) {                           \
364      nec_state->icount-=table[nec_state->chip_type/8];               \
365      tmp = GetMemB(DS1, di);                        \
366      tmp2 = GetMemB(DS0, si);                     \
367      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
368      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
369      if (v1 < (v2+nec_state->CarryVal)) {                     \
370         v1+=100;                              \
371         result = v1-(v2+nec_state->CarryVal);               \
372         nec_state->CarryVal = 1;                           \
373      } else {                                 \
374         result = v1-(v2+nec_state->CarryVal);               \
375         nec_state->CarryVal = 0;                           \
376      }                                       \
377      v1 = ((result/10)<<4) | (result % 10);            \
378      if (v1) nec_state->ZeroVal = 1;                        \
379      si++;                                    \
380      di++;                                    \
381   }                                          \
382}
36#endif
src/emu/cpu/nec/necpriv.h
r0r3958
1#include "cpuintrf.h"
2
3typedef enum { DS1, PS, SS, DS0 } SREGS;
4typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS;
5
6#define NEC_NMI_INT_VECTOR   2
7
8/* Cpu types, steps of 8 to help the cycle count calculation */
9#define V33 0
10#define V30 8
11#define V20 16
12
13#ifndef FALSE
14#define FALSE 0
15#define TRUE 1
16#endif
17
18#ifdef LSB_FIRST
19typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,IXL,IXH,IYL,IYH } BREGS;
20#else
21typedef enum { AH,AL,CH,CL,DH,DL,BH,BL,SPH,SPL,BPH,BPL,IXH,IXL,IYH,IYL } BREGS;
22#endif
23
24/* parameter x = result, y = source 1, z = source 2 */
25
26#define SetTF(x)      (nec_state->TF = (x))
27#define SetIF(x)      (nec_state->IF = (x))
28#define SetDF(x)      (nec_state->DF = (x))
29#define SetMD(x)      (nec_state->MF = (x))   /* OB [19.07.99] Mode Flag V30 */
30
31#define SetCFB(x)      (nec_state->CarryVal = (x) & 0x100)
32#define SetCFW(x)      (nec_state->CarryVal = (x) & 0x10000)
33#define SetAF(x,y,z)   (nec_state->AuxVal = ((x) ^ ((y) ^ (z))) & 0x10)
34#define SetSF(x)      (nec_state->SignVal = (x))
35#define SetZF(x)      (nec_state->ZeroVal = (x))
36#define SetPF(x)      (nec_state->ParityVal = (x))
37
38#define SetSZPF_Byte(x) (nec_state->SignVal=nec_state->ZeroVal=nec_state->ParityVal=(INT8)(x))
39#define SetSZPF_Word(x) (nec_state->SignVal=nec_state->ZeroVal=nec_state->ParityVal=(INT16)(x))
40
41#define SetOFW_Add(x,y,z)   (nec_state->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x8000)
42#define SetOFB_Add(x,y,z)   (nec_state->OverVal = ((x) ^ (y)) & ((x) ^ (z)) & 0x80)
43#define SetOFW_Sub(x,y,z)   (nec_state->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x8000)
44#define SetOFB_Sub(x,y,z)   (nec_state->OverVal = ((z) ^ (y)) & ((z) ^ (x)) & 0x80)
45
46#define ADDB { UINT32 res=dst+src; SetCFB(res); SetOFB_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
47#define ADDW { UINT32 res=dst+src; SetCFW(res); SetOFW_Add(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
48
49#define SUBB { UINT32 res=dst-src; SetCFB(res); SetOFB_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Byte(res); dst=(BYTE)res; }
50#define SUBW { UINT32 res=dst-src; SetCFW(res); SetOFW_Sub(res,src,dst); SetAF(res,src,dst); SetSZPF_Word(res); dst=(WORD)res; }
51
52#define ORB dst|=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
53#define ORW dst|=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
54
55#define ANDB dst&=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
56#define ANDW dst&=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
57
58#define XORB dst^=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Byte(dst)
59#define XORW dst^=src; nec_state->CarryVal=nec_state->OverVal=nec_state->AuxVal=0; SetSZPF_Word(dst)
60
61#define CF      (nec_state->CarryVal!=0)
62#define SF      (nec_state->SignVal<0)
63#define ZF      (nec_state->ZeroVal==0)
64#define PF      parity_table[(BYTE)nec_state->ParityVal]
65#define AF      (nec_state->AuxVal!=0)
66#define OF      (nec_state->OverVal!=0)
67#define MD      (nec_state->MF!=0)
68
69/************************************************************************/
70
71#define read_byte(a)         (*nec_state->mem.rbyte)(nec_state->program, a)
72#define read_word(a)         (*nec_state->mem.rword)(nec_state->program, a)
73#define write_byte(a,d)         (*nec_state->mem.wbyte)(nec_state->program, (a),(d))
74#define write_word(a,d)         (*nec_state->mem.wword)(nec_state->program, (a),(d))
75
76#define read_port_byte(a)      (*nec_state->mem.rbyte)(nec_state->io, a)
77#define read_port_word(a)      (*nec_state->mem.rword)(nec_state->io, a)
78#define write_port_byte(a,d)   (*nec_state->mem.wbyte)(nec_state->io, (a),(d))
79#define write_port_word(a,d)   (*nec_state->mem.wword)(nec_state->io, (a),(d))
80
81/************************************************************************/
82
83#define CHANGE_PC do { EMPTY_PREFETCH(); } while (0)
84
85#define SegBase(Seg) (nec_state->sregs[Seg] << 4)
86
87#define DefaultBase(Seg) ((nec_state->seg_prefix && (Seg==DS0 || Seg==SS)) ? nec_state->prefix_base : nec_state->sregs[Seg] << 4)
88
89#define GetMemB(Seg,Off) (read_byte(DefaultBase(Seg) + (Off)))
90#define GetMemW(Seg,Off) (read_word(DefaultBase(Seg) + (Off)))
91
92#define PutMemB(Seg,Off,x) { write_byte(DefaultBase(Seg) + (Off), (x)); }
93#define PutMemW(Seg,Off,x) { write_word(DefaultBase(Seg) + (Off), (x)); }
94
95/* prefetch timing */
96
97#define FETCH()          fetch(nec_state)
98#define FETCH_XOR(a)      ((a) ^ nec_state->mem.fetch_xor)
99#define FETCHWORD()         fetchword(nec_state)
100#define EMPTY_PREFETCH()   nec_state->prefetch_reset = 1
101
102
103#define PUSH(val) { nec_state->regs.w[SP]-=2; write_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP])),val); }
104#define POP(var) { var = read_word((((nec_state->sregs[SS]<<4)+nec_state->regs.w[SP]))); nec_state->regs.w[SP]+=2; }
105
106#define GetModRM UINT32 ModRM=FETCH()
107
108/* Cycle count macros:
109    CLK  - cycle count is the same on all processors
110    CLKS - cycle count differs between processors, list all counts
111    CLKW - cycle count for word read/write differs for odd/even source/destination address
112    CLKM - cycle count for reg/mem instructions
113    CLKR - cycle count for reg/mem instructions with different counts for odd/even addresses
114
115
116    Prefetch & buswait time is not emulated.
117    Extra cycles for PUSH'ing or POP'ing registers to odd addresses is not emulated.
118*/
119
120#define CLK(all) nec_state->icount-=all
121#define CLKS(v20,v30,v33) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33; nec_state->icount-=(ccount>>nec_state->chip_type)&0x7f; }
122#define CLKW(v20o,v30o,v33o,v20e,v30e,v33e,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; nec_state->icount-=(addr&1)?((ocount>>nec_state->chip_type)&0x7f):((ecount>>nec_state->chip_type)&0x7f); }
123#define CLKM(v20,v30,v33,v20m,v30m,v33m) { const UINT32 ccount=(v20<<16)|(v30<<8)|v33, mcount=(v20m<<16)|(v30m<<8)|v33m; nec_state->icount-=( ModRM >=0xc0 )?((ccount>>nec_state->chip_type)&0x7f):((mcount>>nec_state->chip_type)&0x7f); }
124#define CLKR(v20o,v30o,v33o,v20e,v30e,v33e,vall,addr) { const UINT32 ocount=(v20o<<16)|(v30o<<8)|v33o, ecount=(v20e<<16)|(v30e<<8)|v33e; if (ModRM >=0xc0) nec_state->icount-=vall; else nec_state->icount-=(addr&1)?((ocount>>nec_state->chip_type)&0x7f):((ecount>>nec_state->chip_type)&0x7f); }
125
126/************************************************************************/
127#define CompressFlags() (WORD)(CF | (PF << 2) | (AF << 4) | (ZF << 6) \
128            | (SF << 7) | (nec_state->TF << 8) | (nec_state->IF << 9) \
129            | (nec_state->DF << 10) | (OF << 11)| (MD << 15))
130
131#define ExpandFlags(f) \
132{ \
133   nec_state->CarryVal = (f) & 1; \
134   nec_state->ParityVal = !((f) & 4); \
135   nec_state->AuxVal = (f) & 16; \
136   nec_state->ZeroVal = !((f) & 64); \
137   nec_state->SignVal = (f) & 128 ? -1 : 0; \
138   nec_state->TF = ((f) & 256) == 256; \
139   nec_state->IF = ((f) & 512) == 512; \
140   nec_state->DF = ((f) & 1024) == 1024; \
141   nec_state->OverVal = (f) & 2048; \
142   nec_state->MF = ((f) & 0x8000) == 0x8000; \
143}
144
145#define IncWordReg(Reg)                \
146   unsigned tmp = (unsigned)nec_state->regs.w[Reg]; \
147   unsigned tmp1 = tmp+1;               \
148   nec_state->OverVal = (tmp == 0x7fff);          \
149   SetAF(tmp1,tmp,1);                  \
150   SetSZPF_Word(tmp1);                \
151   nec_state->regs.w[Reg]=tmp1
152
153#define DecWordReg(Reg)                \
154   unsigned tmp = (unsigned)nec_state->regs.w[Reg]; \
155    unsigned tmp1 = tmp-1;                \
156   nec_state->OverVal = (tmp == 0x8000);          \
157    SetAF(tmp1,tmp,1);                   \
158    SetSZPF_Word(tmp1);                \
159   nec_state->regs.w[Reg]=tmp1
160
161#define JMP(flag)                     \
162   int tmp;                        \
163   EMPTY_PREFETCH();                  \
164   tmp = (int)((INT8)FETCH());            \
165   if (flag)                        \
166   {                              \
167      static const UINT8 table[3]={3,10,10};    \
168      nec_state->ip = (WORD)(nec_state->ip+tmp);         \
169      nec_state->icount-=table[nec_state->chip_type/8];   \
170      CHANGE_PC;                     \
171      return;                        \
172   }
173
174#define ADJ4(param1,param2)               \
175   if (AF || ((nec_state->regs.b[AL] & 0xf) > 9))   \
176   {                              \
177      UINT16 tmp;                     \
178      tmp = nec_state->regs.b[AL] + param1;      \
179      nec_state->regs.b[AL] = tmp;               \
180      nec_state->AuxVal = 1;                  \
181      nec_state->CarryVal |= tmp & 0x100;         \
182   }                              \
183   if (CF || (nec_state->regs.b[AL]>0x9f))         \
184   {                              \
185      nec_state->regs.b[AL] += param2;            \
186      nec_state->CarryVal = 1;                  \
187   }                              \
188   SetSZPF_Byte(nec_state->regs.b[AL])
189
190#define ADJB(param1,param2)               \
191   if (AF || ((nec_state->regs.b[AL] & 0xf) > 9))   \
192    {                              \
193      nec_state->regs.b[AL] += param1;            \
194      nec_state->regs.b[AH] += param2;            \
195      nec_state->AuxVal = 1;                  \
196      nec_state->CarryVal = 1;                  \
197    }                              \
198   else                           \
199   {                              \
200      nec_state->AuxVal = 0;                  \
201      nec_state->CarryVal = 0;                  \
202    }                              \
203   nec_state->regs.b[AL] &= 0x0F
204
205#define BITOP_BYTE                     \
206   ModRM = FETCH();                     \
207   if (ModRM >= 0xc0) {               \
208      tmp=nec_state->regs.b[Mod_RM.RM.b[ModRM]];   \
209   }                              \
210   else {                           \
211      (*GetEA[ModRM])(nec_state);               \
212      tmp=read_byte(EA);               \
213    }
214
215#define BITOP_WORD                     \
216   ModRM = FETCH();                     \
217   if (ModRM >= 0xc0) {               \
218      tmp=nec_state->regs.w[Mod_RM.RM.w[ModRM]];   \
219   }                              \
220   else {                           \
221      (*GetEA[ModRM])(nec_state);               \
222      tmp=read_word(EA);               \
223    }
224
225#define BIT_NOT                        \
226   if (tmp & (1<<tmp2))               \
227      tmp &= ~(1<<tmp2);               \
228   else                           \
229      tmp |= (1<<tmp2)
230
231#define XchgAWReg(Reg)                   \
232    WORD tmp;                         \
233   tmp = nec_state->regs.w[Reg];                \
234   nec_state->regs.w[Reg] = nec_state->regs.w[AW];          \
235   nec_state->regs.w[AW] = tmp
236
237#define ROL_BYTE nec_state->CarryVal = dst & 0x80; dst = (dst << 1)+CF
238#define ROL_WORD nec_state->CarryVal = dst & 0x8000; dst = (dst << 1)+CF
239#define ROR_BYTE nec_state->CarryVal = dst & 0x1; dst = (dst >> 1)+(CF<<7)
240#define ROR_WORD nec_state->CarryVal = dst & 0x1; dst = (dst >> 1)+(CF<<15)
241#define ROLC_BYTE dst = (dst << 1) + CF; SetCFB(dst)
242#define ROLC_WORD dst = (dst << 1) + CF; SetCFW(dst)
243#define RORC_BYTE dst = (CF<<8)+dst; nec_state->CarryVal = dst & 0x01; dst >>= 1
244#define RORC_WORD dst = (CF<<16)+dst; nec_state->CarryVal = dst & 0x01; dst >>= 1
245#define SHL_BYTE(c) nec_state->icount-=c; dst <<= c;   SetCFB(dst); SetSZPF_Byte(dst);   PutbackRMByte(ModRM,(BYTE)dst)
246#define SHL_WORD(c) nec_state->icount-=c; dst <<= c;   SetCFW(dst); SetSZPF_Word(dst);   PutbackRMWord(ModRM,(WORD)dst)
247#define SHR_BYTE(c) nec_state->icount-=c; dst >>= c-1; nec_state->CarryVal = dst & 0x1; dst >>= 1; SetSZPF_Byte(dst); PutbackRMByte(ModRM,(BYTE)dst)
248#define SHR_WORD(c) nec_state->icount-=c; dst >>= c-1; nec_state->CarryVal = dst & 0x1; dst >>= 1; SetSZPF_Word(dst); PutbackRMWord(ModRM,(WORD)dst)
249#define SHRA_BYTE(c) nec_state->icount-=c; dst = ((INT8)dst) >> (c-1);   nec_state->CarryVal = dst & 0x1;   dst = ((INT8)((BYTE)dst)) >> 1; SetSZPF_Byte(dst); PutbackRMByte(ModRM,(BYTE)dst)
250#define SHRA_WORD(c) nec_state->icount-=c; dst = ((INT16)dst) >> (c-1);   nec_state->CarryVal = dst & 0x1;   dst = ((INT16)((WORD)dst)) >> 1; SetSZPF_Word(dst); PutbackRMWord(ModRM,(WORD)dst)
251
252#define DIVUB                                    \
253   uresult = nec_state->regs.w[AW];                           \
254   uresult2 = uresult % tmp;                        \
255   if ((uresult /= tmp) > 0xff) {                     \
256      nec_interrupt(nec_state, 0,0); break;                     \
257   } else {                                    \
258      nec_state->regs.b[AL] = uresult;                        \
259      nec_state->regs.b[AH] = uresult2;                     \
260   }
261
262#define DIVB                                    \
263   result = (INT16)nec_state->regs.w[AW];                     \
264   result2 = result % (INT16)((INT8)tmp);               \
265   if ((result /= (INT16)((INT8)tmp)) > 0xff) {         \
266      nec_interrupt(nec_state, 0,0); break;                     \
267   } else {                                    \
268      nec_state->regs.b[AL] = result;                        \
269      nec_state->regs.b[AH] = result2;                        \
270   }
271
272#define DIVUW                                    \
273   uresult = (((UINT32)nec_state->regs.w[DW]) << 16) | nec_state->regs.w[AW];\
274   uresult2 = uresult % tmp;                        \
275   if ((uresult /= tmp) > 0xffff) {                  \
276      nec_interrupt(nec_state, 0,0); break;                     \
277   } else {                                    \
278      nec_state->regs.w[AW]=uresult;                        \
279      nec_state->regs.w[DW]=uresult2;                        \
280   }
281
282#define DIVW                                    \
283   result = ((UINT32)nec_state->regs.w[DW] << 16) + nec_state->regs.w[AW];   \
284   result2 = result % (INT32)((INT16)tmp);               \
285   if ((result /= (INT32)((INT16)tmp)) > 0xffff) {         \
286      nec_interrupt(nec_state, 0,0); break;                     \
287   } else {                                    \
288      nec_state->regs.w[AW]=result;                        \
289      nec_state->regs.w[DW]=result2;                        \
290   }
291
292#define ADD4S {                                    \
293   int i,v1,v2,result;                              \
294   int count = (nec_state->regs.b[CL]+1)/2;                     \
295   unsigned di = nec_state->regs.w[IY];                        \
296   unsigned si = nec_state->regs.w[IX];                        \
297   static const UINT8 table[3]={18,19,19};                \
298   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for add4s\n",PC(nec_state));   \
299   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
300   for (i=0;i<count;i++) {                           \
301      nec_state->icount-=table[nec_state->chip_type/8];               \
302      tmp = GetMemB(DS0, si);                        \
303      tmp2 = GetMemB(DS1, di);                     \
304      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
305      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
306      result = v1+v2+nec_state->CarryVal;                     \
307      nec_state->CarryVal = result > 99 ? 1 : 0;               \
308      result = result % 100;                        \
309      v1 = ((result/10)<<4) | (result % 10);            \
310      PutMemB(DS1, di,v1);                        \
311      if (v1) nec_state->ZeroVal = 1;                        \
312      si++;                                    \
313      di++;                                    \
314   }                                          \
315}
316
317#define SUB4S {                                    \
318   int count = (nec_state->regs.b[CL]+1)/2;                     \
319   int i,v1,v2,result;                              \
320    unsigned di = nec_state->regs.w[IY];                        \
321   unsigned si = nec_state->regs.w[IX];                        \
322   static const UINT8 table[3]={18,19,19};               \
323   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for sub4s\n",PC(nec_state));   \
324   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
325   for (i=0;i<count;i++) {                           \
326      nec_state->icount-=table[nec_state->chip_type/8];               \
327      tmp = GetMemB(DS1, di);                        \
328      tmp2 = GetMemB(DS0, si);                     \
329      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
330      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
331      if (v1 < (v2+nec_state->CarryVal)) {                     \
332         v1+=100;                              \
333         result = v1-(v2+nec_state->CarryVal);               \
334         nec_state->CarryVal = 1;                           \
335      } else {                                 \
336         result = v1-(v2+nec_state->CarryVal);               \
337         nec_state->CarryVal = 0;                           \
338      }                                       \
339      v1 = ((result/10)<<4) | (result % 10);            \
340      PutMemB(DS1, di,v1);                        \
341      if (v1) nec_state->ZeroVal = 1;                        \
342      si++;                                    \
343      di++;                                    \
344   }                                          \
345}
346
347#define CMP4S {                                    \
348   int count = (nec_state->regs.b[CL]+1)/2;                     \
349   int i,v1,v2,result;                              \
350    unsigned di = nec_state->regs.w[IY];                        \
351   unsigned si = nec_state->regs.w[IX];                        \
352   static const UINT8 table[3]={14,19,19};               \
353   if (nec_state->seg_prefix) logerror("%06x: Warning: seg_prefix defined for cmp4s\n",PC(nec_state));   \
354   nec_state->ZeroVal = nec_state->CarryVal = 0;                        \
355   for (i=0;i<count;i++) {                           \
356      nec_state->icount-=table[nec_state->chip_type/8];               \
357      tmp = GetMemB(DS1, di);                        \
358      tmp2 = GetMemB(DS0, si);                     \
359      v1 = (tmp>>4)*10 + (tmp&0xf);                  \
360      v2 = (tmp2>>4)*10 + (tmp2&0xf);                  \
361      if (v1 < (v2+nec_state->CarryVal)) {                     \
362         v1+=100;                              \
363         result = v1-(v2+nec_state->CarryVal);               \
364         nec_state->CarryVal = 1;                           \
365      } else {                                 \
366         result = v1-(v2+nec_state->CarryVal);               \
367         nec_state->CarryVal = 0;                           \
368      }                                       \
369      v1 = ((result/10)<<4) | (result % 10);            \
370      if (v1) nec_state->ZeroVal = 1;                        \
371      si++;                                    \
372      di++;                                    \
373   }                                          \
374}
src/emu/cpu/mips/mips3com.h
r3957r3958
225225    FUNCTION PROTOTYPES
226226***************************************************************************/
227227
228void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, const device_config *device, int index, int clock, cpu_irq_callback irqcallback);
228void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, const device_config *device, cpu_irq_callback irqcallback);
229229void mips3com_exit(mips3_state *mips);
230230
231231void mips3com_reset(mips3_state *mips);
src/emu/cpu/mips/mips3.h
r3957r3958
227227
228228#if (HAS_R4600)
229229CPU_GET_INFO( r4600be );
230#define CPU_R4600BE CPU_GET_INFO_NAME( r4600be )
230231CPU_GET_INFO( r4600le );
232#define CPU_R4600LE CPU_GET_INFO_NAME( r4600le )
231233#endif
232234
235#if (HAS_R4650)
236CPU_GET_INFO( r4650be);
237#define CPU_R4650BE CPU_GET_INFO_NAME( r4650be )
238CPU_GET_INFO( r4650le);
239#define CPU_R4650LE CPU_GET_INFO_NAME( r4650le )
240#endif
241
233242#if (HAS_R4700)
234243CPU_GET_INFO( r4700be );
244#define CPU_R4700BE CPU_GET_INFO_NAME( r4700be )
235245CPU_GET_INFO( r4700le );
246#define CPU_R4700LE CPU_GET_INFO_NAME( r4700le )
236247#endif
237248
238249#if (HAS_R5000)
239250CPU_GET_INFO( r5000be );
251#define CPU_R5000BE CPU_GET_INFO_NAME( r5000be )
240252CPU_GET_INFO( r5000le );
253#define CPU_R5000LE CPU_GET_INFO_NAME( r5000le )
241254#endif
242255
243256#if (HAS_QED5271)
244257CPU_GET_INFO( qed5271be );
258#define CPU_QED5271BE CPU_GET_INFO_NAME( qed5271be )
245259CPU_GET_INFO( qed5271le );
260#define CPU_QED5271LE CPU_GET_INFO_NAME( qed5271le )
246261#endif
247262
248263#if (HAS_RM7000)
249264CPU_GET_INFO( rm7000be );
265#define CPU_RM7000BE CPU_GET_INFO_NAME( rm7000be )
250266CPU_GET_INFO( rm7000le );
267#define CPU_RM7000LE CPU_GET_INFO_NAME( rm7000le )
251268#endif
252269
253270
src/emu/cpu/mips/r3000.c
r3957r3958
11831183      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                           break;
11841184      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                           break;
11851185
1186      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                     break;
1187      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 29;                     break;
1188      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                     break;
1189      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                     break;
1190      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;                     break;
1191      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                     break;
1192      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                     break;
1193      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;                     break;
1194      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;                     break;
1186      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;                     break;
1187      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 29;                     break;
1188      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                     break;
1189      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                     break;
1190      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;                     break;
1191      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                     break;
1192      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                     break;
1193      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;                     break;
1194      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;                     break;
11951195
11961196      case CPUINFO_INT_INPUT_STATE + R3000_IRQ0:      info->i = (r3000->cpr[0][COP0_Cause] & 0x400) ? ASSERT_LINE : CLEAR_LINE; break;
11971197      case CPUINFO_INT_INPUT_STATE + R3000_IRQ1:      info->i = (r3000->cpr[0][COP0_Cause] & 0x800) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
12411241      case CPUINFO_INT_REGISTER + R3000_R31:         info->i = r3000->r[31];                     break;
12421242
12431243      /* --- the following bits of info are returned as pointers to data or functions --- */
1244      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(r3000);      break;
1245      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r3000);            break;
1246      case CPUINFO_PTR_RESET:                     /* provided per-CPU */                     break;
1247      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(r3000);            break;
1248      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(r3000);      break;
1249      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1250      case CPUINFO_PTR_DISASSEMBLE:               /* provided per-CPU */                     break;
1244      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(r3000);      break;
1245      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r3000);            break;
1246      case CPUINFO_FCT_RESET:                     /* provided per-CPU */                     break;
1247      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(r3000);            break;
1248      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(r3000);      break;
1249      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1250      case CPUINFO_FCT_DISASSEMBLE:               /* provided per-CPU */                     break;
12511251      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &r3000->icount;               break;
12521252
12531253      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
13101310      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;                     break;
13111311
13121312      /* --- the following bits of info are returned as pointers to data or functions --- */
1313      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(r3000be);         break;
1314      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000be);   break;
1313      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(r3000be);         break;
1314      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000be);   break;
13151315
13161316      /* --- the following bits of info are returned as NULL-terminated strings --- */
13171317      case CPUINFO_STR_NAME:                     strcpy(info->s, "R3000 (big)");               break;
r3957r3958
13291329      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;                     break;
13301330
13311331      /* --- the following bits of info are returned as pointers to data or functions --- */
1332      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(r3000le);         break;
1333      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000le);   break;
1332      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(r3000le);         break;
1333      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000le);   break;
13341334
13351335      /* --- the following bits of info are returned as NULL-terminated strings --- */
13361336      case CPUINFO_STR_NAME:                     strcpy(info->s, "R3000 (little)");            break;
r3957r3958
13481348      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;                     break;
13491349
13501350      /* --- the following bits of info are returned as pointers to data or functions --- */
1351      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(r3000be);         break;
1352      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000be);   break;
1351      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(r3000be);         break;
1352      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000be);   break;
13531353
13541354      /* --- the following bits of info are returned as NULL-terminated strings --- */
13551355      case CPUINFO_STR_NAME:                     strcpy(info->s, "R3041 (big)");               break;
r3957r3958
13671367      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;                     break;
13681368
13691369      /* --- the following bits of info are returned as pointers to data or functions --- */
1370      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(r3000le);         break;
1371      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000le);   break;
1370      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(r3000le);         break;
1371      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(r3000le);   break;
13721372
13731373      /* --- the following bits of info are returned as NULL-terminated strings --- */
13741374      case CPUINFO_STR_NAME:                     strcpy(info->s, "R3041 (little)");            break;
src/emu/cpu/mips/r3000.h
r3957r3958
6363extern CPU_GET_INFO( r3000be );
6464extern CPU_GET_INFO( r3000le );
6565
66#define CPU_R3000BE CPU_GET_INFO_NAME( r3000be )
67#define CPU_R3000LE CPU_GET_INFO_NAME( r3000le )
68
6669extern CPU_GET_INFO( r3041be );
6770extern CPU_GET_INFO( r3041le );
6871
72#define CPU_R3041BE CPU_GET_INFO_NAME( r3041be )
73#define CPU_R3041LE CPU_GET_INFO_NAME( r3041le )
74
6975#endif /* __R3000_H__ */
src/emu/cpu/mips/psx.c
r3957r3958
40424042      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
40434043      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
40444044
4045      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
4046      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
4047      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
4048      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
4049      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4050      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4051      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
4052      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
4053      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
4045      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
4046      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
4047      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
4048      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
4049      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
4050      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
4051      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
4052      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
4053      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
40544054
40554055      case CPUINFO_INT_INPUT_STATE + PSXCPU_IRQ0:      info->i = (psxcpu->cp0r[ CP0_CAUSE ] & 0x400) ? ASSERT_LINE : CLEAR_LINE; break;
40564056      case CPUINFO_INT_INPUT_STATE + PSXCPU_IRQ1:      info->i = (psxcpu->cp0r[ CP0_CAUSE ] & 0x800) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
41874187      case CPUINFO_INT_REGISTER + PSXCPU_CP2CR31:      info->i = psxcpu->cp2cr[ 31 ].d;      break;
41884188
41894189      /* --- the following bits of info are returned as pointers to data or functions --- */
4190      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(psxcpu);         break;
4191      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(psxcpu);               break;
4192      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(psxcpu);            break;
4193      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(psxcpu);               break;
4194      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(psxcpu);         break;
4195      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
4196      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(psxcpu);   break;
4190      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(psxcpu);         break;
4191      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(psxcpu);               break;
4192      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(psxcpu);            break;
4193      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(psxcpu);               break;
4194      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(psxcpu);         break;
4195      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
4196      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(psxcpu);   break;
41974197      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &psxcpu->icount;         break;
41984198
4199      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(psxcpu_internal_map); break;
4200      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map32 = 0; break;
4201      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map32 = 0; break;
4199      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(psxcpu_internal_map); break;
4200      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:    info->internal_map32 = 0; break;
4201      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map32 = 0; break;
42024202
42034203      /* --- the following bits of info are returned as NULL-terminated strings --- */
42044204      case CPUINFO_STR_NAME:                     strcpy(info->s, "PSX CPU"); break;
r3957r3958
43374337{
43384338   switch (state)
43394339   {
4340      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(cxd8661r_internal_map); break;
4340      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map32 = ADDRESS_MAP_NAME(cxd8661r_internal_map); break;
43414341
43424342         /* --- the following bits of info are returned as NULL-terminated strings --- */
43434343      case CPUINFO_STR_NAME:                     strcpy(info->s, "CXD8661R"); break;
src/emu/cpu/mips/psx.h
r3957r3958
215215
216216extern unsigned DasmPSXCPU( DasmPSXCPU_state *state, char *buffer, UINT32 pc, const UINT8 *opram );
217217
218CPU_GET_INFO( psxcpu );
219#define CPU_PSXCPU CPU_GET_INFO_NAME( psxcpu )
220
221CPU_GET_INFO( cxd8661r );
222#define CPU_CXD8661R CPU_GET_INFO_NAME( cxd8661r )
223
218224#endif /* __PSX_H__ */
src/emu/cpu/mips/mips3drc.c
r3957r3958
340340    mips3_init - initialize the processor
341341-------------------------------------------------*/
342342
343static void mips3_init(mips3_flavor flavor, int bigendian, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
343static void mips3_init(mips3_flavor flavor, int bigendian, const device_config *device, cpu_irq_callback irqcallback)
344344{
345345   drcfe_config feconfig =
346346   {
r3957r3958
365365   memset(mips3, 0, sizeof(*mips3));
366366
367367   /* initialize the core */
368   mips3com_init(mips3, flavor, bigendian, device, index, clock, irqcallback);
368   mips3com_init(mips3, flavor, bigendian, device, irqcallback);
369369
370370   /* allocate the implementation-specific state from the full cache */
371371   mips3->impstate = drccache_memory_alloc_near(cache, sizeof(*mips3->impstate));
r3957r3958
600600
601601static CPU_GET_INFO( mips3 )
602602{
603   mips3_state *mips3 = (device != NULL) ? *(mips3_state **)device->token : NULL;
603   mips3_state *mips3 = (device != NULL && device->token != NULL) ? *(mips3_state **)device->token : NULL;
604604   switch (state)
605605   {
606606      /* --- the following bits of info are returned as 64-bit signed integers --- */
r3957r3958
608608      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */                     break;
609609
610610      /* --- the following bits of info are returned as pointers to data or functions --- */
611      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mips3);      break;
612      case CPUINFO_PTR_INIT:                     /* provided per-CPU */                     break;
613      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(mips3);         break;
614      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(mips3);            break;
615      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mips3);      break;
616      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mips3);break;
617      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(mips3);   break;
611      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mips3);      break;
612      case CPUINFO_FCT_INIT:                     /* provided per-CPU */                     break;
613      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(mips3);         break;
614      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(mips3);            break;
615      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mips3);      break;
616      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mips3);break;
617      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(mips3);   break;
618618
619619      /* --- the following bits of info are returned as NULL-terminated strings --- */
620620      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
r3957r3958
36253625#if (HAS_R4600)
36263626static CPU_INIT( r4600be )
36273627{
3628   mips3_init(MIPS3_TYPE_R4600, TRUE, device, index, clock, irqcallback);
3628   mips3_init(MIPS3_TYPE_R4600, TRUE, device, irqcallback);
36293629}
36303630
36313631static CPU_INIT( r4600le )
36323632{
3633   mips3_init(MIPS3_TYPE_R4600, FALSE, device, index, clock, irqcallback);
3633   mips3_init(MIPS3_TYPE_R4600, FALSE, device, irqcallback);
36343634}
36353635
36363636CPU_GET_INFO( r4600be )
r3957r3958
36413641      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
36423642
36433643      /* --- the following bits of info are returned as pointers to data or functions --- */
3644      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4600be);            break;
3644      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4600be);            break;
36453645
36463646      /* --- the following bits of info are returned as NULL-terminated strings --- */
36473647      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (big)");         break;
r3957r3958
36593659      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
36603660
36613661      /* --- the following bits of info are returned as pointers to data or functions --- */
3662      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4600le);            break;
3662      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4600le);            break;
36633663
36643664      /* --- the following bits of info are returned as NULL-terminated strings --- */
36653665      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (little)");      break;
r3957r3958
36793679#if (HAS_R4650)
36803680static CPU_INIT( r4650be )
36813681{
3682   mips3_init(MIPS3_TYPE_R4650, TRUE, device, index, clock, irqcallback);
3682   mips3_init(MIPS3_TYPE_R4650, TRUE, device, irqcallback);
36833683}
36843684
36853685static CPU_INIT( r4650le )
36863686{
3687   mips3_init(MIPS3_TYPE_R4650, FALSE, device, index, clock, irqcallback);
3687   mips3_init(MIPS3_TYPE_R4650, FALSE, device, irqcallback);
36883688}
36893689
36903690CPU_GET_INFO( r4650be )
r3957r3958
36953695      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
36963696
36973697      /* --- the following bits of info are returned as pointers to data or functions --- */
3698      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4650be);            break;
3698      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4650be);            break;
36993699
37003700      /* --- the following bits of info are returned as NULL-terminated strings --- */
37013701      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (big)");      break;
r3957r3958
37133713      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
37143714
37153715      /* --- the following bits of info are returned as pointers to data or functions --- */
3716      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4650le);            break;
3716      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4650le);            break;
37173717
37183718      /* --- the following bits of info are returned as NULL-terminated strings --- */
37193719      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (little)");   break;
r3957r3958
37333733#if (HAS_R4700)
37343734static CPU_INIT( r4700be )
37353735{
3736   mips3_init(MIPS3_TYPE_R4700, TRUE, device, index, clock, irqcallback);
3736   mips3_init(MIPS3_TYPE_R4700, TRUE, device, irqcallback);
37373737}
37383738
37393739static CPU_INIT( r4700le )
37403740{
3741   mips3_init(MIPS3_TYPE_R4700, FALSE, device, index, clock, irqcallback);
3741   mips3_init(MIPS3_TYPE_R4700, FALSE, device, irqcallback);
37423742}
37433743
37443744CPU_GET_INFO( r4700be )
r3957r3958
37493749      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
37503750
37513751      /* --- the following bits of info are returned as pointers to data or functions --- */
3752      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4700be);            break;
3752      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4700be);            break;
37533753
37543754      /* --- the following bits of info are returned as NULL-terminated strings --- */
37553755      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (big)");         break;
r3957r3958
37673767      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
37683768
37693769      /* --- the following bits of info are returned as pointers to data or functions --- */
3770      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4700le);            break;
3770      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4700le);            break;
37713771
37723772      /* --- the following bits of info are returned as NULL-terminated strings --- */
37733773      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (little)");      break;
r3957r3958
37873787#if (HAS_R5000)
37883788static CPU_INIT( r5000be )
37893789{
3790   mips3_init(MIPS3_TYPE_R5000, TRUE, device, index, clock, irqcallback);
3790   mips3_init(MIPS3_TYPE_R5000, TRUE, device, irqcallback);
37913791}
37923792
37933793static CPU_INIT( r5000le )
37943794{
3795   mips3_init(MIPS3_TYPE_R5000, FALSE, device, index, clock, irqcallback);
3795   mips3_init(MIPS3_TYPE_R5000, FALSE, device, irqcallback);
37963796}
37973797
37983798CPU_GET_INFO( r5000be )
r3957r3958
38033803      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
38043804
38053805      /* --- the following bits of info are returned as pointers to data or functions --- */
3806      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r5000be);            break;
3806      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r5000be);            break;
38073807
38083808      /* --- the following bits of info are returned as NULL-terminated strings --- */
38093809      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (big)");         break;
r3957r3958
38213821      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
38223822
38233823      /* --- the following bits of info are returned as pointers to data or functions --- */
3824      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r5000le);            break;
3824      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r5000le);            break;
38253825
38263826      /* --- the following bits of info are returned as NULL-terminated strings --- */
38273827      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (little)");      break;
r3957r3958
38413841#if (HAS_QED5271)
38423842static CPU_INIT( qed5271be )
38433843{
3844   mips3_init(MIPS3_TYPE_QED5271, TRUE, device, index, clock, irqcallback);
3844   mips3_init(MIPS3_TYPE_QED5271, TRUE, device, irqcallback);
38453845}
38463846
38473847static CPU_INIT( qed5271le )
38483848{
3849   mips3_init(MIPS3_TYPE_QED5271, FALSE, device, index, clock, irqcallback);
3849   mips3_init(MIPS3_TYPE_QED5271, FALSE, device, irqcallback);
38503850}
38513851
38523852CPU_GET_INFO( qed5271be )
r3957r3958
38573857      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
38583858
38593859      /* --- the following bits of info are returned as pointers to data or functions --- */
3860      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(qed5271be);         break;
3860      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(qed5271be);         break;
38613861
38623862      /* --- the following bits of info are returned as NULL-terminated strings --- */
38633863      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (big)");      break;
r3957r3958
38753875      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
38763876
38773877      /* --- the following bits of info are returned as pointers to data or functions --- */
3878      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(qed5271le);         break;
3878      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(qed5271le);         break;
38793879
38803880      /* --- the following bits of info are returned as NULL-terminated strings --- */
38813881      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (little)");   break;
r3957r3958
38953895#if (HAS_RM7000)
38963896static CPU_INIT( rm7000be )
38973897{
3898   mips3_init(MIPS3_TYPE_RM7000, TRUE, device, index, clock, irqcallback);
3898   mips3_init(MIPS3_TYPE_RM7000, TRUE, device, irqcallback);
38993899}
39003900
39013901static CPU_INIT( rm7000le )
39023902{
3903   mips3_init(MIPS3_TYPE_RM7000, FALSE, device, index, clock, irqcallback);
3903   mips3_init(MIPS3_TYPE_RM7000, FALSE, device, irqcallback);
39043904}
39053905
39063906CPU_GET_INFO( rm7000be )
r3957r3958
39113911      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
39123912
39133913      /* --- the following bits of info are returned as pointers to data or functions --- */
3914      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(rm7000be);            break;
3914      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(rm7000be);            break;
39153915
39163916      /* --- the following bits of info are returned as NULL-terminated strings --- */
39173917      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (big)");      break;
r3957r3958
39293929      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
39303930
39313931      /* --- the following bits of info are returned as pointers to data or functions --- */
3932      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(rm7000le);            break;
3932      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(rm7000le);            break;
39333933
39343934      /* --- the following bits of info are returned as NULL-terminated strings --- */
39353935      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (little)");      break;
src/emu/cpu/mips/mips3com.c
r3957r3958
7070    structure based on the configured type
7171-------------------------------------------------*/
7272
73void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
73void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, const device_config *device, cpu_irq_callback irqcallback)
7474{
7575   const mips3_config *config = device->static_config;
7676   int tlbindex;
r3957r3958
7979   memset(mips, 0, sizeof(*mips));
8080   mips->flavor = flavor;
8181   mips->bigendian = bigendian;
82   mips->cpu_clock = clock;
82   mips->cpu_clock = device->clock;
8383   mips->irq_callback = irqcallback;
8484   mips->device = device;
8585   mips->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
r3957r3958
457457      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
458458      case CPUINFO_INT_MAX_CYCLES:               info->i = 40;                     break;
459459
460      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = MIPS3_MAX_PADDR_SHIFT;break;
461      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
462      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
463      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
464      case CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM:    info->i = MIPS3_MIN_PAGE_SHIFT;   break;
460      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = MIPS3_MAX_PADDR_SHIFT;break;
461      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
462      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
463      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 32;               break;
464      case CPUINFO_INT_PAGE_SHIFT_PROGRAM:    info->i = MIPS3_MIN_PAGE_SHIFT;   break;
465465
466466      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ0:      info->i = (mips->cpr[0][COP0_Cause] & 0x400) ? ASSERT_LINE : CLEAR_LINE;   break;
467467      case CPUINFO_INT_INPUT_STATE + MIPS3_IRQ1:      info->i = (mips->cpr[0][COP0_Cause] & 0x800) ? ASSERT_LINE : CLEAR_LINE;   break;
r3957r3958
525525      case CPUINFO_INT_REGISTER + MIPS3_LO:         info->i = mips->r[REG_LO];            break;
526526
527527      /* --- the following bits of info are returned as pointers to data or functions --- */
528      case CPUINFO_PTR_SET_INFO:                  /* provided by core */               break;
529      case CPUINFO_PTR_INIT:                     /* provided by core */               break;
530      case CPUINFO_PTR_RESET:                     /* provided by core */               break;
531      case CPUINFO_PTR_EXIT:                     /* provided by core */               break;
532      case CPUINFO_PTR_EXECUTE:                  /* provided by core */               break;
533      case CPUINFO_PTR_TRANSLATE:                  /* provided by core */               break;
534      case CPUINFO_PTR_DISASSEMBLE:               /* provided by core */               break;
528      case CPUINFO_FCT_SET_INFO:                  /* provided by core */               break;
529      case CPUINFO_FCT_INIT:                     /* provided by core */               break;
530      case CPUINFO_FCT_RESET:                     /* provided by core */               break;
531      case CPUINFO_FCT_EXIT:                     /* provided by core */               break;
532      case CPUINFO_FCT_EXECUTE:                  /* provided by core */               break;
533      case CPUINFO_FCT_TRANSLATE:                  /* provided by core */               break;
534      case CPUINFO_FCT_DISASSEMBLE:               /* provided by core */               break;
535535      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &mips->icount;         break;
536536
537537      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/mips/mips3.c
r3957r3958
21042104}
21052105
21062106
2107CPU_GET_INFO( mips3 )
2107static CPU_GET_INFO( mips3 )
21082108{
21092109   switch (state)
21102110   {
r3957r3958
21132113      case CPUINFO_INT_PREVIOUSPC:               info->i = mips3.ppc;               break;
21142114
21152115      /* --- the following bits of info are returned as pointers to data or functions --- */
2116      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mips3);         break;
2117      case CPUINFO_PTR_INIT:                     /* provided per-CPU */               break;
2118      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(mips3);            break;
2119      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mips3);         break;
2120      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mips3);         break;
2121      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_GET_TRANSLATE_NAME(mips3);      break;
2116      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mips3);         break;
2117      case CPUINFO_FCT_INIT:                     /* provided per-CPU */               break;
2118      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(mips3);            break;
2119      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mips3);         break;
2120      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mips3);         break;
2121      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_GET_TRANSLATE_NAME(mips3);      break;
21222122
21232123      /* --- the following bits of info are returned as NULL-terminated strings --- */
21242124      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
r3957r3958
21572157      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
21582158
21592159      /* --- the following bits of info are returned as pointers to data or functions --- */
2160      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4600be);            break;
2160      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4600be);            break;
21612161
21622162      /* --- the following bits of info are returned as NULL-terminated strings --- */
21632163      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (big)");         break;
21642164
21652165      /* --- everything else is handled generically --- */
2166      default:                              mips3_get_info(state, info);         break;
2166      default:                              CPU_GET_INFO_CALL(mips3);         break;
21672167   }
21682168}
21692169
r3957r3958
21752175      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
21762176
21772177      /* --- the following bits of info are returned as pointers to data or functions --- */
2178      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4600le);            break;
2178      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4600le);            break;
21792179
21802180      /* --- the following bits of info are returned as NULL-terminated strings --- */
21812181      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4600 (little)");      break;
21822182
21832183      /* --- everything else is handled generically --- */
2184      default:                              mips3_get_info(state, info);         break;
2184      default:                              CPU_GET_INFO_CALL(mips3);         break;
21852185   }
21862186}
21872187#endif
r3957r3958
22152215      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
22162216
22172217      /* --- the following bits of info are returned as pointers to data or functions --- */
2218      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4650be);            break;
2218      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4650be);            break;
22192219
22202220      /* --- the following bits of info are returned as NULL-terminated strings --- */
22212221      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (big)");      break;
22222222
22232223      /* --- everything else is handled generically --- */
2224      default:                              mips3_get_info(state, info);         break;
2224      default:                              CPU_GET_INFO_CALL(mips3);         break;
22252225   }
22262226}
22272227
r3957r3958
22332233      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
22342234
22352235      /* --- the following bits of info are returned as pointers to data or functions --- */
2236      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4650le);            break;
2236      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4650le);            break;
22372237
22382238      /* --- the following bits of info are returned as NULL-terminated strings --- */
22392239      case CPUINFO_STR_NAME:                     strcpy(info->s, "IDT R4650 (little)");   break;
22402240
22412241      /* --- everything else is handled generically --- */
2242      default:                              mips3_get_info(state, info);         break;
2242      default:                              CPU_GET_INFO_CALL(mips3);         break;
22432243   }
22442244}
22452245#endif
r3957r3958
22732273      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
22742274
22752275      /* --- the following bits of info are returned as pointers to data or functions --- */
2276      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4700be);            break;
2276      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4700be);            break;
22772277
22782278      /* --- the following bits of info are returned as NULL-terminated strings --- */
22792279      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (big)");         break;
22802280
22812281      /* --- everything else is handled generically --- */
2282      default:                              mips3_get_info(state, info);         break;
2282      default:                              CPU_GET_INFO_CALL(mips3);         break;
22832283   }
22842284}
22852285
r3957r3958
22922292      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
22932293
22942294      /* --- the following bits of info are returned as pointers to data or functions --- */
2295      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r4700le);            break;
2295      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r4700le);            break;
22962296
22972297      /* --- the following bits of info are returned as NULL-terminated strings --- */
22982298      case CPUINFO_STR_NAME:                     strcpy(info->s, "R4700 (little)");      break;
22992299
23002300      /* --- everything else is handled generically --- */
2301      default:                              mips3_get_info(state, info);         break;
2301      default:                              CPU_GET_INFO_CALL(mips3);         break;
23022302   }
23032303}
23042304#endif
r3957r3958
23322332      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
23332333
23342334      /* --- the following bits of info are returned as pointers to data or functions --- */
2335      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r5000be);            break;
2335      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r5000be);            break;
23362336
23372337      /* --- the following bits of info are returned as NULL-terminated strings --- */
23382338      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (big)");         break;
23392339
23402340      /* --- everything else is handled generically --- */
2341      default:                              mips3_get_info(state, info);         break;
2341      default:                              CPU_GET_INFO_CALL(mips3);         break;
23422342   }
23432343}
23442344
r3957r3958
23502350      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
23512351
23522352      /* --- the following bits of info are returned as pointers to data or functions --- */
2353      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(r5000le);            break;
2353      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(r5000le);            break;
23542354
23552355      /* --- the following bits of info are returned as NULL-terminated strings --- */
23562356      case CPUINFO_STR_NAME:                     strcpy(info->s, "R5000 (little)");      break;
23572357
23582358      /* --- everything else is handled generically --- */
2359      default:                              mips3_get_info(state, info);         break;
2359      default:                              CPU_GET_INFO_CALL(mips3);         break;
23602360   }
23612361}
23622362#endif
r3957r3958
23902390      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
23912391
23922392      /* --- the following bits of info are returned as pointers to data or functions --- */
2393      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(qed5271be);         break;
2393      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(qed5271be);         break;
23942394
23952395      /* --- the following bits of info are returned as NULL-terminated strings --- */
23962396      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (big)");      break;
23972397
23982398      /* --- everything else is handled generically --- */
2399      default:                              mips3_get_info(state, info);         break;
2399      default:                              CPU_GET_INFO_CALL(mips3);         break;
24002400   }
24012401}
24022402
r3957r3958
24082408      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
24092409
24102410      /* --- the following bits of info are returned as pointers to data or functions --- */
2411      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(qed5271le);         break;
2411      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(qed5271le);         break;
24122412
24132413      /* --- the following bits of info are returned as NULL-terminated strings --- */
24142414      case CPUINFO_STR_NAME:                     strcpy(info->s, "QED5271 (little)");   break;
24152415
24162416      /* --- everything else is handled generically --- */
2417      default:                              mips3_get_info(state, info);         break;
2417      default:                              CPU_GET_INFO_CALL(mips3);         break;
24182418   }
24192419}
24202420#endif
r3957r3958
24482448      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_BIG;               break;
24492449
24502450      /* --- the following bits of info are returned as pointers to data or functions --- */
2451      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(rm7000be);            break;
2451      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(rm7000be);            break;
24522452
24532453      /* --- the following bits of info are returned as NULL-terminated strings --- */
24542454      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (big)");      break;
24552455
24562456      /* --- everything else is handled generically --- */
2457      default:                              mips3_get_info(state, info);         break;
2457      default:                              CPU_GET_INFO_CALL(mips3);         break;
24582458   }
24592459}
24602460
r3957r3958
24662466      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
24672467
24682468      /* --- the following bits of info are returned as pointers to data or functions --- */
2469      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(rm7000le);            break;
2469      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(rm7000le);            break;
24702470
24712471      /* --- the following bits of info are returned as NULL-terminated strings --- */
24722472      case CPUINFO_STR_NAME:                     strcpy(info->s, "RM7000 (little)");      break;
24732473
24742474      /* --- everything else is handled generically --- */
2475      default:                              mips3_get_info(state, info);         break;
2475      default:                              CPU_GET_INFO_CALL(mips3);         break;
24762476   }
24772477}
24782478#endif
src/emu/cpu/tms7000/tms7000.h
r3957r3958
5151extern CPU_GET_INFO( tms7000 );
5252extern CPU_GET_INFO( tms7000_exl );
5353
54#define CPU_TMS7000 CPU_GET_INFO_NAME( tms7000 )
55#define CPU_TMS7000_EXL CPU_GET_INFO_NAME( tms7000_exl )
56
5457extern CPU_DISASSEMBLE( tms7000 );
5558
5659#endif /* __TMS7000_H__ */
src/emu/cpu/tms7000/tms7000.c
r3957r3958
272272        case CPUINFO_INT_MIN_CYCLES:   info->i = 1;   break;
273273        case CPUINFO_INT_MAX_CYCLES:   info->i = 48;   break; /* 48 represents the multiply instruction, the next highest is 17 */
274274
275        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;   break;
276        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;   break;
277        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;   break;
278        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;   break;
279        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;   break;
280        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;   break;
281        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 8;   break;
282        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:   info->i = 8;   break;
283        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:   info->i = 0;   break;
275        case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;   break;
276        case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 16;   break;
277        case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;   break;
278        case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;   break;
279        case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;   break;
280        case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;   break;
281        case CPUINFO_INT_DATABUS_WIDTH_IO:   info->i = 8;   break;
282        case CPUINFO_INT_ADDRBUS_WIDTH_IO:   info->i = 8;   break;
283        case CPUINFO_INT_ADDRBUS_SHIFT_IO:   info->i = 0;   break;
284284
285285        case CPUINFO_INT_INPUT_STATE + TMS7000_IRQ1_LINE:   info->i = cpustate->irq_state[TMS7000_IRQ1_LINE]; break;
286286        case CPUINFO_INT_INPUT_STATE + TMS7000_IRQ2_LINE:   info->i = cpustate->irq_state[TMS7000_IRQ2_LINE]; break;
r3957r3958
299299      case CPUINFO_INT_REGISTER + TMS7000_T1_DEC: info->i = cpustate->t1_decrementer; break;
300300
301301        /* --- the following bits of info are returned as pointers to data or functions --- */
302        case CPUINFO_PTR_SET_INFO:   info->setinfo = CPU_SET_INFO_NAME(tms7000);   break;
303        case CPUINFO_PTR_INIT:   info->init = CPU_INIT_NAME(tms7000);   break;
304        case CPUINFO_PTR_RESET:   info->reset = CPU_RESET_NAME(tms7000);   break;
305        case CPUINFO_PTR_EXECUTE:   info->execute = CPU_EXECUTE_NAME(tms7000);   break;
306        case CPUINFO_PTR_BURN:   info->burn = NULL;   /* Not supported */break;
307        case CPUINFO_PTR_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(tms7000);   break;
302        case CPUINFO_FCT_SET_INFO:   info->setinfo = CPU_SET_INFO_NAME(tms7000);   break;
303        case CPUINFO_FCT_INIT:   info->init = CPU_INIT_NAME(tms7000);   break;
304        case CPUINFO_FCT_RESET:   info->reset = CPU_RESET_NAME(tms7000);   break;
305        case CPUINFO_FCT_EXECUTE:   info->execute = CPU_EXECUTE_NAME(tms7000);   break;
306        case CPUINFO_FCT_BURN:   info->burn = NULL;   /* Not supported */break;
307        case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(tms7000);   break;
308308        case CPUINFO_PTR_INSTRUCTION_COUNTER:   info->icount = &cpustate->icount;   break;
309309      case CPUINFO_PTR_INTERNAL_MEMORY_MAP:   info->internal_map8 = ADDRESS_MAP_NAME(tms7000_mem); break;
310310
r3957r3958
342342{
343343    switch( state )
344344    {
345      case CPUINFO_PTR_EXECUTE:
345      case CPUINFO_FCT_EXECUTE:
346346         info->execute = CPU_EXECUTE_NAME(tms7000_exl);
347347         break;
348348      default:
src/emu/cpu/f8/f8.h
r3957r3958
4848#define F8_INT_INTR  1
4949
5050CPU_GET_INFO( f8 );
51#define CPU_F8 CPU_GET_INFO_NAME( f8 )
5152
5253#ifdef __cplusplus
5354}
src/emu/cpu/f8/f8.c
r3957r3958
20132013   case CPUINFO_INT_MIN_CYCLES:               info->i = 1;         break;
20142014   case CPUINFO_INT_MAX_CYCLES:               info->i = 7;         break;
20152015
2016   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;   break;
2017   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;   break;
2018   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;   break;
2019   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;   break;
2020   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;   break;
2021   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;   break;
2022   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;   break;
2023   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 8;   break;
2024   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;   break;
2016   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;   break;
2017   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;   break;
2018   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;   break;
2019   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;   break;
2020   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;   break;
2021   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;   break;
2022   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;   break;
2023   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 8;   break;
2024   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;   break;
20252025
20262026   case CPUINFO_INT_SP:            info->i = cpustate->pc1;               break;
20272027   case CPUINFO_INT_PC:            info->i = (cpustate->pc0 - 1) & 0xffff;   break;
r3957r3958
21072107       info->i = cpustate->r[state - (CPUINFO_INT_REGISTER + F8_R16) + 16];   break;
21082108
21092109   /* --- the following bits of info are returned as pointers to data or functions --- */
2110   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(f8);         break;
2111   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(f8);               break;
2112   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(f8);               break;
2113   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(f8);            break;
2114   case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2110   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(f8);         break;
2111   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(f8);               break;
2112   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(f8);               break;
2113   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(f8);            break;
2114   case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
21152115
2116   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(f8);         break;
2116   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(f8);         break;
21172117   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
21182118
21192119   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/z80/z80.c
r3957r3958
134134   const address_space *io;
135135   int      icount;
136136   z80_daisy_state *daisy;
137   cpu_state_table state;
138   UINT8 rtemp;
137139};
138140
139141#define CF      0x01
r3957r3958
192194#define MEMPTR_L memptr.b.l
193195
194196
197/***************************************************************************
198    CPU STATE DESCRIPTION
199***************************************************************************/
200
201#define Z80_STATE_ENTRY(_name, _format, _member, _datamask, _flags) \
202   CPU_STATE_ENTRY(Z80_##_name, #_name, _format, z80_state, _member, _datamask, ~0, _flags)
203
204static const cpu_state_entry state_array[] =
205{
206   Z80_STATE_ENTRY(PC,  "%04X", PCD, 0xffff, 0)
207   Z80_STATE_ENTRY(GENPC, "%04X", PCD, 0xffff, CPUSTATE_NOSHOW)
208   Z80_STATE_ENTRY(GENPCBASE, "%04X", prvpc.w.l, 0xffff, CPUSTATE_NOSHOW)
209
210   Z80_STATE_ENTRY(SP,  "%04X", SP, 0xffff, 0)
211   Z80_STATE_ENTRY(GENSP, "%04X", SPD, 0xffff, CPUSTATE_NOSHOW)
212
213   Z80_STATE_ENTRY(A, "%02X", A, 0xff, CPUSTATE_NOSHOW)
214   Z80_STATE_ENTRY(B, "%02X", B, 0xff, CPUSTATE_NOSHOW)
215   Z80_STATE_ENTRY(C, "%02X", C, 0xff, CPUSTATE_NOSHOW)
216   Z80_STATE_ENTRY(D, "%02X", D, 0xff, CPUSTATE_NOSHOW)
217   Z80_STATE_ENTRY(E, "%02X", E, 0xff, CPUSTATE_NOSHOW)
218   Z80_STATE_ENTRY(H, "%02X", H, 0xff, CPUSTATE_NOSHOW)
219   Z80_STATE_ENTRY(L, "%02X", L, 0xff, CPUSTATE_NOSHOW)
220
221   Z80_STATE_ENTRY(AF, "%04X", AF, 0xffff, 0)
222   Z80_STATE_ENTRY(BC, "%04X", BC, 0xffff, 0)
223   Z80_STATE_ENTRY(DE, "%04X", DE, 0xffff, 0)
224   Z80_STATE_ENTRY(HL, "%04X", HL, 0xffff, 0)
225   Z80_STATE_ENTRY(IX, "%04X", IX, 0xffff, 0)
226   Z80_STATE_ENTRY(IY, "%04X", IY, 0xffff, 0)
227
228   Z80_STATE_ENTRY(AF2, "%04X", af2.w.l, 0xffff, 0)
229   Z80_STATE_ENTRY(BC2, "%04X", bc2.w.l, 0xffff, 0)
230   Z80_STATE_ENTRY(DE2, "%04X", de2.w.l, 0xffff, 0)
231   Z80_STATE_ENTRY(HL2, "%04X", hl2.w.l, 0xffff, 0)
232
233   Z80_STATE_ENTRY(MEMPTR, "%04X", MEMPTR, 0xffff, 0)
234   Z80_STATE_ENTRY(R,      "%02X", rtemp, 0xff, CPUSTATE_EXPORT | CPUSTATE_IMPORT)
235   Z80_STATE_ENTRY(I,      "%02X", i, 0xff, 0)
236   Z80_STATE_ENTRY(IM,     "%1u", im, 0x3, 0)
237   Z80_STATE_ENTRY(IFF1,   "%1u", iff1, 0x1, 0)
238   Z80_STATE_ENTRY(IFF2,   "%1u", iff2, 0x1, 0)
239   Z80_STATE_ENTRY(HALT,   "%1u", halt, 0x1, 0)
240};
241
242static const cpu_state_table state_table_template =
243{
244   NULL,                  /* pointer to the base of state (offsets are relative to this) */
245   0,                     /* subtype this table refers to */
246   ARRAY_LENGTH(state_array),   /* number of entries */
247   state_array               /* array of entries */
248};
249
250
251
195252static UINT8 SZ[256];      /* zero and sign flags */
196253static UINT8 SZ_BIT[256];   /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
197254static UINT8 SZP[256];      /* zero, sign and parity flags */
r3957r3958
33943451   z80->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
33953452   z80->IX = z80->IY = 0xffff; /* IX and IY are FFFF after a reset! */
33963453   z80->F = ZF;         /* Zero flag is set */
3454
3455   /* set up the state table */
3456   z80->state = state_table_template;
3457   z80->state.baseptr = z80;
3458   z80->state.subtypemask = 1;
33973459}
33983460
33993461/****************************************************************************
r3957r3958
35103572
35113573
35123574/**************************************************************************
3575 * STATE IMPORT/EXPORT
3576 **************************************************************************/
3577
3578static CPU_IMPORT_STATE( z80 )
3579{
3580   z80_state *cpustate = device->token;
3581
3582   switch (entry->index)
3583   {
3584      case Z80_R:
3585         cpustate->r = cpustate->rtemp & 0x7f;
3586         cpustate->r2 = cpustate->rtemp & 0x80;
3587         break;
3588
3589      default:
3590         fatalerror("CPU_IMPORT_STATE(z80) called for unexpected value\n");
3591         break;
3592   }
3593}
3594
3595
3596static CPU_EXPORT_STATE( z80 )
3597{
3598   z80_state *cpustate = device->token;
3599
3600   switch (entry->index)
3601   {
3602      case Z80_R:
3603         cpustate->rtemp = (cpustate->r & 0x7f) | (cpustate->r2 & 0x80);
3604         break;
3605
3606      default:
3607         fatalerror("CPU_EXPORT_STATE(z80) called for unexpected value\n");
3608         break;
3609   }
3610}
3611
3612
3613/**************************************************************************
35133614 * Generic set_info
35143615 **************************************************************************/
35153616
r3957r3958
35203621   {
35213622      /* --- the following bits of info are set as 64-bit signed integers --- */
35223623      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:      set_irq_line(z80, INPUT_LINE_NMI, info->i); break;
3523      case CPUINFO_INT_INPUT_STATE + 0:               set_irq_line(z80, 0, info->i);         break;
3624      case CPUINFO_INT_INPUT_STATE + 0:               set_irq_line(z80, 0, info->i);      break;
35243625
3525      case CPUINFO_INT_PC:                        z80->PC = info->i;                   break;
3526      case CPUINFO_INT_REGISTER + Z80_PC:               z80->PC = info->i;                  break;
3527      case CPUINFO_INT_SP:                        z80->SP = info->i;                  break;
3528      case CPUINFO_INT_REGISTER + Z80_SP:               z80->SP = info->i;                  break;
3529      case CPUINFO_INT_REGISTER + Z80_A:               z80->A = info->i;                  break;
3530      case CPUINFO_INT_REGISTER + Z80_B:               z80->B = info->i;                  break;
3531      case CPUINFO_INT_REGISTER + Z80_C:               z80->C = info->i;                  break;
3532      case CPUINFO_INT_REGISTER + Z80_D:               z80->D = info->i;                  break;
3533      case CPUINFO_INT_REGISTER + Z80_E:               z80->E = info->i;                  break;
3534      case CPUINFO_INT_REGISTER + Z80_H:               z80->H = info->i;                  break;
3535      case CPUINFO_INT_REGISTER + Z80_L:               z80->L = info->i;                  break;
3536      case CPUINFO_INT_REGISTER + Z80_AF:               z80->AF = info->i;                  break;
3537      case CPUINFO_INT_REGISTER + Z80_BC:               z80->BC = info->i;                  break;
3538      case CPUINFO_INT_REGISTER + Z80_DE:               z80->DE = info->i;                  break;
3539      case CPUINFO_INT_REGISTER + Z80_HL:               z80->HL = info->i;                  break;
3540      case CPUINFO_INT_REGISTER + Z80_IX:               z80->IX = info->i;                  break;
3541      case CPUINFO_INT_REGISTER + Z80_IY:               z80->IY = info->i;                  break;
3542      case CPUINFO_INT_REGISTER + Z80_MEMPTR:            z80->MEMPTR = info->i;               break;
3543      case CPUINFO_INT_REGISTER + Z80_R:               z80->r = info->i; z80->r2 = info->i & 0x80; break;
3544      case CPUINFO_INT_REGISTER + Z80_I:               z80->i = info->i;                  break;
3545      case CPUINFO_INT_REGISTER + Z80_AF2:            z80->af2.w.l = info->i;               break;
3546      case CPUINFO_INT_REGISTER + Z80_BC2:            z80->bc2.w.l = info->i;               break;
3547      case CPUINFO_INT_REGISTER + Z80_DE2:            z80->de2.w.l = info->i;               break;
3548      case CPUINFO_INT_REGISTER + Z80_HL2:            z80->hl2.w.l = info->i;               break;
3549      case CPUINFO_INT_REGISTER + Z80_IM:               z80->im = info->i;                  break;
3550      case CPUINFO_INT_REGISTER + Z80_IFF1:            z80->iff1 = info->i;               break;
3551      case CPUINFO_INT_REGISTER + Z80_IFF2:            z80->iff2 = info->i;               break;
3552      case CPUINFO_INT_REGISTER + Z80_HALT:            z80->halt = info->i;               break;
3553
35543626      /* --- the following bits of info are set as pointers to data or functions --- */
3555      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_op:   cc[Z80_TABLE_op] = info->p;            break;
3556      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_cb:   cc[Z80_TABLE_cb] = info->p;            break;
3557      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ed:   cc[Z80_TABLE_ed] = info->p;            break;
3558      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xy:   cc[Z80_TABLE_xy] = info->p;            break;
3559      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xycb:   cc[Z80_TABLE_xycb] = info->p;         break;
3560      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ex:   cc[Z80_TABLE_ex] = info->p;            break;
3627      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_op:   cc[Z80_TABLE_op] = info->p;         break;
3628      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_cb:   cc[Z80_TABLE_cb] = info->p;         break;
3629      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ed:   cc[Z80_TABLE_ed] = info->p;         break;
3630      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xy:   cc[Z80_TABLE_xy] = info->p;         break;
3631      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_xycb:   cc[Z80_TABLE_xycb] = info->p;      break;
3632      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ex:   cc[Z80_TABLE_ex] = info->p;         break;
35613633   }
35623634}
35633635
r3957r3958
35733645   switch (state)
35743646   {
35753647      /* --- the following bits of info are returned as 64-bit signed integers --- */
3576      case CPUINFO_INT_CONTEXT_SIZE:            info->i = sizeof(z80_state);               break;
3577      case CPUINFO_INT_INPUT_LINES:            info->i = 1;                           break;
3578      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:      info->i = 0xff;                           break;
3579      case CPUINFO_INT_ENDIANNESS:            info->i = ENDIANNESS_LITTLE;                     break;
3580      case CPUINFO_INT_CLOCK_MULTIPLIER:         info->i = 1;                           break;
3581      case CPUINFO_INT_CLOCK_DIVIDER:            info->i = 1;                           break;
3582      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:      info->i = 1;                           break;
3583      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:      info->i = 4;                           break;
3584      case CPUINFO_INT_MIN_CYCLES:            info->i = 2;                           break;
3585      case CPUINFO_INT_MAX_CYCLES:            info->i = 16;                           break;
3648      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(z80_state);         break;
3649      case CPUINFO_INT_INPUT_LINES:               info->i = 1;                     break;
3650      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0xff;                     break;
3651      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;         break;
3652      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
3653      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
3654      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 1;                     break;
3655      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 4;                     break;
3656      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
3657      case CPUINFO_INT_MAX_CYCLES:               info->i = 16;                     break;
35863658
3587      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;                  break;
3588      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;                  break;
3589      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;                  break;
3590      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
3591      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
3592      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
3593      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;                  break;
3594      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;                  break;
3595      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;                  break;
3659      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:         info->i = 8;                     break;
3660      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:         info->i = 16;                     break;
3661      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:         info->i = 0;                     break;
3662      case CPUINFO_INT_DATABUS_WIDTH_IO:            info->i = 8;                     break;
3663      case CPUINFO_INT_ADDRBUS_WIDTH_IO:            info->i = 16;                     break;
3664      case CPUINFO_INT_ADDRBUS_SHIFT_IO:            info->i = 0;                     break;
35963665
3597      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = z80->nmi_state;               break;
3598      case CPUINFO_INT_INPUT_STATE + 0:         info->i = z80->irq_state;                  break;
3666      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = z80->nmi_state;            break;
3667      case CPUINFO_INT_INPUT_STATE + 0:            info->i = z80->irq_state;            break;
35993668
3600      case CPUINFO_INT_PREVIOUSPC:            info->i = z80->prvpc.w.l;                  break;
3669      /* --- the following bits of info are returned as pointers to functions --- */
3670      case CPUINFO_FCT_SET_INFO:      info->setinfo = CPU_SET_INFO_NAME(z80);               break;
3671      case CPUINFO_FCT_INIT:         info->init = CPU_INIT_NAME(z80);                  break;
3672      case CPUINFO_FCT_RESET:         info->reset = CPU_RESET_NAME(z80);                  break;
3673      case CPUINFO_FCT_EXIT:         info->exit = CPU_EXIT_NAME(z80);                  break;
3674      case CPUINFO_FCT_EXECUTE:      info->execute = CPU_EXECUTE_NAME(z80);               break;
3675      case CPUINFO_FCT_DISASSEMBLE:   info->disassemble = CPU_DISASSEMBLE_NAME(z80);         break;
3676      case CPUINFO_FCT_IMPORT_STATE:   info->import_state = CPU_IMPORT_STATE_NAME(z80);      break;
3677      case CPUINFO_FCT_EXPORT_STATE:   info->export_state = CPU_EXPORT_STATE_NAME(z80);      break;
36013678
3602      case CPUINFO_INT_PC:                  info->i = z80->PCD;                        break;
3603      case CPUINFO_INT_REGISTER + Z80_PC:         info->i = z80->PC;                        break;
3604      case CPUINFO_INT_SP:                  info->i = z80->SPD;                        break;
3605      case CPUINFO_INT_REGISTER + Z80_SP:         info->i = z80->SP;                        break;
3606      case CPUINFO_INT_REGISTER + Z80_A:         info->i = z80->A;                        break;
3607      case CPUINFO_INT_REGISTER + Z80_B:         info->i = z80->B;                        break;
3608      case CPUINFO_INT_REGISTER + Z80_C:         info->i = z80->C;                        break;
3609      case CPUINFO_INT_REGISTER + Z80_D:         info->i = z80->D;                        break;
3610      case CPUINFO_INT_REGISTER + Z80_E:         info->i = z80->E;                        break;
3611      case CPUINFO_INT_REGISTER + Z80_H:         info->i = z80->H;                        break;
3612      case CPUINFO_INT_REGISTER + Z80_L:         info->i = z80->L;                        break;
3613      case CPUINFO_INT_REGISTER + Z80_AF:         info->i = z80->AF;                        break;
3614      case CPUINFO_INT_REGISTER + Z80_BC:         info->i = z80->BC;                        break;
3615      case CPUINFO_INT_REGISTER + Z80_DE:         info->i = z80->DE;                        break;
3616      case CPUINFO_INT_REGISTER + Z80_HL:         info->i = z80->HL;                        break;
3617      case CPUINFO_INT_REGISTER + Z80_IX:         info->i = z80->IX;                        break;
3618      case CPUINFO_INT_REGISTER + Z80_IY:         info->i = z80->IY;                        break;
3619      case CPUINFO_INT_REGISTER + Z80_MEMPTR:      info->i = z80->MEMPTR;                     break;
3620      case CPUINFO_INT_REGISTER + Z80_R:         info->i = (z80->r & 0x7f) | (z80->r2 & 0x80);   break;
3621      case CPUINFO_INT_REGISTER + Z80_I:         info->i = z80->i;                        break;
3622      case CPUINFO_INT_REGISTER + Z80_AF2:      info->i = z80->af2.w.l;                     break;
3623      case CPUINFO_INT_REGISTER + Z80_BC2:      info->i = z80->bc2.w.l;                     break;
3624      case CPUINFO_INT_REGISTER + Z80_DE2:      info->i = z80->de2.w.l;                     break;
3625      case CPUINFO_INT_REGISTER + Z80_HL2:      info->i = z80->hl2.w.l;                     break;
3626      case CPUINFO_INT_REGISTER + Z80_IM:         info->i = z80->im;                        break;
3627      case CPUINFO_INT_REGISTER + Z80_IFF1:      info->i = z80->iff1;                     break;
3628      case CPUINFO_INT_REGISTER + Z80_IFF2:      info->i = z80->iff2;                     break;
3629      case CPUINFO_INT_REGISTER + Z80_HALT:      info->i = z80->halt;                     break;
3679      /* --- the following bits of info are returned as pointers --- */
3680      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &z80->icount;         break;
3681      case CPUINFO_PTR_STATE_TABLE:               info->state_table = &z80->state;      break;
36303682
3631      /* --- the following bits of info are returned as pointers to data or functions --- */
3632      case CPUINFO_PTR_SET_INFO:               info->setinfo = CPU_SET_INFO_NAME(z80);         break;
3633      case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(z80);            break;
3634      case CPUINFO_PTR_RESET:                  info->reset = CPU_RESET_NAME(z80);            break;
3635      case CPUINFO_PTR_EXIT:                  info->exit = CPU_EXIT_NAME(z80);            break;
3636      case CPUINFO_PTR_EXECUTE:               info->execute = CPU_EXECUTE_NAME(z80);         break;
3637      case CPUINFO_PTR_BURN:                  info->burn = NULL;                        break;
3638      case CPUINFO_PTR_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(z80);   break;
3639      case CPUINFO_PTR_INSTRUCTION_COUNTER:            info->icount = &z80->icount;         break;
36403683      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_op:   info->p = (void *)cc[Z80_TABLE_op];      break;
36413684      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_cb:   info->p = (void *)cc[Z80_TABLE_cb];      break;
36423685      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ed:   info->p = (void *)cc[Z80_TABLE_ed];      break;
r3957r3958
36453688      case CPUINFO_PTR_Z80_CYCLE_TABLE + Z80_TABLE_ex:   info->p = (void *)cc[Z80_TABLE_ex];      break;
36463689
36473690      /* --- the following bits of info are returned as NULL-terminated strings --- */
3648      case CPUINFO_STR_NAME:                  strcpy(info->s, "Z80");                     break;
3649      case CPUINFO_STR_CORE_FAMILY:            strcpy(info->s, "Zilog Z80");               break;
3650      case CPUINFO_STR_CORE_VERSION:            strcpy(info->s, "3.8");                     break;
3651      case CPUINFO_STR_CORE_FILE:               strcpy(info->s, __FILE__);                  break;
3652      case CPUINFO_STR_CORE_CREDITS:            strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
3691      case CPUINFO_STR_NAME:                     strcpy(info->s, "Z80");               break;
3692      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Zilog Z80");         break;
3693      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "3.8");               break;
3694      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
3695      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Juergen Buchmueller, all rights reserved."); break;
36533696
36543697      case CPUINFO_STR_FLAGS:
36553698         sprintf(info->s, "%c%c%c%c%c%c%c%c",
r3957r3958
36623705            z80->F & 0x02 ? 'N':'.',
36633706            z80->F & 0x01 ? 'C':'.');
36643707         break;
3665
3666      case CPUINFO_STR_REGISTER + Z80_PC:         sprintf(info->s, "PC:%04X", z80->PC);         break;
3667      case CPUINFO_STR_REGISTER + Z80_SP:         sprintf(info->s, "SP:%04X", z80->SP);         break;
3668      case CPUINFO_STR_REGISTER + Z80_A:         sprintf(info->s, "~A:%02X", z80->A);         break;
3669      case CPUINFO_STR_REGISTER + Z80_B:         sprintf(info->s, "~B:%02X", z80->B);         break;
3670      case CPUINFO_STR_REGISTER + Z80_C:         sprintf(info->s, "~C:%02X", z80->C);         break;
3671      case CPUINFO_STR_REGISTER + Z80_D:         sprintf(info->s, "~D:%02X", z80->D);         break;
3672      case CPUINFO_STR_REGISTER + Z80_E:         sprintf(info->s, "~E:%02X", z80->E);         break;
3673      case CPUINFO_STR_REGISTER + Z80_H:         sprintf(info->s, "~H:%02X", z80->H);         break;
3674      case CPUINFO_STR_REGISTER + Z80_L:         sprintf(info->s, "~L:%02X", z80->L);         break;
3675      case CPUINFO_STR_REGISTER + Z80_AF:         sprintf(info->s, "AF:%04X", z80->AF);         break;
3676      case CPUINFO_STR_REGISTER + Z80_BC:         sprintf(info->s, "BC:%04X", z80->BC);         break;
3677      case CPUINFO_STR_REGISTER + Z80_DE:         sprintf(info->s, "DE:%04X", z80->DE);         break;
3678      case CPUINFO_STR_REGISTER + Z80_HL:         sprintf(info->s, "HL:%04X", z80->HL);         break;
3679      case CPUINFO_STR_REGISTER + Z80_IX:         sprintf(info->s, "IX:%04X", z80->IX);         break;
3680      case CPUINFO_STR_REGISTER + Z80_IY:         sprintf(info->s, "IY:%04X", z80->IY);         break;
3681      case CPUINFO_STR_REGISTER + Z80_MEMPTR:      sprintf(info->s, "MEMPTR:%04X", z80->MEMPTR);    break;
3682      case CPUINFO_STR_REGISTER + Z80_R:         sprintf(info->s, "R:%02X", (z80->r & 0x7f) | (z80->r2 & 0x80)); break;
3683      case CPUINFO_STR_REGISTER + Z80_I:         sprintf(info->s, "I:%02X", z80->i);            break;
3684      case CPUINFO_STR_REGISTER + Z80_AF2:      sprintf(info->s, "AF2:%04X", z80->af2.w.l);      break;
3685      case CPUINFO_STR_REGISTER + Z80_BC2:      sprintf(info->s, "BC2:%04X", z80->bc2.w.l);      break;
3686      case CPUINFO_STR_REGISTER + Z80_DE2:      sprintf(info->s, "DE2:%04X", z80->de2.w.l);      break;
3687      case CPUINFO_STR_REGISTER + Z80_HL2:      sprintf(info->s, "HL2:%04X", z80->hl2.w.l);      break;
3688      case CPUINFO_STR_REGISTER + Z80_IM:         sprintf(info->s, "IM:%X", z80->im);            break;
3689      case CPUINFO_STR_REGISTER + Z80_IFF1:      sprintf(info->s, "IFF1:%X", z80->iff1);         break;
3690      case CPUINFO_STR_REGISTER + Z80_IFF2:      sprintf(info->s, "IFF2:%X", z80->iff2);         break;
3691      case CPUINFO_STR_REGISTER + Z80_HALT:      sprintf(info->s, "HALT:%X", z80->halt);         break;
36923708   }
36933709}
src/emu/cpu/z80/z80.h
r3957r3958
77
88enum
99{
10   Z80_PC=1, Z80_SP,
10   Z80_PC, Z80_SP,
1111   Z80_A, Z80_B, Z80_C, Z80_D, Z80_E, Z80_H, Z80_L,
1212   Z80_AF, Z80_BC, Z80_DE, Z80_HL,
1313   Z80_IX, Z80_IY,   Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2,
1414   Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT,
15   Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_MEMPTR
15   Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_MEMPTR,
16
17   Z80_GENPC = REG_GENPC,
18   Z80_GENSP = REG_GENSP,
19   Z80_GENPCBASE = REG_GENPCBASE
1620};
1721
1822enum
r3957r3958
3236};
3337
3438extern CPU_GET_INFO( z80 );
39#define CPU_Z80 CPU_GET_INFO_NAME( z80 )
3540
3641extern CPU_DISASSEMBLE( z80 );
3742
src/emu/cpu/z80/z80daisy.c
r3957r3958
66
77***************************************************************************/
88
9#include "cpuintrf.h"
10#include "mame.h"
9#include "driver.h"
1110#include "z80daisy.h"
1211
1312
src/emu/cpu/asap/asap.c
r3957r3958
17141714      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
17151715      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
17161716
1717      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1718      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1719      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1720      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1721      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1722      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1723      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1724      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1725      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1717      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1718      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1719      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1720      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1721      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1722      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1723      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1724      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1725      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
17261726
17271727      case CPUINFO_INT_INPUT_STATE + ASAP_IRQ0:      info->i = asap->irq_state;            break;
17281728
r3957r3958
17661766      case CPUINFO_INT_REGISTER + ASAP_R31:         info->i = asap->src2val[REGBASE + 31];   break;
17671767
17681768      /* --- the following bits of info are returned as pointers to data or functions --- */
1769      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(asap);      break;
1770      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(asap);            break;
1771      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(asap);            break;
1772      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(asap);            break;
1773      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(asap);         break;
1774      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1775      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(asap);   break;
1769      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(asap);      break;
1770      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(asap);            break;
1771      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(asap);            break;
1772      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(asap);            break;
1773      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(asap);         break;
1774      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1775      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(asap);   break;
17761776      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &asap->icount;               break;
17771777
17781778      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/asap/asap.h
r3957r3958
4040***************************************************************************/
4141
4242extern CPU_GET_INFO( asap );
43#define CPU_ASAP CPU_GET_INFO_NAME( asap )
4344
4445#endif /* __ASAP_H__ */
src/emu/cpu/tms9900/99xxcore.h
r3957r3958
46744674      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;/*TODO: compute this value*/break;
46754675
46764676#if (USE_16_BIT_ACCESSORS)
4677      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
4677      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
46784678#else
4679      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
4679      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
46804680#endif
4681      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:
4681      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:
46824682#if (TMS99XX_MODEL == TI990_10_ID)
46834683         /* this CPU has a mapper to expand the address space */
46844684         info->i = 21;
r3957r3958
46934693         info->i = 16;
46944694#endif
46954695         break;
4696      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
4697      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
4698      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4699      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
4700      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
4701      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:
4696      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
4697      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
4698      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
4699      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
4700      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
4701      case CPUINFO_INT_ADDRBUS_WIDTH_IO:
47024702#if (TMS99XX_MODEL == TI990_10_ID)
47034703         /* 3 MSBs do exist, although they are not connected (don't ask...) */
47044704         info->i = 15;
r3957r3958
47194719         info->i = 15;
47204720#endif
47214721         break;
4722      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
4722      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
47234723
47244724/* not implemented */
47254725/*      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:  info->i = get_irq_line(INPUT_LINE_NMI); break;
r3957r3958
47814781      case CPUINFO_INT_REGISTER + TMS9900_R15:      info->i = READREG_DEBUG(cpustate, R15);         break;
47824782
47834783      /* --- the following bits of info are returned as pointers to data or functions --- */
4784      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms99xx);      break;
4785      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms99xx);            break;
4786      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms99xx);         break;
4787      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms99xx);            break;
4788      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms99xx);      break;
4789      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
4790      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms99xx);      break;
4784      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms99xx);      break;
4785      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tms99xx);            break;
4786      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms99xx);         break;
4787      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(tms99xx);            break;
4788      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms99xx);      break;
4789      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
4790      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms99xx);      break;
47914791      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
47924792
47934793      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/tms9900/tms9900.h
r3957r3958
5555#if (HAS_TI990_10)
5656
5757extern CPU_GET_INFO( ti990_10 );
58#define CPU_TI990_10 CPU_GET_INFO_NAME( ti990_10 )
5859
5960/*
6061    structure with the parameters ti990_10_reset wants.
r3957r3958
8485#if (HAS_TMS9900)
8586
8687extern CPU_GET_INFO( tms9900 );
88#define CPU_TMS9900 CPU_GET_INFO_NAME( tms9900 )
8789
8890/*
8991    structure with optional parameters for tms9900_reset.
r3957r3958
98100#if (HAS_TMS9940)
99101
100102extern CPU_GET_INFO( tms9940 );
103#define CPU_TMS9940 CPU_GET_INFO_NAME( tms9940 )
101104
102105/*
103106    structure with optional parameters for tms9940_reset.
r3957r3958
112115#if (HAS_TMS9980)
113116
114117extern CPU_GET_INFO( tms9980a );
118#define CPU_TMS9980 CPU_GET_INFO_NAME( tms9980a )
115119
116120/*
117121    structure with optional parameters for tms9980a_reset.
r3957r3958
126130#if (HAS_TMS9985)
127131
128132extern CPU_GET_INFO( tms9985 );
133#define CPU_TMS9986 CPU_GET_INFO_NAME( tms9985 )
129134
130135/*
131136    structure with optional parameters for tms9985_reset.
r3957r3958
140145#if (HAS_TMS9989)
141146
142147extern CPU_GET_INFO( tms9989 );
148#define CPU_TMS9989 CPU_GET_INFO_NAME( tms9989 )
143149
144150/*
145151    structure with optional parameters for tms9989_reset.
r3957r3958
154160#if (HAS_TMS9995)
155161
156162extern CPU_GET_INFO( tms9995 );
163#define CPU_TMS9995 CPU_GET_INFO_NAME( tms9995 )
157164
158165/*
159166  structure with the parameters tms9995_reset wants.
r3957r3958
184191#if (HAS_TMS99000)
185192
186193extern CPU_GET_INFO( tms99000 );
194#define CPU_TMS99000 CPU_GET_INFO_NAME( tms99000 )
187195
188196/*
189197    structure with optional parameters for tms99000_reset.
r3957r3958
198206#if (HAS_TMS99105A)
199207
200208extern CPU_GET_INFO( tms99105a );
209#define CPU_TMS99105A CPU_GET_INFO_NAME( tms99105a )
201210
202211/*
203212    structure with optional parameters for tms99105a_reset.
r3957r3958
212221#if (HAS_TMS99110A)
213222
214223extern CPU_GET_INFO( tms99110a );
224#define CPU_TMS99110A CPU_GET_INFO_NAME( tms99110a )
215225
216226/*
217227    structure with optional parameters for tms99110a_reset.
src/emu/cpu/i960/i960.c
r3957r3958
21202120
21212121   switch(state) {
21222122      // Interface functions and variables
2123   case CPUINFO_PTR_SET_INFO:               info->setinfo     = CPU_SET_INFO_NAME(i960);   break;
2124   case CPUINFO_PTR_INIT:                  info->init        = CPU_INIT_NAME(i960);      break;
2125   case CPUINFO_PTR_RESET:                  info->reset       = CPU_RESET_NAME(i960);      break;
2126   case CPUINFO_PTR_EXIT:                  info->exit        = 0;                     break;
2127   case CPUINFO_PTR_EXECUTE:               info->execute     = CPU_EXECUTE_NAME(i960);      break;
2128   case CPUINFO_PTR_BURN:                  info->burn        = 0;                     break;
2129   case CPUINFO_PTR_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(i960);   break;
2123   case CPUINFO_FCT_SET_INFO:               info->setinfo     = CPU_SET_INFO_NAME(i960);   break;
2124   case CPUINFO_FCT_INIT:                  info->init        = CPU_INIT_NAME(i960);      break;
2125   case CPUINFO_FCT_RESET:                  info->reset       = CPU_RESET_NAME(i960);      break;
2126   case CPUINFO_FCT_EXIT:                  info->exit        = 0;                     break;
2127   case CPUINFO_FCT_EXECUTE:               info->execute     = CPU_EXECUTE_NAME(i960);      break;
2128   case CPUINFO_FCT_BURN:                  info->burn        = 0;                     break;
2129   case CPUINFO_FCT_DISASSEMBLE:            info->disassemble = CPU_DISASSEMBLE_NAME(i960);   break;
21302130   case CPUINFO_PTR_INSTRUCTION_COUNTER:      info->icount      = &i960->icount;            break;
21312131   case CPUINFO_INT_CONTEXT_SIZE:            info->i           = sizeof(i960_state_t);      break;
21322132   case CPUINFO_INT_MIN_INSTRUCTION_BYTES:      info->i           = 4;                     break;
21332133   case CPUINFO_INT_MAX_INSTRUCTION_BYTES:      info->i           = 8;                     break;
21342134
21352135      // Bus sizes
2136   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                  break;
2137   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                  break;
2138   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;                  break;
2139   case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 0;                  break;
2140   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
2141   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
2142   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
2143   case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                  break;
2144   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                  break;
2145   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                  break;
2146   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;                  break;
2147   case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                  break;
2136   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;                  break;
2137   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 32;                  break;
2138   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;                  break;
2139   case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM:   info->i = 0;                  break;
2140   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                  break;
2141   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 0;                  break;
2142   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;                  break;
2143   case CPUINFO_INT_LOGADDR_WIDTH_DATA:   info->i = 0;                  break;
2144   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                  break;
2145   case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 0;                  break;
2146   case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;                  break;
2147   case CPUINFO_INT_LOGADDR_WIDTH_IO:      info->i = 0;                  break;
21482148
21492149      // Internal maps
2150   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map32 = NULL;break;
2151   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map32 = NULL;break;
2152   case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map32 = NULL;break;
2150   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map32 = NULL;break;
2151   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map32 = NULL;break;
2152   case CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO:      info->internal_map32 = NULL;break;
21532153
21542154      // CPU misc parameters
21552155   case CPUINFO_STR_NAME:               strcpy(info->s, "i960KB");                     break;
src/emu/cpu/i960/i960.h
r3957r3958
6262};
6363
6464CPU_GET_INFO( i960 );
65#define CPU_I960 CPU_GET_INFO_NAME( i960 )
66
6567void i960_noburst(const device_config *device);
6668void i960_stall(const device_config *device);
6769
src/emu/cpu/v810/v810.c
r3957r3958
11541154      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
11551155      case CPUINFO_INT_MAX_CYCLES:               info->i = 1;                     break;
11561156
1157      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1158      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1159      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
1160      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1161      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1162      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1163      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 32;               break;
1164      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 32;               break;
1165      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1157      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1158      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1159      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
1160      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
1161      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
1162      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1163      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 32;               break;
1164      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 32;               break;
1165      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
11661166
11671167      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_line;         break;
11681168      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = cpustate->nmi_line;         break;
r3957r3958
12171217      case CPUINFO_INT_REGISTER + V810_ADTRE:         info->i = cpustate->ADTRE;            break;
12181218
12191219      /* --- the following bits of info are returned as pointers to data or functions --- */
1220      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(v810);      break;
1221      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(v810);            break;
1222      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(v810);            break;
1223      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                        break;
1224      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(v810);         break;
1225      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1226      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v810);   break;
1220      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(v810);      break;
1221      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(v810);            break;
1222      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(v810);            break;
1223      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                        break;
1224      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(v810);         break;
1225      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1226      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(v810);   break;
12271227      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
12281228
12291229      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/v810/v810.h
r3957r3958
55
66#include "cpuintrf.h"
77
8void v810_get_info(UINT32, cpuinfo*);
8CPU_GET_INFO( v810 );
9#define CPU_V810 CPU_GET_INFO_NAME( v810 )
910
1011CPU_DISASSEMBLE( v810 );
1112
src/emu/cpu/tms32025/tms32025.c
r3957r3958
23002300      case CPUINFO_INT_MIN_CYCLES:               info->i = 1*CLK;                  break;
23012301      case CPUINFO_INT_MAX_CYCLES:               info->i = 5*CLK;                  break;
23022302
2303      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
2304      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
2305      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
2306      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 16;               break;
2307      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 16;               break;
2308      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = -1;               break;
2309      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
2310      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 17;               break;
2311      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = -1;               break;
2303      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
2304      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
2305      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
2306      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 16;               break;
2307      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 16;               break;
2308      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = -1;               break;
2309      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 16;               break;
2310      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 17;               break;
2311      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = -1;               break;
23122312
23132313      case CPUINFO_INT_INPUT_STATE + TMS32025_INT0:      info->i = (cpustate->IFR & 0x01) ? ASSERT_LINE : CLEAR_LINE; break;
23142314      case CPUINFO_INT_INPUT_STATE + TMS32025_INT1:      info->i = (cpustate->IFR & 0x02) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
23542354      case CPUINFO_INT_REGISTER + TMS32025_GREG:      info->i = M_RDRAM(cpustate, 5);               break;
23552355
23562356      /* --- the following bits of info are returned as pointers to data or functions --- */
2357      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32025);   break;
2358      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tms32025);         break;
2359      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms32025);         break;
2360      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(tms32025);         break;
2361      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32025);      break;
2362      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
2363      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32025);   break;
2364      case CPUINFO_PTR_READ:                     info->read = CPU_READ_NAME(tms32025);            break;
2365      case CPUINFO_PTR_WRITE:                     info->write = CPU_WRITE_NAME(tms32025);         break;
2366      case CPUINFO_PTR_READOP:                  info->readop = CPU_READOP_NAME(tms32025);         break;
2357      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tms32025);   break;
2358      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tms32025);         break;
2359      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms32025);         break;
2360      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(tms32025);         break;
2361      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tms32025);      break;
2362      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
2363      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tms32025);   break;
2364      case CPUINFO_FCT_READ:                     info->read = CPU_READ_NAME(tms32025);            break;
2365      case CPUINFO_FCT_WRITE:                     info->write = CPU_WRITE_NAME(tms32025);         break;
2366      case CPUINFO_FCT_READOP:                  info->readop = CPU_READOP_NAME(tms32025);         break;
23672367      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
23682368
23692369      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
24412441   switch (state)
24422442   {
24432443      /* --- the following bits of info are returned as pointers to data or functions --- */
2444      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tms32026);   break;
2444      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tms32026);   break;
24452445
24462446      /* --- the following bits of info are returned as NULL-terminated strings --- */
24472447      case CPUINFO_STR_NAME:                     strcpy(info->s, "TMS32026");         break;
src/emu/cpu/tms32025/tms32025.h
r3957r3958
7373extern CPU_GET_INFO( tms32025 );
7474extern CPU_GET_INFO( tms32026 );
7575
76#define CPU_TMS32025 CPU_GET_INFO_NAME( tms32025 )
77#define CPU_TMS32026 CPU_GET_INFO_NAME( tms32026 )
7678
7779CPU_DISASSEMBLE( tms32025 );
7880
src/emu/cpu/pic16c5x/pic16c5x.c
r3957r3958
126126
127127
128128
129/****************************************************************************
130 *  Read the state of the T0 Clock input signal
131 */
129132
133#define PIC16C5x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
134
135
136/****************************************************************************
137 *  Input a word from given I/O port
138 */
139
140#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
141
142
143/****************************************************************************
144 *  Output a word to given I/O port
145 */
146
147#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
148
149
150
151/****************************************************************************
152 *  Read a word from given RAM memory location
153 */
154
155#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
156
157
158/****************************************************************************
159 *  Write a word to given RAM memory location
160 */
161
162#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
163
164
165
166/****************************************************************************
167 *  PIC16C5X_RDOP() is identical to PIC16C5X_RDMEM() except it is used for
168 *  reading opcodes. In case of system with memory mapped I/O, this function
169 *  can be used to greatly speed up emulation
170 */
171
172#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
173
174
175/****************************************************************************
176 *  PIC16C5X_RDOP_ARG() is identical to PIC16C5X_RDOP() except it is used
177 *  for reading opcode arguments. This difference can be used to support systems
178 *  that use different encoding mechanisms for opcodes and opcode arguments
179 */
180
181#define PIC16C5x_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))
182
183
130184#define TMR0   internalram[1]
131185#define PCL      internalram[2]
132186#define STATUS   internalram[3]
r3957r3958
682736 *  Inits CPU emulation
683737 ****************************************************************************/
684738
685static CPU_INIT( pic16C5x )
739static CPU_INIT( pic16c5x )
686740{
687741   pic16c5x_state *cpustate = device->token;
688742
r3957r3958
730784 *  Reset registers to their initial values
731785 ****************************************************************************/
732786
733static void pic16C5x_reset_regs(pic16c5x_state *cpustate)
787static void pic16c5x_reset_regs(pic16c5x_state *cpustate)
734788{
735789   cpustate->PC     = cpustate->reset_vector;
736790   cpustate->CONFIG = cpustate->temp_config;
r3957r3958
747801   cpustate->inst_cycles = 0;
748802}
749803
750static void pic16C5x_soft_reset(pic16c5x_state *cpustate)
804static void pic16c5x_soft_reset(pic16c5x_state *cpustate)
751805{
752806   cpustate->STATUS &= 0x1f;
753   pic16C5x_reset_regs(cpustate);
807   pic16c5x_reset_regs(cpustate);
754808}
755809
756810void pic16c5x_set_config(const device_config *cpu, int data)
r3957r3958
766820 *  Shut down CPU emulation
767821 ****************************************************************************/
768822
769static CPU_EXIT( pic16C5x )
823static CPU_EXIT( pic16c5x )
770824{
771825   /* nothing to do */
772826}
r3957r3958
776830 *  WatchDog
777831 ****************************************************************************/
778832
779static void pic16C5x_update_watchdog(pic16c5x_state *cpustate, int counts)
833static void pic16c5x_update_watchdog(pic16c5x_state *cpustate, int counts)
780834{
781835   /* WatchDog is set up to count 18,000 (0x464f hex) ticks to provide */
782836   /* the timeout period of 0.018ms based on a 4MHz input clock. */
r3957r3958
802856            if (cpustate->prescaler >= (1 << PS)) {   /* Prescale values from 1 to 128 */
803857               cpustate->prescaler = 0;
804858               CLR(cpustate, TO_FLAG);
805               pic16C5x_soft_reset(cpustate);
859               pic16c5x_soft_reset(cpustate);
806860            }
807861         }
808862         else {
809863            CLR(cpustate, TO_FLAG);
810            pic16C5x_soft_reset(cpustate);
864            pic16c5x_soft_reset(cpustate);
811865         }
812866      }
813867   }
r3957r3958
818872 *  Update Timer
819873 ****************************************************************************/
820874
821static void pic16C5x_update_timer(pic16c5x_state *cpustate, int counts)
875static void pic16c5x_update_timer(pic16c5x_state *cpustate, int counts)
822876{
823877   if (PSA == 0) {
824878      cpustate->prescaler += counts;
r3957r3958
837891 *  Execute IPeriod. Return 0 if emulation should be stopped
838892 ****************************************************************************/
839893
840static CPU_EXECUTE( pic16C5x )
894static CPU_EXECUTE( pic16c5x )
841895{
842896   pic16c5x_state *cpustate = device->token;
843897   int T0_in;
r3957r3958
850904         cpustate->inst_cycles = 1;
851905         debugger_instruction_hook(device, cpustate->PC);
852906         if (WDTE) {
853            pic16C5x_update_watchdog(cpustate, 1);
907            pic16c5x_update_watchdog(cpustate, 1);
854908         }
855909      }
856910      else
r3957r3958
876930            T0_in = S_T0_IN;
877931            if (T0SE) {               /* Count rising edge */
878932               if (POSITIVE_EDGE_T0) {
879                  pic16C5x_update_timer(cpustate, 1);
933                  pic16c5x_update_timer(cpustate, 1);
880934               }
881935            }
882936            else {                  /* Count falling edge */
883937               if (NEGATIVE_EDGE_T0) {
884                  pic16C5x_update_timer(cpustate, 1);
938                  pic16c5x_update_timer(cpustate, 1);
885939               }
886940            }
887941            cpustate->old_T0 = T0_in;
r3957r3958
891945               cpustate->delay_timer--;
892946            }
893947            else {
894               pic16C5x_update_timer(cpustate, cpustate->inst_cycles);
948               pic16c5x_update_timer(cpustate, cpustate->inst_cycles);
895949            }
896950         }
897951         if (WDTE) {
898            pic16C5x_update_watchdog(cpustate, cpustate->inst_cycles);
952            pic16c5x_update_watchdog(cpustate, cpustate->inst_cycles);
899953         }
900954      }
901955
r3957r3958
912966 *  Generic set_info
913967 **************************************************************************/
914968
915static CPU_SET_INFO( pic16C5x )
969static CPU_SET_INFO( pic16c5x )
916970{
917971   pic16c5x_state *cpustate = device->token;
918972
r3957r3958
9461000 *  Generic get_info
9471001 **************************************************************************/
9481002
949static CPU_GET_INFO( pic16C5x )
1003static CPU_GET_INFO( pic16c5x )
9501004{
9511005   pic16c5x_state *cpustate = (device != NULL) ? device->token : NULL;
9521006
r3957r3958
9641018      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
9651019      case CPUINFO_INT_MAX_CYCLES:               info->i = 10;                     break;
9661020
967      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
968      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 9;               break;
969      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;               break;
970      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
971      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 5;               break;
972      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
973      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
974      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 5;               break;
975      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1021      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
1022      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 9;               break;
1023      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;               break;
1024      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
1025      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 5;               break;
1026      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1027      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1028      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 5;               break;
1029      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
9761030
9771031      case CPUINFO_INT_PREVIOUSPC:               info->i = cpustate->PREVPC;                  break;
9781032
r3957r3958
9951049      case CPUINFO_INT_REGISTER + PIC16C5x_FSR:       info->i = (cpustate->FSR & cpustate->picRAMmask);   break;
9961050
9971051      /* --- the following bits of info are returned as pointers to data or functions --- */
998      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(pic16C5x);   break;
999      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(pic16C5x);         break;
1000      case CPUINFO_PTR_RESET:                     /* set per-CPU */                        break;
1001      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(pic16C5x);         break;
1002      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(pic16C5x);      break;
1003      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1004      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pic16C5x);      break;
1052      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(pic16c5x);   break;
1053      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(pic16c5x);         break;
1054      case CPUINFO_FCT_RESET:                     /* set per-CPU */                        break;
1055      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(pic16c5x);         break;
1056      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(pic16c5x);      break;
1057      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1058      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pic16c5x);      break;
10051059      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
10061060
10071061      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
10661120 *  PIC16C54 Reset
10671121 ****************************************************************************/
10681122
1069static CPU_RESET( pic16C54 )
1123static CPU_RESET( pic16c54 )
10701124{
10711125   pic16c5x_state *cpustate = device->token;
10721126
10731127   cpustate->picmodel = 0x16C54;
10741128   cpustate->picRAMmask = 0x1f;
10751129   cpustate->reset_vector = 0x1ff;
1076   pic16C5x_reset_regs(cpustate);
1130   pic16c5x_reset_regs(cpustate);
10771131   cpustate->STATUS = 0x00;
10781132   SET(cpustate, TO_FLAG);
10791133   SET(cpustate, PD_FLAG);
r3957r3958
10841138 *  CPU-specific get_info
10851139 **************************************************************************/
10861140
1087CPU_GET_INFO( pic16C54 )
1141CPU_GET_INFO( pic16c54 )
10881142{
10891143   switch (state)
10901144   {
10911145      /* --- the following bits of info are returned as pointers to data or functions --- */
1092      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pic16C54);         break;
1093      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c54_rom); break;
1094      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c54_ram); break;
1146      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c54);         break;
1147      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c54_rom); break;
1148      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c54_ram); break;
10951149
10961150      /* --- the following bits of info are returned as NULL-terminated strings --- */
10971151      case CPUINFO_STR_NAME:                     strcpy(info->s, "PIC16C54");         break;
10981152
1099      default:                              CPU_GET_INFO_CALL(pic16C5x);         break;
1153      default:                              CPU_GET_INFO_CALL(pic16c5x);         break;
11001154   }
11011155}
11021156#endif
r3957r3958
11201174 *  PIC16C55 Reset
11211175 ****************************************************************************/
11221176
1123static CPU_RESET( pic16C55 )
1177static CPU_RESET( pic16c55 )
11241178{
11251179   pic16c5x_state *cpustate = device->token;
11261180
11271181   cpustate->picmodel = 0x16C55;
11281182   cpustate->picRAMmask = 0x1f;
11291183   cpustate->reset_vector = 0x1ff;
1130   pic16C5x_reset_regs(cpustate);
1184   pic16c5x_reset_regs(cpustate);
11311185   cpustate->STATUS = 0x00;
11321186   SET(cpustate, TO_FLAG);
11331187   SET(cpustate, PD_FLAG);
r3957r3958
11381192 *  CPU-specific get_info
11391193 **************************************************************************/
11401194
1141CPU_GET_INFO( pic16C55 )
1195CPU_GET_INFO( pic16c55 )
11421196{
11431197   switch (state)
11441198   {
11451199      /* --- the following bits of info are returned as pointers to data or functions --- */
1146      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pic16C55);         break;
1147      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c55_rom); break;
1148      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c55_ram); break;
1200      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c55);         break;
1201      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c55_rom); break;
1202      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c55_ram); break;
11491203
11501204      /* --- the following bits of info are returned as NULL-terminated strings --- */
11511205      case CPUINFO_STR_NAME:                     strcpy(info->s, "PIC16C55");         break;
11521206
1153      default:                              CPU_GET_INFO_CALL(pic16C5x);         break;
1207      default:                              CPU_GET_INFO_CALL(pic16c5x);         break;
11541208   }
11551209}
11561210#endif
r3957r3958
11741228 *  PIC16C56 Reset
11751229 ****************************************************************************/
11761230
1177static CPU_RESET( pic16C56 )
1231static CPU_RESET( pic16c56 )
11781232{
11791233   pic16c5x_state *cpustate = device->token;
11801234
11811235   cpustate->picmodel = 0x16C56;
11821236   cpustate->picRAMmask = 0x1f;
11831237   cpustate->reset_vector = 0x3ff;
1184   pic16C5x_reset_regs(cpustate);
1238   pic16c5x_reset_regs(cpustate);
11851239   cpustate->STATUS = 0x00;
11861240   SET(cpustate, TO_FLAG);
11871241   SET(cpustate, PD_FLAG);
r3957r3958
11921246 *  CPU-specific get_info
11931247 **************************************************************************/
11941248
1195CPU_GET_INFO( pic16C56 )
1249CPU_GET_INFO( pic16c56 )
11961250{
11971251   switch (state)
11981252   {
11991253      /* --- the following bits of info are returned as pointers to data or functions --- */
1200      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pic16C56);         break;
1201      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c56_rom); break;
1202      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c56_ram); break;
1254      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c56);         break;
1255      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c56_rom); break;
1256      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c56_ram); break;
12031257
1204      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 10;               break;
1258      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 10;               break;
12051259
12061260      /* --- the following bits of info are returned as NULL-terminated strings --- */
12071261      case CPUINFO_STR_NAME:                     strcpy(info->s, "PIC16C56");         break;
12081262
1209      default:                              CPU_GET_INFO_CALL(pic16C5x);         break;
1263      default:                              CPU_GET_INFO_CALL(pic16c5x);         break;
12101264   }
12111265}
12121266#endif
r3957r3958
12331287 *  PIC16C57 Reset
12341288 ****************************************************************************/
12351289
1236static CPU_RESET( pic16C57 )
1290static CPU_RESET( pic16c57 )
12371291{
12381292   pic16c5x_state *cpustate = device->token;
12391293
12401294   cpustate->picmodel = 0x16C57;
12411295   cpustate->picRAMmask = 0x7f;
12421296   cpustate->reset_vector = 0x7ff;
1243   pic16C5x_reset_regs(cpustate);
1297   pic16c5x_reset_regs(cpustate);
12441298   cpustate->STATUS = 0x00;
12451299   SET(cpustate, TO_FLAG);
12461300   SET(cpustate, PD_FLAG);
r3957r3958
12511305 *  CPU-specific get_info
12521306 **************************************************************************/
12531307
1254CPU_GET_INFO( pic16C57 )
1308CPU_GET_INFO( pic16c57 )
12551309{
12561310   switch (state)
12571311   {
12581312      /* --- the following bits of info are returned as pointers to data or functions --- */
1259      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pic16C57);         break;
1260      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c57_rom); break;
1261      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c57_ram); break;
1313      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c57);         break;
1314      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c57_rom); break;
1315      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c57_ram); break;
12621316
1263      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 11;               break;
1264      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
1317      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
1318      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
12651319
12661320      /* --- the following bits of info are returned as NULL-terminated strings --- */
12671321      case CPUINFO_STR_NAME:                     strcpy(info->s, "PIC16C57");         break;
12681322
1269      default:                              CPU_GET_INFO_CALL(pic16C5x);         break;
1323      default:                              CPU_GET_INFO_CALL(pic16c5x);         break;
12701324   }
12711325}
12721326#endif
r3957r3958
12931347 *  PIC16C58 Reset
12941348 ****************************************************************************/
12951349
1296static CPU_RESET( pic16C58 )
1350static CPU_RESET( pic16c58 )
12971351{
12981352   pic16c5x_state *cpustate = device->token;
12991353
13001354   cpustate->picmodel = 0x16C58;
13011355   cpustate->picRAMmask = 0x7f;
13021356   cpustate->reset_vector = 0x7ff;
1303   pic16C5x_reset_regs(cpustate);
1357   pic16c5x_reset_regs(cpustate);
13041358   cpustate->STATUS = 0x00;
13051359   SET(cpustate, TO_FLAG);
13061360   SET(cpustate, PD_FLAG);
r3957r3958
13111365 *  CPU-specific get_info
13121366 **************************************************************************/
13131367
1314CPU_GET_INFO( pic16C58 )
1368CPU_GET_INFO( pic16c58 )
13151369{
13161370   switch (state)
13171371   {
13181372      /* --- the following bits of info are returned as pointers to data or functions --- */
1319      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pic16C58);         break;
1320      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c58_rom); break;
1321      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c58_ram); break;
1373      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pic16c58);         break;
1374      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map16 = ADDRESS_MAP_NAME(pic16c58_rom); break;
1375      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:      info->internal_map8 = ADDRESS_MAP_NAME(pic16c58_ram); break;
13221376
1323      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 11;               break;
1324      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 7;               break;
1377      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 11;               break;
1378      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 7;               break;
13251379
13261380      /* --- the following bits of info are returned as NULL-terminated strings --- */
13271381      case CPUINFO_STR_NAME:                     strcpy(info->s, "PIC16C58");         break;
13281382
1329      default:                              CPU_GET_INFO_CALL(pic16C5x);         break;
1383      default:                              CPU_GET_INFO_CALL(pic16c5x);         break;
13301384   }
13311385}
13321386#endif
src/emu/cpu/pic16c5x/pic16c5x.h
r3957r3958
3535   PIC16C5x_PSCL
3636};
3737
38#define PIC16C5x_T0      0x10
3839
40
3941/****************************************************************************
4042 *  Function to configure the CONFIG register. This is actually hard-wired
4143 *  during ROM programming, so should be called in the driver INIT, with
r3957r3958
4547void pic16c5x_set_config(const device_config *cpu, int data);
4648
4749
48/****************************************************************************
49 *  Read the state of the T0 Clock input signal
50 */
5150
52#define PIC16C5x_T0      0x10
53#define PIC16C5x_T0_In (memory_read_byte_8le(cpustate->io, PIC16C5x_T0))
54
55
56/****************************************************************************
57 *  Input a word from given I/O port
58 */
59
60#define PIC16C5x_In(Port) ((UINT8)memory_read_byte_8le(cpustate->io, (Port)))
61
62
63/****************************************************************************
64 *  Output a word to given I/O port
65 */
66
67#define PIC16C5x_Out(Port,Value) (memory_write_byte_8le(cpustate->io, (Port),Value))
68
69
70
71/****************************************************************************
72 *  Read a word from given RAM memory location
73 */
74
75#define PIC16C5x_RAM_RDMEM(A) ((UINT8)memory_read_byte_8le(cpustate->data, A))
76
77
78/****************************************************************************
79 *  Write a word to given RAM memory location
80 */
81
82#define PIC16C5x_RAM_WRMEM(A,V) (memory_write_byte_8le(cpustate->data, A,V))
83
84
85
86/****************************************************************************
87 *  PIC16C5X_RDOP() is identical to PIC16C5X_RDMEM() except it is used for
88 *  reading opcodes. In case of system with memory mapped I/O, this function
89 *  can be used to greatly speed up emulation
90 */
91
92#define PIC16C5x_RDOP(A) (memory_decrypted_read_word(cpustate->program, (A)<<1))
93
94
95/****************************************************************************
96 *  PIC16C5X_RDOP_ARG() is identical to PIC16C5X_RDOP() except it is used
97 *  for reading opcode arguments. This difference can be used to support systems
98 *  that use different encoding mechanisms for opcodes and opcode arguments
99 */
100
101#define PIC16C5x_RDOP_ARG(A) (memory_raw_read_word(cpustate->program, (A)<<1))
102
103
104
105
10651#if (HAS_PIC16C54)
107CPU_GET_INFO( pic16C54 );
52CPU_GET_INFO( pic16c54 );
53#define CPU_PIC16C54 CPU_GET_INFO_NAME( pic16c54 )
10854#endif
10955
11056
11157#if (HAS_PIC16C55)
112CPU_GET_INFO( pic16C55 );
58CPU_GET_INFO( pic16c55 );
59#define CPU_PIC16C55 CPU_GET_INFO_NAME( pic16c55 )
11360#endif
11461
11562
11663#if (HAS_PIC16C56)
117CPU_GET_INFO( pic16C56 );
64CPU_GET_INFO( pic16c56 );
65#define CPU_PIC16C56 CPU_GET_INFO_NAME( pic16c56 )
11866#endif
11967
12068
12169#if (HAS_PIC16C57)
122CPU_GET_INFO( pic16C57 );
70CPU_GET_INFO( pic16c57 );
71#define CPU_PIC16C57 CPU_GET_INFO_NAME( pic16c57 )
12372#endif
12473
12574
12675#if (HAS_PIC16C58)
127CPU_GET_INFO( pic16C58 );
76CPU_GET_INFO( pic16c58 );
77#define CPU_PIC16C58 CPU_GET_INFO_NAME( pic16c58 )
12878#endif
12979
13080
13181#if (HAS_PIC16C54) || (HAS_PIC16C55) || (HAS_PIC16C56) || (HAS_PIC16C57) || (HAS_PIC16C58)
132CPU_DISASSEMBLE( pic16C5x );
82CPU_DISASSEMBLE( pic16c5x );
13383#endif
13484
13585
src/emu/cpu/pic16c5x/16c5xdsm.c
r3957r3958
151151   OpInizialized = 1;
152152}
153153
154CPU_DISASSEMBLE( pic16C5x )
154CPU_DISASSEMBLE( pic16c5x )
155155{
156156   int a, b, d, f, k;   /* these can all be filled in by parsing an instruction */
157157   int i;
src/emu/cpu/pdp1/tx0.h
r3957r3958
4747CPU_GET_INFO( tx0_64kw );
4848CPU_GET_INFO( tx0_8kw );
4949
50#define CPU_TX0_64KW CPU_GET_INFO_NAME( tx0_64kw )
51#define CPU_TX0_8KW CPU_GET_INFO_NAME( tx0_8kw )
52
5053CPU_DISASSEMBLE( tx0_64kw );
5154CPU_DISASSEMBLE( tx0_8kw );
5255
src/emu/cpu/pdp1/pdp1.c
r3957r3958
943943   case CPUINFO_INT_MIN_CYCLES:               info->i = 5;   /* 5us cycle time */   break;
944944   case CPUINFO_INT_MAX_CYCLES:               info->i = 31;   /* we emulate individual 5us cycle, but MUL/DIV have longer timings */   break;
945945
946   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
947   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 18;   /*16+2 ignored bits to make double word address*/   break;
948   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
949   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
950   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
951   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
952   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
953   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
954   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
946   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
947   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 18;   /*16+2 ignored bits to make double word address*/   break;
948   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
949   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
950   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
951   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
952   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
953   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
954   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
955955
956956   case CPUINFO_INT_SP:                     info->i = 0;   /* no SP */            break;
957957   case CPUINFO_INT_PC:                     info->i = PC;                     break;
r3957r3958
10121012   case CPUINFO_INT_REGISTER + PDP1_IOS:         info->i = cpustate->ios;                  break;
10131013
10141014   /* --- the following bits of info are returned as pointers to data or functions --- */
1015   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(pdp1);         break;
1016   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(pdp1);               break;
1017   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(pdp1);            break;
1018   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(pdp1);         break;
1019   case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1015   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(pdp1);         break;
1016   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(pdp1);               break;
1017   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(pdp1);            break;
1018   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(pdp1);         break;
1019   case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
10201020
1021   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pdp1);         break;
1021   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(pdp1);         break;
10221022   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
10231023
10241024   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/pdp1/pdp1.h
r3957r3958
5050
5151/* PUBLIC FUNCTIONS */
5252CPU_GET_INFO( pdp1 );
53#define CPU_PDP1 CPU_GET_INFO_NAME( pdp1 )
5354
5455#define AND 001
5556#define IOR 002
src/emu/cpu/pdp1/tx0.c
r3957r3958
118118      ;
119119}
120120
121static void tx0_init_common(int is_64kw, const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
121static void tx0_init_common(int is_64kw, const device_config *device, cpu_irq_callback irqcallback)
122122{
123123   tx0_state *cpustate = device->token;
124124
r3957r3958
134134
135135static CPU_INIT( tx0_64kw )
136136{
137   tx0_init_common(1, device, index, clock, irqcallback);
137   tx0_init_common(1, device, irqcallback);
138138}
139139
140140static CPU_INIT( tx0_8kw)
141141{
142   tx0_init_common(0, device, index, clock, irqcallback);
142   tx0_init_common(0, device, irqcallback);
143143}
144144
145145static CPU_RESET( tx0 )
r3957r3958
442442   case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                           break;
443443   case CPUINFO_INT_MAX_CYCLES:               info->i = 3;                           break;
444444
445   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;                     break;
446   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;                     break;
447   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;                     break;
448   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;                     break;
449   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;                     break;
450   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                     break;
451   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                     break;
452   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;                     break;
453   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;                     break;
445   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;                     break;
446   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;                     break;
447   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -2;                     break;
448   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;                     break;
449   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;                     break;
450   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                     break;
451   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                     break;
452   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;                     break;
453   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;                     break;
454454
455455   case CPUINFO_INT_SP:                     info->i = 0;   /* no SP */                  break;
456456   case CPUINFO_INT_PC:                     info->i = PC;                           break;
r3957r3958
494494   case CPUINFO_INT_REGISTER + TX0_IOS:         info->i = cpustate->ios;                  break;
495495
496496   /* --- the following bits of info are returned as pointers to data or functions --- */
497   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tx0);         break;
498   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tx0_64kw);         break;
499   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tx0);            break;
500   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tx0_64kw);      break;
501   case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
502   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tx0_64kw);      break;
497   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tx0);         break;
498   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tx0_64kw);         break;
499   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tx0);            break;
500   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tx0_64kw);      break;
501   case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
502   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tx0_64kw);      break;
503503   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;                  break;
504504
505505   /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
568568   case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
569569   case CPUINFO_INT_MAX_CYCLES:               info->i = 3;                     break;
570570
571   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
572   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 13;               break;
573   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;               break;
574   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
575   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
576   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
577   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
578   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
579   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
571   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
572   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 13;               break;
573   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -2;               break;
574   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
575   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
576   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
577   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
578   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
579   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
580580
581581   case CPUINFO_INT_SP:                     info->i = 0;   /* no SP */            break;
582582   case CPUINFO_INT_PC:                     info->i = PC;                     break;
r3957r3958
620620   case CPUINFO_INT_REGISTER + TX0_IOS:         info->i = cpustate->ios;                  break;
621621
622622   /* --- the following bits of info are returned as pointers to data or functions --- */
623   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tx0);         break;
624   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(tx0_8kw);   break;
625   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(tx0);      break;
626   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tx0_8kw);   break;
627   case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
628   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tx0_8kw);      break;
623   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(tx0);         break;
624   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(tx0_8kw);   break;
625   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(tx0);      break;
626   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(tx0_8kw);   break;
627   case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
628   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(tx0_8kw);      break;
629629   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
630630
631631   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/mb86233/mb86233.c
r3957r3958
9797{
9898   mb86233_state *cpustate = device->token;
9999   mb86233_cpu_core * _config = (mb86233_cpu_core *)device->static_config;
100   (void)index;
101   (void)clock;
102100   (void)irqcallback;
103101
104102   memset(cpustate, 0, sizeof( *cpustate ) );
r3957r3958
16461644      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
16471645      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
16481646
1649      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
1650      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
1651      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -2;               break;
1652      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 32;               break;
1653      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 32;               break;
1654      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
1655      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
1656      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
1657      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
1647      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 32;               break;
1648      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;               break;
1649      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -2;               break;
1650      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 32;               break;
1651      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 32;               break;
1652      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
1653      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
1654      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
1655      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
16581656
16591657      case CPUINFO_INT_PREVIOUSPC:               /* not implemented */               break;
16601658
r3957r3958
16881686      case CPUINFO_INT_REGISTER + MB86233_R15:      info->i = GETGPR(15);               break;
16891687
16901688      /* --- the following bits of info are returned as pointers to data or functions --- */
1691      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mb86233);      break;
1692      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(mb86233);            break;
1693      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(mb86233);         break;
1694      case CPUINFO_PTR_EXIT:                     info->exit = NULL;                  break;
1695      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mb86233);      break;
1696      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1697      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mb86233);      break;
1689      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(mb86233);      break;
1690      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(mb86233);            break;
1691      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(mb86233);         break;
1692      case CPUINFO_FCT_EXIT:                     info->exit = NULL;                  break;
1693      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(mb86233);      break;
1694      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
1695      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(mb86233);      break;
16981696      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
16991697
17001698      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/mb86233/mb86233.h
r3957r3958
5555};
5656
5757extern CPU_GET_INFO( mb86233 );
58#define CPU_MB86233 CPU_GET_INFO_NAME( mb86233 )
5859
5960#endif /* __MB86233_H__ */
src/emu/cpu/t11/t11.c
r3957r3958
5757#define PSW    psw.b.l
5858
5959
60
6160/*************************************
6261 *
6362 *  Low-level memory operations
r3957r3958
7473
7574INLINE int RBYTE(t11_state *cpustate, int addr)
7675{
77   return T11_RDMEM(cpustate, addr);
76   return memory_read_byte_16le(cpustate->program, addr);
7877}
7978
8079
8180INLINE void WBYTE(t11_state *cpustate, int addr, int data)
8281{
83   T11_WRMEM(cpustate, addr, data);
82   memory_write_byte_16le(cpustate->program, addr, data);
8483}
8584
8685
8786INLINE int RWORD(t11_state *cpustate, int addr)
8887{
89   return T11_RDMEM_WORD(cpustate, addr & 0xfffe);
88   return memory_read_word_16le(cpustate->program, addr & 0xfffe);
9089}
9190
9291
9392INLINE void WWORD(t11_state *cpustate, int addr, int data)
9493{
95   T11_WRMEM_WORD(cpustate, addr & 0xfffe, data);
94   memory_write_word_16le(cpustate->program, addr & 0xfffe, data);
9695}
9796
9897
r3957r3958
419418      case CPUINFO_INT_MIN_CYCLES:               info->i = 12;                     break;
420419      case CPUINFO_INT_MAX_CYCLES:               info->i = 110;                     break;
421420
422      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
423      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
424      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
425      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
426      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
427      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
428      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
429      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
430      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
421      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;               break;
422      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
423      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
424      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
425      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
426      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
427      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
428      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
429      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
431430
432431      case CPUINFO_INT_INPUT_STATE + T11_IRQ0:      info->i = (cpustate->irq_state & 1) ? ASSERT_LINE : CLEAR_LINE; break;
433432      case CPUINFO_INT_INPUT_STATE + T11_IRQ1:      info->i = (cpustate->irq_state & 2) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
449448      case CPUINFO_INT_REGISTER + T11_R5:            info->i = cpustate->REGD(5);         break;
450449
451450      /* --- the following bits of info are returned as pointers to data or functions --- */
452      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(t11);         break;
453      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(t11);            break;
454      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(t11);            break;
455      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(t11);         break;
456      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(t11);   break;
451      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(t11);         break;
452      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(t11);            break;
453      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(t11);            break;
454      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(t11);         break;
455      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(t11);   break;
457456      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
458457
459458      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/t11/t11.h
r3957r3958
3434
3535
3636extern CPU_GET_INFO( t11 );
37#define CPU_T11 CPU_GET_INFO_NAME( t11 )
3738
38/****************************************************************************/
39/* Read a byte from given memory location                                   */
40/****************************************************************************/
41#define T11_RDMEM(T,A) ((unsigned)memory_read_byte_16le((T)->program, A))
42#define T11_RDMEM_WORD(T,A) ((unsigned)memory_read_word_16le((T)->program, A))
43
44/****************************************************************************/
45/* Write a byte to given memory location                                    */
46/****************************************************************************/
47#define T11_WRMEM(T,A,V) (memory_write_byte_16le((T)->program, A,V))
48#define T11_WRMEM_WORD(T,A,V) (memory_write_word_16le((T)->program, A,V))
49
5039CPU_DISASSEMBLE( t11 );
5140
5241#endif /* __T11_H__ */
src/emu/cpu/arm7/arm7.c
r3957r3958
232232        case CPUINFO_INT_MIN_CYCLES:                    info->i = 3;                            break;
233233        case CPUINFO_INT_MAX_CYCLES:                    info->i = 4;                            break;
234234
235        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;                   break;
236        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;                   break;
237        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;                    break;
238        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;                    break;
239        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;                    break;
240        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;                    break;
241        case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                    break;
242        case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;                    break;
243        case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;                    break;
235        case CPUINFO_INT_DATABUS_WIDTH_PROGRAM: info->i = 32;                   break;
236        case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 32;                   break;
237        case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;                    break;
238        case CPUINFO_INT_DATABUS_WIDTH_DATA:    info->i = 0;                    break;
239        case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;                    break;
240        case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;                    break;
241        case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;                    break;
242        case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 0;                    break;
243        case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;                    break;
244244
245245        /* interrupt lines/exceptions */
246246        case CPUINFO_INT_INPUT_STATE + ARM7_IRQ_LINE:                   info->i = cpustate->pendingIrq; break;
r3957r3958
303303        case CPUINFO_INT_REGISTER + ARM7_USPSR: info->i = ARM7REG(eSPSR_UND);                   break;
304304
305305        /* --- the following bits of info are returned as pointers to data or functions --- */
306        case CPUINFO_PTR_SET_INFO:              info->setinfo = CPU_SET_INFO_NAME(arm7);                  break;
307        case CPUINFO_PTR_INIT:                  info->init = CPU_INIT_NAME(arm7);                         break;
308        case CPUINFO_PTR_RESET:                 info->reset = CPU_RESET_NAME(arm7);                       break;
309        case CPUINFO_PTR_EXIT:                  info->exit = CPU_EXIT_NAME(arm7);                         break;
310        case CPUINFO_PTR_EXECUTE:               info->execute = CPU_EXECUTE_NAME(arm7);                   break;
311        case CPUINFO_PTR_BURN:                  info->burn = NULL;                              break;
312        case CPUINFO_PTR_DISASSEMBLE:           info->disassemble = CPU_DISASSEMBLE_NAME(arm7);                  break;
306        case CPUINFO_FCT_SET_INFO:              info->setinfo = CPU_SET_INFO_NAME(arm7);                  break;
307        case CPUINFO_FCT_INIT:                  info->init = CPU_INIT_NAME(arm7);                         break;
308        case CPUINFO_FCT_RESET:                 info->reset = CPU_RESET_NAME(arm7);                       break;
309        case CPUINFO_FCT_EXIT:                  info->exit = CPU_EXIT_NAME(arm7);                         break;
310        case CPUINFO_FCT_EXECUTE:               info->execute = CPU_EXECUTE_NAME(arm7);                   break;
311        case CPUINFO_FCT_BURN:                  info->burn = NULL;                              break;
312        case CPUINFO_FCT_DISASSEMBLE:           info->disassemble = CPU_DISASSEMBLE_NAME(arm7);                  break;
313313        case CPUINFO_PTR_INSTRUCTION_COUNTER:   info->icount = &ARM7_ICOUNT;                    break;
314314
315315        /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/arm7/arm7.h
r3957r3958
3939 *  PUBLIC FUNCTIONS
4040 ***************************************************************************************************/
4141extern CPU_GET_INFO( arm7 );
42#define CPU_ARM7 CPU_GET_INFO_NAME( arm7 )
4243
4344#endif /* __ARM7_H__ */
src/emu/cpu/drcbex86.c
r3957r3958
9191#include "debugger.h"
9292#include "x86emit.h"
9393#include "eminline.h"
94#undef REG_SP
9594#include "x86log.h"
9695#include <math.h>
9796#include <stddef.h>
src/emu/cpu/h6280/h6280.c
r3957r3958
435435      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
436436      case CPUINFO_INT_MAX_CYCLES:               info->i = 17 + 6*65536;               break;
437437
438      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
439      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 21;               break;
440      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
441      case CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
442      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
443      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
444      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
445      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
446      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 2;               break;
447      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
438      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
439      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 21;               break;
440      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
441      case CPUINFO_INT_LOGADDR_WIDTH_PROGRAM: info->i = 16;               break;
442      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
443      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
444      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
445      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
446      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 2;               break;
447      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
448448
449449      case CPUINFO_INT_INPUT_STATE + 0:            info->i = cpustate->irq_state[0];      break;
450450      case CPUINFO_INT_INPUT_STATE + 1:            info->i = cpustate->irq_state[1];      break;
r3957r3958
477477      case CPUINFO_INT_REGISTER + H6280_M8:         info->i = cpustate->mmr[7];            break;
478478
479479      /* --- the following bits of info are returned as pointers to data or functions --- */
480      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(h6280);      break;
481      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(h6280);            break;
482      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(h6280);         break;
483      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(h6280);            break;
484      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(h6280);      break;
485      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
486      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(h6280);break;
480      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(h6280);      break;
481      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(h6280);            break;
482      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(h6280);         break;
483      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(h6280);            break;
484      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(h6280);      break;
485      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
486      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(h6280);break;
487487      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->ICount;            break;
488      case CPUINFO_PTR_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(h6280);   break;
488      case CPUINFO_FCT_TRANSLATE:                  info->translate = CPU_TRANSLATE_NAME(h6280);   break;
489489
490490      /* --- the following bits of info are returned as NULL-terminated strings --- */
491491      case CPUINFO_STR_NAME:                     strcpy(info->s, "HuC6280");         break;
src/emu/cpu/h6280/h6280.h
r3957r3958
7575
7676
7777CPU_GET_INFO( h6280 );
78#define CPU_H6280 CPU_GET_INFO_NAME( h6280 )
7879
7980READ8_HANDLER( h6280_irq_status_r );
8081WRITE8_HANDLER( h6280_irq_status_w );
src/emu/cpu/m6800/m6800.h
r3957r3958
4646#endif
4747
4848CPU_GET_INFO( m6800 );
49#define CPU_M6800 CPU_GET_INFO_NAME( m6800 )
4950
5051#if (HAS_M6801)
5152CPU_GET_INFO( m6801 );
53#define CPU_M6801 CPU_GET_INFO_NAME( m6801 )
5254#endif
5355
5456#if (HAS_M6802)
5557CPU_GET_INFO( m6802 );
58#define CPU_M6802 CPU_GET_INFO_NAME( m6802 )
5659#endif
5760
5861#if (HAS_M6803)
5962CPU_GET_INFO( m6803 );
63#define CPU_M6803 CPU_GET_INFO_NAME( m6803 )
6064#endif
6165
6266#if (HAS_M6808)
6367CPU_GET_INFO( m6808 );
68#define CPU_M6808 CPU_GET_INFO_NAME( m6808 )
6469#endif
6570
6671#if (HAS_HD63701)
6772CPU_GET_INFO( hd63701 );
73#define CPU_HD63701 CPU_GET_INFO_NAME( hd63701 )
6874
6975/* FIMXE: these should be replaced to use m6803 ones */
7076#define HD63701_DDR1 M6803_DDR1
r3957r3958
8490
8591#if (HAS_NSC8105)
8692CPU_GET_INFO( nsc8105 );
93#define CPU_NSC8105 CPU_GET_INFO_NAME( nsc8105 )
8794#endif
8895
8996
r3957r3958
252259extern CPU_GET_INFO( nsc8105 );
253260#endif
254261
255
256262#endif
257263#endif /* __M6800_H__ */
264
src/emu/cpu/m6800/m6800.c
r3957r3958
12871287   cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
12881288   cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
12891289
1290   cpustate->clock = clock;
1290   cpustate->clock = device->clock / 4;
12911291   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
12921292   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
12931293
r3957r3958
13331333   cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
13341334   cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
13351335
1336   cpustate->clock = clock;
1336   cpustate->clock = device->clock / 4;
13371337   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
13381338   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
13391339
r3957r3958
16951695   cpustate->data = cpu_get_address_space(device, ADDRESS_SPACE_DATA);
16961696   cpustate->io = cpu_get_address_space(device, ADDRESS_SPACE_IO);
16971697
1698   cpustate->clock = clock;
1698   cpustate->clock = device->clock / 4;
16991699   cpustate->m6800_rx_timer = timer_alloc(device->machine, m6800_rx_tick, cpustate);
17001700   cpustate->m6800_tx_timer = timer_alloc(device->machine, m6800_tx_tick, cpustate);
17011701
r3957r3958
26932693      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
26942694      case CPUINFO_INT_MAX_CYCLES:               info->i = 12;                     break;
26952695
2696      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
2697      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
2698      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
2699      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
2700      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2701      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
2702      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 9;               break;
2703      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
2704      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
2696      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
2697      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
2698      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
2699      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
2700      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
2701      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
2702      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 9;               break;
2703      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
2704      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
27052705
27062706      case CPUINFO_INT_INPUT_STATE + M6800_IRQ_LINE:   info->i = cpustate->irq_state[M6800_IRQ_LINE]; break;
27072707      case CPUINFO_INT_INPUT_STATE + M6800_TIN_LINE:   info->i = cpustate->irq_state[M6800_TIN_LINE]; break;
r3957r3958
27202720      case CPUINFO_INT_REGISTER + M6800_WAI_STATE:   info->i = cpustate->wai_state;            break;
27212721
27222722      /* --- the following bits of info are returned as pointers to data or functions --- */
2723      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6800);         break;
2724      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6800);            break;
2725      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(m6800);            break;
2726      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(m6800);            break;
2727      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6800);         break;
2728      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
2729      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6800);         break;
2723      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(m6800);         break;
2724      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6800);            break;
2725      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(m6800);            break;
2726      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(m6800);            break;
2727      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6800);         break;
2728      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
2729      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6800);         break;
27302730      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
27312731
27322732      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
27702770   {
27712771      /* --- the following bits of info are returned as 64-bit signed integers --- */
27722772      case CPUINFO_INT_CLOCK_DIVIDER:                     info->i = 4;               break;
2773      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
2774      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
2773      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
2774      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
27752775
27762776      /* --- the following bits of info are returned as pointers to data or functions --- */
2777      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6801);            break;
2778      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6803);         break;
2779      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6801);         break;
2777      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6801);            break;
2778      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6803);         break;
2779      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6801);         break;
27802780
27812781      /* --- the following bits of info are returned as NULL-terminated strings --- */
27822782      case CPUINFO_STR_NAME:                     strcpy(info->s, "M6801");            break;
r3957r3958
28002800      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
28012801
28022802      /* --- the following bits of info are returned as pointers to data or functions --- */
2803      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6802);            break;
2804      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6802);         break;
2803      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6802);            break;
2804      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6802);         break;
28052805
28062806      /* --- the following bits of info are returned as NULL-terminated strings --- */
28072807      case CPUINFO_STR_NAME:                     strcpy(info->s, "M6802");            break;
r3957r3958
28232823   {
28242824      /* --- the following bits of info are returned as 64-bit signed integers --- */
28252825      case CPUINFO_INT_CLOCK_DIVIDER:                     info->i = 4;               break;
2826      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
2827      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
2826      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
2827      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
28282828
28292829      /* --- the following bits of info are returned as pointers to data or functions --- */
2830      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6803);            break;
2831      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6803);         break;
2832      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6803);         break;
2830      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6803);            break;
2831      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(m6803);         break;
2832      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6803);         break;
28332833
2834      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(m6803_mem); break;
2834      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM: info->internal_map8 = ADDRESS_MAP_NAME(m6803_mem); break;
28352835
28362836      /* --- the following bits of info are returned as NULL-terminated strings --- */
28372837      case CPUINFO_STR_NAME:                     strcpy(info->s, "M6803");            break;
r3957r3958
28552855      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
28562856
28572857      /* --- the following bits of info are returned as pointers to data or functions --- */
2858      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(m6808);            break;
2859      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6808);         break;
2858      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(m6808);            break;
2859      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(m6808);         break;
28602860
28612861      /* --- the following bits of info are returned as NULL-terminated strings --- */
28622862      case CPUINFO_STR_NAME:                     strcpy(info->s, "M6808");            break;
r3957r3958
28782878   {
28792879      /* --- the following bits of info are returned as 64-bit signed integers --- */
28802880      case CPUINFO_INT_CLOCK_DIVIDER:                     info->i = 4;               break;
2881      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
2882      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 9;               break;
2881      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
2882      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 9;               break;
28832883
28842884      /* --- the following bits of info are returned as pointers to data or functions --- */
2885      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(hd63701);            break;
2886      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hd63701);      break;
2887      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hd63701);      break;
2885      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(hd63701);            break;
2886      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(hd63701);      break;
2887      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(hd63701);      break;
28882888
28892889      /* --- the following bits of info are returned as NULL-terminated strings --- */
28902890      case CPUINFO_STR_NAME:                     strcpy(info->s, "HD63701");            break;
r3957r3958
29082908      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 4;                     break;
29092909
29102910      /* --- the following bits of info are returned as pointers to data or functions --- */
2911      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(nsc8105);            break;
2912      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(nsc8105);      break;
2913      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nsc8105);      break;
2911      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(nsc8105);            break;
2912      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(nsc8105);      break;
2913      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(nsc8105);      break;
29142914
29152915      /* --- the following bits of info are returned as NULL-terminated strings --- */
29162916      case CPUINFO_STR_NAME:                     strcpy(info->s, "NSC8105");            break;
src/emu/cpu/cp1610/cp1610.h
r3957r3958
3737
3838
3939CPU_GET_INFO( cp1610 );
40#define CPU_CP1610 CPU_GET_INFO_NAME( cp1610 )
4041
4142CPU_DISASSEMBLE( cp1610 );
4243
src/emu/cpu/cp1610/cp1610.c
r3957r3958
34543454   case CPUINFO_INT_MIN_CYCLES:               info->i = 1;         break;
34553455   case CPUINFO_INT_MAX_CYCLES:               info->i = 7;         break;
34563456
3457   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;   break;
3458   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;   break;
3459   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = -1;   break;
3460   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;   break;
3461   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;   break;
3462   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;   break;
3463   case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;   break;
3464   case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;   break;
3465   case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;   break;
3457   case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 16;   break;
3458   case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;   break;
3459   case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = -1;   break;
3460   case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;   break;
3461   case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;   break;
3462   case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;   break;
3463   case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;   break;
3464   case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;   break;
3465   case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;   break;
34663466
34673467   case CPUINFO_INT_PREVIOUSPC:      info->i = 0;   /* TODO??? */      break;
34683468
r3957r3958
34823482   case CPUINFO_INT_REGISTER + CP1610_R7: info->i = cpustate->r[7];         break;
34833483
34843484   /* --- the following bits of info are returned as pointers to data or functions --- */
3485   case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cp1610);      break;
3486   case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(cp1610);            break;
3487   case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(cp1610);            break;
3488   case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cp1610);         break;
3489   case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
3485   case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(cp1610);      break;
3486   case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(cp1610);            break;
3487   case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(cp1610);            break;
3488   case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(cp1610);         break;
3489   case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
34903490
3491   case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cp1610);      break;
3491   case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(cp1610);      break;
34923492   case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;         break;
34933493
34943494   /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/saturn/saturn.h
r3957r3958
8989CPU_DISASSEMBLE( saturn );
9090
9191CPU_GET_INFO( saturn );
92#define CPU_SATURN CPU_GET_INFO_NAME( saturn )
9293
9394#endif /* __SATURN_H__ */
src/emu/cpu/saturn/saturn.c
r3957r3958
311311      case CPUINFO_INT_MIN_CYCLES:               info->i = 2;                     break;
312312      case CPUINFO_INT_MAX_CYCLES:               info->i = 21;                     break;
313313
314      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
315      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 20;               break;
316      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
317      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
318      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
319      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
320      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
321      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
322      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
314      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
315      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 20;               break;
316      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
317      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
318      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
319      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
320      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
321      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
322      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
323323
324324      case CPUINFO_INT_INPUT_STATE + SATURN_NMI_LINE:           info->i = cpustate->nmi_state;            break;
325325      case CPUINFO_INT_INPUT_STATE + SATURN_IRQ_LINE:           info->i = cpustate->irq_state;            break;
r3957r3958
357357           case CPUINFO_INT_REGISTER + SATURN_SLEEPING:      info->i = cpustate->sleeping;
358358
359359      /* --- the following bits of info are returned as pointers to data or functions --- */
360      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(saturn);         break;
361      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(saturn);               break;
362      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(saturn);               break;
363      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(saturn);            break;
364      case CPUINFO_PTR_BURN:                     info->burn = NULL;                     break;
365      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(saturn);      break;
360      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(saturn);         break;
361      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(saturn);               break;
362      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(saturn);               break;
363      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(saturn);            break;
364      case CPUINFO_FCT_BURN:                     info->burn = NULL;                     break;
365      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(saturn);      break;
366366      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
367367
368368      /* --- the following bits of info are returned as NULL-terminated strings --- */
src/emu/cpu/i8x41/i8x41.h
r3957r3958
8989extern CPU_GET_INFO( i8242 );
9090extern CPU_GET_INFO( i8742 );
9191
92#define CPU_I8041 CPU_GET_INFO_NAME( i8041 )
93#define CPU_I8741 CPU_GET_INFO_NAME( i8741 )
94#define CPU_I8042 CPU_GET_INFO_NAME( i8042 )
95#define CPU_I8242 CPU_GET_INFO_NAME( i8242 )
96#define CPU_I8742 CPU_GET_INFO_NAME( i8742 )
97
9298extern CPU_DISASSEMBLE( i8x41 );
9399
94100#endif /* __I8X41_H__ */
src/emu/cpu/i8x41/i8x41.c
r3957r3958
11931193      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
11941194      case CPUINFO_INT_MAX_CYCLES:               info->i = 2;                     break;
11951195
1196      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
1197      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 16;               break;
1198      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM:   info->i = 0;               break;
1199      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
1200      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 8;               break;
1201      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:   info->i = 0;               break;
1202      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 8;               break;
1203      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 16;               break;
1204      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:      info->i = 0;               break;
1196      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
1197      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM:   info->i = 16;               break;
1198      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM:   info->i = 0;               break;
1199      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 8;               break;
1200      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:   info->i = 8;               break;
1201      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:   info->i = 0;               break;
1202      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 8;               break;
1203      case CPUINFO_INT_ADDRBUS_WIDTH_IO:      info->i = 16;               break;
1204      case CPUINFO_INT_ADDRBUS_SHIFT_IO:      info->i = 0;               break;
12051205
1206      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1207      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
1206      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_10bit);   break;
1207      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_7bit);      break;
12081208
12091209      case CPUINFO_INT_INPUT_STATE + I8X41_INT_IBF:   info->i = (STATE & IBF) ? ASSERT_LINE : CLEAR_LINE; break;
12101210      case CPUINFO_INT_INPUT_STATE + I8X41_INT_TEST1:   info->i = (STATE & TEST1) ? ASSERT_LINE : CLEAR_LINE; break;
r3957r3958
12531253         break;
12541254
12551255      /* --- the following bits of info are returned as pointers to data or functions --- */
1256      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8x41);      break;
1257      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(i8x41);            break;
1258      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(i8x41);         break;
1259      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(i8x41);            break;
1260      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i8x41);      break;
1261      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
1262      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8x41);         break;
1256      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(i8x41);      break;
1257      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(i8x41);            break;
1258      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(i8x41);         break;
1259      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(i8x41);            break;
1260      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(i8x41);      break;
1261      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
1262      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(i8x41);         break;
12631263      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &upi41_state->icount ;         break;
12641264
12651265      /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
13191319{
13201320   switch (state)
13211321   {
1322      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1323      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);      break;
1324      case CPUINFO_PTR_INIT:                                 info->init = CPU_INIT_NAME(i8042);               break;
1322      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM:   info->internal_map8 = ADDRESS_MAP_NAME(program_11bit);   break;
1323      case CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA:       info->internal_map8 = ADDRESS_MAP_NAME(data_8bit);      break;
1324      case CPUINFO_FCT_INIT:                                 info->init = CPU_INIT_NAME(i8042);               break;
13251325      case CPUINFO_STR_NAME:                                 strcpy(info->s, "I8042");                     break;
13261326      default:                                          CPU_GET_INFO_CALL(i8041);                     break;
13271327   }
src/emu/cpu/konami/konami.c
r3957r3958
522522      case CPUINFO_INT_REGISTER + KONAMI_DP:         DP = info->i;                     break;
523523
524524      /* --- the following bits of info are set as pointers to data or functions --- */
525      case CPUINFO_PTR_KONAMI_SETLINES_CALLBACK:      cpustate->setlines_callback = (konami_set_lines_func)info->f; break;
525      case CPUINFO_FCT_KONAMI_SETLINES_CALLBACK:      cpustate->setlines_callback = (konami_set_lines_func)info->f; break;
526526   }
527527}
528528
r3957r3958
549549      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
550550      case CPUINFO_INT_MAX_CYCLES:               info->i = 13;                     break;
551551
552      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 8;               break;
553      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 16;               break;
554      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
555      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
556      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
557      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
558      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
559      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
560      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
552      case CPUINFO_INT_DATABUS_WIDTH_PROGRAM:   info->i = 8;               break;
553      case CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM: info->i = 16;               break;
554      case CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM: info->i = 0;               break;
555      case CPUINFO_INT_DATABUS_WIDTH_DATA:   info->i = 0;               break;
556      case CPUINFO_INT_ADDRBUS_WIDTH_DATA:    info->i = 0;               break;
557      case CPUINFO_INT_ADDRBUS_SHIFT_DATA:    info->i = 0;               break;
558      case CPUINFO_INT_DATABUS_WIDTH_IO:      info->i = 0;               break;
559      case CPUINFO_INT_ADDRBUS_WIDTH_IO:       info->i = 0;               break;
560      case CPUINFO_INT_ADDRBUS_SHIFT_IO:       info->i = 0;               break;
561561
562562      case CPUINFO_INT_INPUT_STATE + KONAMI_IRQ_LINE:   info->i = cpustate->irq_state[KONAMI_IRQ_LINE]; break;
563563      case CPUINFO_INT_INPUT_STATE + KONAMI_FIRQ_LINE:info->i = cpustate->irq_state[KONAMI_FIRQ_LINE]; break;
r3957r3958
578578      case CPUINFO_INT_REGISTER + KONAMI_DP:         info->i = DP;                     break;
579579
580580      /* --- the following bits of info are returned as pointers to data or functions --- */
581      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(konami);      break;
582      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(konami);            break;
583      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(konami);         break;
584      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(konami);            break;
585      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(konami);      break;
586      case CPUINFO_PTR_BURN:                     info->burn = NULL;                        break;
587      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(konami);break;
581      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(konami);      break;
582      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(konami);            break;
583      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(konami);         break;
584      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(konami);            break;
585      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(konami);      break;
586      case CPUINFO_FCT_BURN:                     info->burn = NULL;                        break;
587      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(konami);break;
588588      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;            break;
589      case CPUINFO_PTR_KONAMI_SETLINES_CALLBACK:      info->f = (genf *)cpustate->setlines_callback;   break;
589      case CPUINFO_FCT_KONAMI_SETLINES_CALLBACK:      info->f = (genf *)cpustate->setlines_callback;   break;
590590
591591      /* --- the following bits of info are returned as NULL-terminated strings --- */
592592      case CPUINFO_STR_NAME:                     strcpy(info->s, "KONAMI");            break;
src/emu/cpu/konami/konami.h
r3957r3958
1717
1818enum
1919{
20   CPUINFO_PTR_KONAMI_SETLINES_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC
20   CPUINFO_FCT_KONAMI_SETLINES_CALLBACK = CPUINFO_FCT_CPU_SPECIFIC
2121};
2222
2323#define KONAMI_SETLINES_CALLBACK(name) void name(const device_config *device, int lines)
r3957r3958
2727
2828/* PUBLIC FUNCTIONS */
2929CPU_GET_INFO( konami );
30#define CPU_KONAMI CPU_GET_INFO_NAME( konami )
3031
3132CPU_DISASSEMBLE( konami );
3233
3334
3435INLINE void konami_configure_set_lines(const device_config *device, konami_set_lines_func func)
3536{
36   cpu_set_info_fct(device, CPUINFO_PTR_KONAMI_SETLINES_CALLBACK, (genf *)func);
37   device_set_info_fct(device, CPUINFO_FCT_KONAMI_SETLINES_CALLBACK, (genf *)func);
3738}
3839
3940#endif /* __KONAMI_H__ */
src/emu/streams.c
r3957r3958
111111struct _sound_stream
112112{
113113   /* linking information */
114   running_machine *   machine;            /* owning machine object */
114   const device_config *   device;            /* owning device */
115115   sound_stream *      next;               /* next stream in the chain */
116116   void *            tag;               /* tag (used for identification) */
117117   int               index;               /* index for save states */
r3957r3958
362362   VPRINTF(("stream_create(%d, %d, %d) => %p\n", inputs, outputs, sample_rate, stream));
363363
364364   /* fill in the data */
365   stream->machine = machine;
365   stream->device = device;
366366   stream->tag = strdata->current_tag;
367367   stream->index = strdata->stream_index++;
368368   stream->sample_rate = sample_rate;
r3957r3958
457457      input->source->dependents++;
458458
459459   /* update sample rates now that we know the input */
460   recompute_sample_rate_data(stream->machine->streams_data, stream);
460   recompute_sample_rate_data(stream->device->machine->streams_data, stream);
461461}
462462
463463
r3957r3958
468468
469469void stream_update(sound_stream *stream)
470470{
471   streams_private *strdata = stream->machine->streams_data;
472   INT32 update_sampindex = time_to_sampindex(strdata, stream, timer_get_time(stream->machine));
471   running_machine *machine = stream->device->machine;
472   streams_private *strdata = machine->streams_data;
473   INT32 update_sampindex = time_to_sampindex(strdata, stream, timer_get_time(machine));
473474
474475   /* generate samples to get us up to the appropriate time */
475476   assert(stream->output_sampindex - stream->output_base_sampindex >= 0);
r3957r3958
538539
539540attotime stream_get_time(sound_stream *stream)
540541{
541   streams_private *strdata = stream->machine->streams_data;
542   streams_private *strdata = stream->device->machine->streams_data;
542543   attotime base = attotime_make(strdata->last_update.seconds, 0);
543544   return attotime_add_attoseconds(base, stream->output_sampindex * stream->attoseconds_per_sample);
544545}
r3957r3958
808809
809810   /* run the callback */
810811   VPRINTF(("  callback(%p, %d)\n", stream, samples));
811   (*stream->callback)(stream->param, stream->input_array, stream->output_array, samples);
812   (*stream->callback)(stream->device, stream->param, stream->input_array, stream->output_array, samples);
812813   VPRINTF(("  callback done\n"));
813814}
814815
src/emu/streams.h
r3957r3958
2121
2222typedef struct _sound_stream sound_stream;
2323
24typedef void (*stream_update_func)(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
24typedef void (*stream_update_func)(const device_config *device, void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
2525
26#define STREAM_UPDATE(name) void name(const device_config *device, void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
2627
2728
29
2830/***************************************************************************
2931    FUNCTION PROTOTYPES
3032***************************************************************************/
src/emu/video/cdp1869.c
r3957r3958
4545   const device_config *screen;   /* screen */
4646   const device_config *cpu;      /* CPU */
4747   sound_stream *stream;         /* sound output */
48   int color_clock;
4849
4950   /* video state */
5051   int dispoff;               /* display off */
r3957r3958
728729
729730   if (!cdp1869->toneoff && cdp1869->toneamp)
730731   {
731      double frequency = (cdp1869->intf->pixel_clock / 2) / (512 >> cdp1869->tonefreq) / (cdp1869->tonediv + 1);
732      double frequency = (device->clock / 2) / (512 >> cdp1869->tonefreq) / (cdp1869->tonediv + 1);
732733
733734      int rate = device->machine->sample_rate / 2;
734735
r3957r3958
767768
768769        for (wndiv = 0; wndiv < 128; wndiv++)
769770        {
770            double frequency = (cdp1869->intf->pixel_clock / 2) / (4096 >> cdp1869->wnfreq) / (wndiv + 1);
771            double frequency = (device->clock / 2) / (4096 >> cdp1869->wnfreq) / (wndiv + 1);
771772
772773            cdp1869_sum_square_wave(buffer, frequency, amplitude);
773774        }
r3957r3958
779780
780781static DEVICE_START( cdp1869 )
781782{
783   const cdp1869_inline *inline_config = device->inline_config;
782784   cdp1869_t *cdp1869 = get_safe_token(device);
783785
784786   // validate arguments
r3957r3958
786788   assert(device != NULL);
787789   assert(device->tag != NULL);
788790   assert(device->static_config != NULL);
791   assert(inline_config != NULL);
789792
790793   cdp1869->intf = device->static_config;
791794
r3957r3958
800803
801804   // get the screen device
802805
803   cdp1869->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1869->intf->screen_tag);
806   cdp1869->screen = devtag_get_device(device->machine, VIDEO_SCREEN, inline_config->screen_tag);
804807   assert(cdp1869->screen != NULL);
805808
806809   // get the CPU device
807810
808   cdp1869->cpu = cputag_get_cpu(device->machine, cdp1869->intf->cpu_tag);
811   cdp1869->cpu = cputag_get_cpu(device->machine, inline_config->cpu_tag);
809812   assert(cdp1869->cpu != NULL);
810813
811814   // allocate timers
r3957r3958
859862   {
860863      /* --- the following bits of info are returned as 64-bit signed integers --- */
861864      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(cdp1869_t);            break;
862      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
865      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(cdp1869_inline);         break;
863866      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
864867
865868      /* --- the following bits of info are returned as pointers to data or functions --- */
r3957r3958
869872      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
870873
871874      /* --- the following bits of info are returned as NULL-terminated strings --- */
872      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1869";               break;
873      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
874      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
875      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
876      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
875      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1869");            break;
876      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");            break;
877      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
878      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
879      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
877880   }
878881}
src/emu/video/v9938.c
r3957r3958
1515*/
1616
1717#include "driver.h"
18#include "deprecat.h"
1918#include "v9938.h"
2019
2120#define VERBOSE 0
r3957r3958
9493   "GRAPHIC 4", "GRAPHIC 5", "GRAPHIC 6", "GRAPHIC 7", "TEXT 2",
9594   "UNKNOWN" };
9695
97static void v9938_register_write (int reg, int data);
96static void v9938_register_write (running_machine *machine, int reg, int data);
9897static void v9938_update_command (void);
9998static void v9938_cpu_to_vdp (UINT8 V);
10099static UINT8 v9938_command_unit_w (UINT8 Op);
101100static UINT8 v9938_vdp_to_cpu (void);
102101static void v9938_set_mode (void);
103static void v9938_refresh_line (bitmap_t *bmp, int line);
102static void v9938_refresh_line (running_machine *machine, bitmap_t *bmp, int line);
104103
105104/***************************************************************************
106105
r3957r3958
435434   return v9938_vram_r();
436435}
437436
438static void v9938_command_w(UINT8 data)
437static void v9938_command_w(running_machine *machine, UINT8 data)
439438   {
440439   if (vdp->cmd_write_first)
441440      {
442441      if (data & 0x80)
443442      {
444443         if (!(data & 0x40))
445         v9938_register_write (data & 0x3f, vdp->cmd_write);
444         v9938_register_write (machine, data & 0x3f, vdp->cmd_write);
446445      }
447446      else
448447         {
r3957r3958
463462WRITE8_HANDLER (v9938_0_command_w)
464463{
465464   vdp = &vdps[0];
466   v9938_command_w(data);
465   v9938_command_w(space->machine, data);
467466}
468467
469468WRITE8_HANDLER (v9938_1_command_w)
470469{
471470   vdp = &vdps[1];
472   v9938_command_w(data);
471   v9938_command_w(space->machine, data);
473472}
474473
475474/***************************************************************************
r3957r3958
582581   vdp->scanline = 0;
583582}
584583
585static void v9938_check_int (void)
584static void v9938_check_int (running_machine *machine)
586585   {
587586   UINT8 n;
588587
r3957r3958
605604    ** called; because of this Mr. Ghost, Xevious and SD Snatcher don't
606605    ** run. As a patch it's called every scanline
607606    */
608   vdp->INTCallback (Machine, n);
607   vdp->INTCallback (machine, n);
609608   }
610609
611610void v9938_set_sprite_limit (int which, int i)
r3957r3958
634633
635634***************************************************************************/
636635
637static void v9938_register_w(UINT8 data)
636static void v9938_register_w(running_machine *machine, UINT8 data)
638637{
639638   int reg;
640639
641640   reg = vdp->contReg[17] & 0x3f;
642641   if (reg != 17)
643      v9938_register_write (reg, data); /* true ? */
642      v9938_register_write (machine, reg, data); /* true ? */
644643
645644   if (!(vdp->contReg[17] & 0x80))
646645      vdp->contReg[17] = (vdp->contReg[17] + 1) & 0x3f;
r3957r3958
649648WRITE8_HANDLER (v9938_0_register_w)
650649{
651650   vdp = &vdps[0];
652   v9938_register_w(data);
651   v9938_register_w(space->machine, data);
653652}
654653
655654WRITE8_HANDLER (v9938_1_register_w)
656655{
657656   vdp = &vdps[1];
658   v9938_register_w(data);
657   v9938_register_w(space->machine, data);
659658}
660659
661static void v9938_register_write (int reg, int data)
660static void v9938_register_write (running_machine *machine, int reg, int data)
662661{
663662   static UINT8 const reg_mask[] =
664663   {
r3957r3958
689688   case 1:
690689      vdp->contReg[reg] = data;
691690      v9938_set_mode ();
692      v9938_check_int ();
691      v9938_check_int (machine);
693692      LOG(("V9938: mode = %s\n", v9938_modes[vdp->mode]));
694693      break;
695694
r3957r3958
812811      }
813812
814813   LOG(("V9938: Read %02x from S#%d\n", ret, reg));
815   v9938_check_int ();
814   v9938_check_int (machine);
816815
817816   return ret;
818817   }
r3957r3958
12121211   vdp->mode = i;
12131212   }
12141213
1215static void v9938_refresh_16 (bitmap_t *bmp, int line)
1214static void v9938_refresh_16 (running_machine *machine, bitmap_t *bmp, int line)
12161215   {
1217   const pen_t *pens = Machine->pens;
1216   const pen_t *pens = machine->pens;
12181217   int i, double_lines;
12191218   UINT8 col[256];
12201219   UINT16 *ln, *ln2 = NULL;
r3957r3958
12721271      memcpy (ln2, ln, (512 + 32) * 2);
12731272   }
12741273
1275static void v9938_refresh_line (bitmap_t *bmp, int line)
1274static void v9938_refresh_line (running_machine *machine, bitmap_t *bmp, int line)
12761275   {
12771276   int ind16, ind256;
12781277
r3957r3958
12851284      vdp->pal_ind256[0] = vdp->pal_ind256[vdp->contReg[7]];
12861285      }
12871286
1288   v9938_refresh_16 (bmp, line);
1287   v9938_refresh_16 (machine, bmp, line);
12891288
12901289   if ( !(vdp->contReg[8] & 0x20) && (vdp->mode != V9938_MODE_GRAPHIC5) )
12911290      {
r3957r3958
14591458   vdp->size_now = -1;
14601459   }
14611460
1462int v9938_interrupt (int which)
1461int v9938_interrupt (running_machine *machine, int which)
14631462{
14641463   int scanline, max, pal, scanline_start;
14651464
r3957r3958
14921491   else
14931492      if ( !(vdp->contReg[0] & 0x10) ) vdp->statReg[1] &= 0xfe;
14941493
1495   v9938_check_int ();
1494   v9938_check_int (machine);
14961495
14971496   /* check for start of vblank */
14981497   if ((pal && (vdp->scanline == 310)) ||
r3957r3958
15041503   {
15051504      scanline = (vdp->scanline - scanline_start) & 255;
15061505
1507      v9938_refresh_line (vdp->bitmap, scanline);
1506      v9938_refresh_line (machine, vdp->bitmap, scanline);
15081507   }
15091508
15101509   max = (vdp->contReg[9] & 2) ? 313 : 262;
src/emu/video/vector.c
r3957r3958
3131 **************************************************************************** */
3232
3333#include "rendutil.h"
34#include "deprecat.h"
3534#include "vector.h"
3635
3736
r3957r3958
193192 * Adds a line end point to the vertices list. The vector processor emulation
194193 * needs to call this.
195194 */
196void vector_add_point (int x, int y, rgb_t color, int intensity)
195void vector_add_point (running_machine *machine, int x, int y, rgb_t color, int intensity)
197196{
198197   point *newpoint;
199198
r3957r3958
202201
203202   if (flicker && (intensity > 0))
204203   {
205      intensity += (intensity * (0x80-(mame_rand(Machine)&0xff)) * flicker)>>16;
204      intensity += (intensity * (0x80-(mame_rand(machine)&0xff)) * flicker)>>16;
206205      if (intensity < 0)
207206         intensity = 0;
208207      if (intensity > 0xff)
src/emu/video/cdp1869.h
r3957r3958
8080
8181#define CDP1869_VIDEO      DEVICE_GET_INFO_NAME(cdp1869_video)
8282
83#define MDRV_CDP1869_ADD(_tag, _screen, _pixclock, _chrclock, _cpu, _config) \
84   MDRV_DEVICE_ADD(_tag, CDP1869_VIDEO, _pixclock) \
85   MDRV_DEVICE_CONFIG_DATA32(cdp1869_inline, color_clock, _chrclock) \
86   MDRV_DEVICE_CONFIG_DATAPTR(cdp1869_inline, screen_tag, _screen) \
87   MDRV_DEVICE_CONFIG_DATAPTR(cdp1869_inline, cpu_tag, _cpu) \
88   MDRV_DEVICE_CONFIG(_config)
89
90#define MDRV_CDP1869_REMOVE(_tag) \
91   MDRV_DEVICE_REMOVE(_tag, CDP1869_VIDEO)
92
93
8394typedef UINT8 (*cdp1869_char_ram_read_func)(const device_config *device, UINT16 pma, UINT8 cma);
8495#define CDP1869_CHAR_RAM_READ(name) UINT8 name(const device_config *device, UINT16 pma, UINT8 cma)
8596
r3957r3958
104115   CDP1869_PAL
105116};
106117
107/* interface */
108typedef struct _cdp1869_interface cdp1869_interface;
109struct _cdp1869_interface
118typedef struct _cdp1869_inline cdp1869_inline;
119struct _cdp1869_inline
110120{
111121   const char *screen_tag;      /* screen we are acting on */
112122   const char *cpu_tag;      /* CPU we work together with */
113   int pixel_clock;         /* the dot clock of the chip */
123
124   /* pixel clock of the chip is the device clock */
114125   int color_clock;         /* the chroma clock of the chip */
126};
115127
128/* interface */
129typedef struct _cdp1869_interface cdp1869_interface;
130struct _cdp1869_interface
131{
116132   cdp1869_format pal_ntsc;   /* screen format */
117133
118134   /* page memory read function */
src/emu/video/voodoo.c
r3957r3958
44654465   v->device = device;
44664466
44674467   /* copy config data */
4468   v->freq = config->clock;
4468   v->freq = device->clock;
44694469   v->fbi.vblank_client = config->vblank;
44704470   v->pci.stall_callback = config->stall;
44714471
44724472   /* create a multiprocessor work queue */
4473   v->poly = poly_alloc(64, sizeof(poly_extra_data), 0);
4473   v->poly = poly_alloc(device->machine, 64, sizeof(poly_extra_data), 0);
44744474   v->thread_stats = auto_malloc(sizeof(v->thread_stats[0]) * WORK_MAX_THREADS);
44754475
44764476   /* create a table of precomputed 1/n and log2(n) values */
r3957r3958
46824682         switch (config->type)
46834683         {
46844684            default:
4685            case VOODOO_1:               info->s = "3dfx Voodoo Graphics";      break;
4686            case VOODOO_2:               info->s = "3dfx Voodoo 2";            break;
4687            case VOODOO_BANSHEE:         info->s = "3dfx Voodoo Banshee";      break;
4688            case VOODOO_3:               info->s = "3dfx Voodoo 3";            break;
4685            case VOODOO_1:               strcpy(info->s, "3dfx Voodoo Graphics");break;
4686            case VOODOO_2:               strcpy(info->s, "3dfx Voodoo 2");      break;
4687            case VOODOO_BANSHEE:         strcpy(info->s, "3dfx Voodoo Banshee");   break;
4688            case VOODOO_3:               strcpy(info->s, "3dfx Voodoo 3");      break;
46894689         }
46904690         break;
4691      case DEVINFO_STR_FAMILY:            info->s = "3dfx Voodoo Graphics";      break;
4692      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
4693      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
4694      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
4691      case DEVINFO_STR_FAMILY:            strcpy(info->s, "3dfx Voodoo Graphics");break;
4692      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
4693      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
4694      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
46954695   }
46964696}
46974697
src/emu/video/v9938.h
r3957r3958
1616
1717void v9938_init (running_machine *machine, int which, const device_config *screen, bitmap_t *bitmap, int model, int vram_size, void (*callback)(running_machine *, int) );
1818void v9938_reset (int which);
19int v9938_interrupt (int which);
19int v9938_interrupt (running_machine *machine, int which);
2020void v9938_set_sprite_limit (int which, int);
2121void v9938_set_resolution (int which, int);
2222int v9938_get_transpen(int which);
src/emu/video/vector.h
r3957r3958
1717VIDEO_UPDATE( vector );
1818
1919void vector_clear_list(void);
20void vector_add_point(int x, int y, rgb_t color, int intensity);
20void vector_add_point(running_machine *machine, int x, int y, rgb_t color, int intensity);
2121void vector_add_clip(int minx, int miny, int maxx, int maxy);
2222
2323void vector_set_flicker(float _flicker);
src/emu/video/voodoo.h
r3957r3958
4040struct _voodoo_config
4141{
4242   int               type;
43   UINT32            clock;
4443   UINT8            fbmem;
4544   UINT8            tmumem0;
4645   UINT8            tmumem1;
r3957r3958
5756***************************************************************************/
5857
5958#define MDRV_3DFX_VOODOO_ADD(_tag, _type, _clock, _fbmem, _screen) \
60   MDRV_DEVICE_ADD(_tag, VOODOO_GRAPHICS) \
59   MDRV_DEVICE_ADD(_tag, VOODOO_GRAPHICS, _clock) \
6160   MDRV_DEVICE_CONFIG_DATA32(voodoo_config, type, _type) \
62   MDRV_DEVICE_CONFIG_DATA32(voodoo_config, clock, _clock) \
6361   MDRV_DEVICE_CONFIG_DATA32(voodoo_config, fbmem, _fbmem) \
6462   MDRV_DEVICE_CONFIG_DATAPTR(voodoo_config, screen, _screen)
6563
src/emu/video/generic.c
r3957r3958
1010*********************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413#include "generic.h"
1514
1615
r3957r3958
482481    flip_screen_set - set global flip
483482-------------------------------------------------*/
484483
485void flip_screen_set(int on)
484void flip_screen_set(running_machine *machine, int on)
486485{
487   flip_screen_x_set(on);
488   flip_screen_y_set(on);
486   flip_screen_x_set(machine, on);
487   flip_screen_y_set(machine, on);
489488}
490489
491490
r3957r3958
494493       do not call update_flip.
495494-------------------------------------------------*/
496495
497void flip_screen_set_no_update(int on)
496void flip_screen_set_no_update(running_machine *machine, int on)
498497{
499498   /* flip_screen_y is not updated on purpose
500499     * this function is for drivers which
r3957r3958
509508    flip_screen_x_set - set global horizontal flip
510509-------------------------------------------------*/
511510
512void flip_screen_x_set(int on)
511void flip_screen_x_set(running_machine *machine, int on)
513512{
514513   if (on) on = ~0;
515514   if (flip_screen_x != on)
516515   {
517516      flip_screen_x = on;
518      updateflip(Machine);
517      updateflip(machine);
519518   }
520519}
521520
r3957r3958
524523    flip_screen_y_set - set global vertical flip
525524-------------------------------------------------*/
526525
527void flip_screen_y_set(int on)
526void flip_screen_y_set(running_machine *machine, int on)
528527{
529528   if (on) on = ~0;
530529   if (flip_screen_y != on)
531530   {
532531      flip_screen_y = on;
533      updateflip(Machine);
532      updateflip(machine);
534533   }
535534}
536535
r3957r3958
539538    flip_screen_get - get global flip
540539-------------------------------------------------*/
541540
542int flip_screen_get(void)
541int flip_screen_get(running_machine *machine)
543542{
544543   return flip_screen_x;
545544}
r3957r3958
549548    flip_screen_x_get - get global x flip
550549-------------------------------------------------*/
551550
552int flip_screen_x_get(void)
551int flip_screen_x_get(running_machine *machine)
553552{
554553   return flip_screen_x;
555554}
r3957r3958
559558    flip_screen_get - get global y flip
560559-------------------------------------------------*/
561560
562int flip_screen_y_get(void)
561int flip_screen_y_get(running_machine *machine)
563562{
564563   return flip_screen_y;
565564}
566565
567566
567
568568/***************************************************************************
569569    COMMON PALETTE INITIALIZATION
570570***************************************************************************/
src/emu/video/generic.h
r3957r3958
117117/* ----- global attributes ----- */
118118
119119/* set global attributes */
120void flip_screen_set(int on);
121void flip_screen_set_no_update(int on);    /* will not call update_flip */
122void flip_screen_x_set(int on);
123void flip_screen_y_set(int on);
124int flip_screen_get(void);
125int flip_screen_x_get(void);
126int flip_screen_y_get(void);
120void flip_screen_set(running_machine *machine, int on);
121void flip_screen_set_no_update(running_machine *machine, int on);    /* will not call update_flip */
122void flip_screen_x_set(running_machine *machine, int on);
123void flip_screen_y_set(running_machine *machine, int on);
124int flip_screen_get(running_machine *machine);
125int flip_screen_x_get(running_machine *machine);
126int flip_screen_y_get(running_machine *machine);
127127
128//#define flip_screen flip_screen_get()
128//#define flip_screen flip_screen_get(machine)
129129
130130
131131
src/emu/video/poly.c
r3957r3958
77***************************************************************************/
88
99#include "poly.h"
10#include "deprecat.h"
1110#include "eminline.h"
1211#include "mame.h"
1312#include "state.h"
r3957r3958
329328    manager
330329-------------------------------------------------*/
331330
332poly_manager *poly_alloc(int max_polys, size_t extra_data_size, UINT8 flags)
331poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_data_size, UINT8 flags)
333332{
334333   poly_manager *poly;
335334
r3957r3958
361360      poly->queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_MULTI | WORK_QUEUE_FLAG_HIGH_FREQ);
362361
363362   /* request a pre-save callback for synchronization */
364   state_save_register_presave(Machine, poly_state_presave, poly);
363   state_save_register_presave(machine, poly_state_presave, poly);
365364   return poly;
366365}
367366
src/emu/video/mc6845.c
r3957r3958
126126static void update_vsync_changed_timers(mc6845_t *mc6845);
127127
128128
129mc6845_interface mc6845_null_interface = { 0 };
130
131
129132/* makes sure that the passed in device is the right type */
130133INLINE mc6845_t *get_safe_token(const device_config *device)
131134{
r3957r3958
748751
749752   if (mc6845->intf != NULL)
750753   {
751      assert(mc6845->intf->clock > 0);
754      assert(device->clock > 0);
752755      assert(mc6845->intf->hpixels_per_column > 0);
753756
754757      /* copy the initial parameters */
755      mc6845->clock = mc6845->intf->clock;
758      mc6845->clock = device->clock;
756759      mc6845->hpixels_per_column = mc6845->intf->hpixels_per_column;
757760
758761      /* get the screen device */
r3957r3958
868871   int error = FALSE;
869872   const mc6845_interface *intf = (const mc6845_interface *) device->static_config;
870873
871   if (intf != NULL)
874   if (intf != NULL && intf->screen_tag != NULL)
872875   {
873      if (intf->clock <= 0)
876      if (device->clock <= 0)
874877      {
875878         mame_printf_error("%s: %s has an mc6845 with an invalid clock\n", driver->source_file, driver->name);
876879         error = TRUE;
r3957r3958
913916      case DEVINFO_FCT_VALIDITY_CHECK:            info->validity_check = DEVICE_VALIDITY_CHECK_NAME(mc6845); break;
914917
915918      /* --- the following bits of info are returned as NULL-terminated strings --- */
916      case DEVINFO_STR_NAME:                     info->s = "Motorola 6845";               break;
917      case DEVINFO_STR_FAMILY:                  info->s = "MC6845 CRTC";               break;
918      case DEVINFO_STR_VERSION:                  info->s = "1.61";                     break;
919      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
920      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
919      case DEVINFO_STR_NAME:                     strcpy(info->s, "Motorola 6845");         break;
920      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MC6845 CRTC");            break;
921      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.61");               break;
922      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
923      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
921924   }
922925}
923926
r3957r3958
927930   switch (state)
928931   {
929932      /* --- the following bits of info are returned as NULL-terminated strings --- */
930      case DEVINFO_STR_NAME:                     info->s = "Motorla 6845-1";               break;
933      case DEVINFO_STR_NAME:                     strcpy(info->s, "Motorla 6845-1");         break;
931934
932935      /* --- the following bits of info are returned as pointers to data or functions --- */
933936      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mc6845_1);   break;
r3957r3958
942945   switch (state)
943946   {
944947      /* --- the following bits of info are returned as NULL-terminated strings --- */
945      case DEVINFO_STR_NAME:                     info->s = "MOS Technology 6545-1";         break;
948      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS Technology 6545-1");   break;
946949
947950      /* --- the following bits of info are returned as pointers to data or functions --- */
948951      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(c6545_1);   break;
r3957r3958
957960   switch (state)
958961   {
959962      /* --- the following bits of info are returned as NULL-terminated strings --- */
960      case DEVINFO_STR_NAME:                     info->s = "Rockwell 6545-1";            break;
963      case DEVINFO_STR_NAME:                     strcpy(info->s, "Rockwell 6545-1");         break;
961964
962965      /* --- the following bits of info are returned as pointers to data or functions --- */
963966      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(r6545_1);   break;
r3957r3958
972975   switch (state)
973976   {
974977      /* --- the following bits of info are returned as NULL-terminated strings --- */
975      case DEVINFO_STR_NAME:                     info->s = "Hitachi 46505";               break;
978      case DEVINFO_STR_NAME:                     strcpy(info->s, "Hitachi 46505");         break;
976979
977980      /* --- the following bits of info are returned as pointers to data or functions --- */
978981      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(h46505);   break;
r3957r3958
987990   switch (state)
988991   {
989992      /* --- the following bits of info are returned as NULL-terminated strings --- */
990      case DEVINFO_STR_NAME:                     info->s = "Hitachi 6845";               break;
993      case DEVINFO_STR_NAME:                     strcpy(info->s, "Hitachi 6845");         break;
991994
992995      /* --- the following bits of info are returned as pointers to data or functions --- */
993996      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(hd6845);   break;
r3957r3958
10021005   switch (state)
10031006   {
10041007      /* --- the following bits of info are returned as NULL-terminated strings --- */
1005      case DEVINFO_STR_NAME:                     info->s = "Synertek 6545-1";            break;
1008      case DEVINFO_STR_NAME:                     strcpy(info->s, "Synertek 6545-1");         break;
10061009
10071010      /* --- the following bits of info are returned as pointers to data or functions --- */
10081011      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(sy6545_1);   break;
src/emu/video/poly.h
r3957r3958
102102/* ----- initialization/teardown ----- */
103103
104104/* allocate a new poly manager that can render triangles */
105poly_manager *poly_alloc(int max_polys, size_t extra_data_size, UINT8 flags);
105poly_manager *poly_alloc(running_machine *machine, int max_polys, size_t extra_data_size, UINT8 flags);
106106
107107/* free a poly manager */
108108void poly_free(poly_manager *poly);
src/emu/video/mc6845.h
r3957r3958
2020#define SY6545_1    DEVICE_GET_INFO_NAME(sy6545_1)
2121
2222
23#define MDRV_MC6845_ADD(_tag, _variant, _clock, _config) \
24   MDRV_DEVICE_ADD(_tag, _variant, _clock) \
25   MDRV_DEVICE_CONFIG(_config)
26
27#define MDRV_MC6845_REMOVE(_tag, _variant) \
28   MDRV_DEVICE_REMOVE(_tag, _variant)
29
30
31
2332/* callback definitions */
2433typedef void * (*mc6845_begin_update_func)(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
2534#define MC6845_BEGIN_UPDATE(name)   void *name(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
r3957r3958
5160struct _mc6845_interface
5261{
5362   const char *screen_tag;      /* screen we are acting on */
54   int clock;               /* the clock (pin 21) of the chip */
5563   int hpixels_per_column;      /* number of pixels per video memory address */
5664
5765   /* if specified, this gets called before any pixel update,
r3957r3958
8492   mc6845_on_update_addr_changed_func   on_update_addr_changed;
8593};
8694
95extern mc6845_interface mc6845_null_interface;
8796
97
8898/* device interface */
8999DEVICE_GET_INFO( mc6845 );
90100DEVICE_GET_INFO( mc6845_1 );
src/emu/info.c
r3957r3958
569569
570570static void print_game_chips(FILE *out, const game_driver *game, const machine_config *config)
571571{
572   const device_config *device;
572573   int chipnum;
573574
574575   /* iterate over CPUs */
575   for (chipnum = 0; chipnum < ARRAY_LENGTH(config->cpu); chipnum++)
576      if (config->cpu[chipnum].type != CPU_DUMMY)
577      {
578         fprintf(out, "\t\t<chip");
579         fprintf(out, " type=\"cpu\"");
580         fprintf(out, " tag=\"%s\"", xml_normalize_string(config->cpu[chipnum].tag));
581         fprintf(out, " name=\"%s\"", xml_normalize_string(cputype_get_name(config->cpu[chipnum].type)));
582         fprintf(out, " clock=\"%d\"", config->cpu[chipnum].clock);
583         fprintf(out, "/>\n");
584      }
576   for (device = cpu_first(config); device != NULL; device = cpu_next(device))
577   {
578      fprintf(out, "\t\t<chip");
579      fprintf(out, " type=\"cpu\"");
580      fprintf(out, " tag=\"%s\"", xml_normalize_string(device->tag));
581      fprintf(out, " name=\"%s\"", xml_normalize_string(device_get_name(device)));
582      fprintf(out, " clock=\"%d\"", device->clock);
583      fprintf(out, "/>\n");
584   }
585585
586586   /* iterate over sound chips */
587587   for (chipnum = 0; chipnum < ARRAY_LENGTH(config->sound); chipnum++)
src/emu/deprecat.h
r3957r3958
2121
2222/*************************************
2323 *
24 *  Global access to the currently
25 *  executing machine.
26 *
27 *  Please investigate if it is
28 *  possible to use a passed in
29 *  'machine' argument.
30 *
31 *************************************/
32
33extern running_machine *Machine;
34
35
36
37/*************************************
38 *
3924 *  Old way of allowing "VBLANK"
4025 *  interrupts to fire more than once
4126 *  a frame.
r3957r3958
4934 *************************************/
5035
5136#define MDRV_CPU_VBLANK_INT_HACK(_func, _rate) \
52   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_VBLANK_INT_HACK, 8, _rate, 24), \
53   TOKEN_PTR(interrupt, _func),
37   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt, _func) \
38   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt_screen, NULL) \
39   MDRV_DEVICE_CONFIG_DATA32(cpu_config, vblank_interrupts_per_frame, _rate)
5440
5541
5642
src/emu/video.c
r3957r3958
326326   global.frameskip_level = options_get_int(mame_options(), OPTION_FRAMESKIP);
327327   global.seconds_to_run = options_get_int(mame_options(), OPTION_SECONDS_TO_RUN);
328328
329   /* set the first screen device as the primary - this will set NULL if screenless */
330   machine->primary_screen = video_screen_first(machine->config);
331
332329   /* create spriteram buffers if necessary */
333330   if (machine->config->video_attributes & VIDEO_BUFFERS_SPRITERAM)
334331      init_buffered_spriteram(machine);
r3957r3958
11101107
11111108   /* a lot of modules want to the period of the primary screen, so
11121109       if we are screenless, return something reasonable so that we don't fall over */
1113   if (screen == NULL || video_screen_count(screen->machine->config) == 0)
1110   if (screen == NULL || !screen->started || video_screen_count(screen->machine->config) == 0)
11141111   {
11151112      ret = DEFAULT_FRAME_PERIOD;
11161113   }
r3957r3958
13371334      case DEVINFO_FCT_RESET:               /* Nothing */                     break;
13381335
13391336      /* --- the following bits of info are returned as NULL-terminated strings --- */
1340      case DEVINFO_STR_NAME:               info->s = "Raster";                  break;
1341      case DEVINFO_STR_FAMILY:            info->s = "Video Screen";            break;
1342      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
1343      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
1344      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1337      case DEVINFO_STR_NAME:               strcpy(info->s, "Raster");            break;
1338      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Video Screen");      break;
1339      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
1340      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
1341      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
13451342   }
13461343}
13471344
src/emu/memory.c
r3957r3958
750750    address map for a CPU's address space
751751-------------------------------------------------*/
752752
753address_map *address_map_alloc(const machine_config *config, const game_driver *driver, int cpunum, int spacenum)
753address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum)
754754{
755   const char *cputag = config->cpu[cpunum].tag;
756   int cputype = config->cpu[cpunum].type;
757   const addrmap_token *internal_map = (const addrmap_token *)cputype_get_info_ptr(cputype, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
755   const cpu_config *cpuconfig = device->inline_config;
756   const addrmap_token *internal_map;
758757   address_map *map;
759758
760759   map = malloc_or_die(sizeof(*map));
761760   memset(map, 0, sizeof(*map));
762761
763762   /* append the internal CPU map (first so it takes priority) */
763   internal_map = (const addrmap_token *)device_get_info_ptr(device, CPUINFO_PTR_INTERNAL_MEMORY_MAP + spacenum);
764764   if (internal_map != NULL)
765      map_detokenize(map, driver, cputag, internal_map);
765      map_detokenize(map, driver, device->tag, internal_map);
766766
767767   /* construct the standard map */
768   if (config->cpu[cpunum].address_map[spacenum][0] != NULL)
769      map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][0]);
770   if (config->cpu[cpunum].address_map[spacenum][1] != NULL)
771      map_detokenize(map, driver, cputag, config->cpu[cpunum].address_map[spacenum][1]);
768   if (cpuconfig->address_map[spacenum] != NULL)
769      map_detokenize(map, driver, device->tag, cpuconfig->address_map[spacenum]);
770   if (cpuconfig->address_map2[spacenum] != NULL)
771      map_detokenize(map, driver, device->tag, cpuconfig->address_map2[spacenum]);
772772
773773   return map;
774774}
r3957r3958
13281328
13291329int memory_address_physical(const address_space *space, int intention, offs_t *address)
13301330{
1331   cpu_class_header *classheader = space->cpu->classtoken;
1331   cpu_class_header *classheader = cpu_get_class_header(space->cpu);
13321332   if (classheader->translate != NULL)
13331333      return (*classheader->translate)(space->cpu, space->spacenum, intention, address);
13341334   else
r3957r3958
14741474
14751475static void memory_init_spaces(running_machine *machine)
14761476{
1477   const machine_config *config = machine->config;
14781477   memory_private *memdata = machine->memory_data;
14791478   address_space **nextptr = (address_space **)&memdata->spacelist;
1480   int cpunum, spacenum;
1479   const device_config *device;
1480   int spacenum;
14811481
14821482   /* create a global watchpoint-filled table */
14831483   memdata->wptable = auto_malloc(1 << LEVEL1_BITS);
14841484   memset(memdata->wptable, STATIC_WATCHPOINT, 1 << LEVEL1_BITS);
14851485
14861486   /* loop over CPUs */
1487   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1488      if (machine->cpu[cpunum] != NULL)
1489      {
1490         cpu_type cputype = config->cpu[cpunum].type;
1487   for (device = machine->cpu[0]; device != NULL; device = device->typenext)
1488      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1489         if (cpu_get_addrbus_width(device, spacenum) > 0)
1490         {
1491            address_space *space = malloc_or_die(sizeof(*space));
1492            int logbits = cpu_get_logaddr_width(device, spacenum);
1493            int ashift = cpu_get_addrbus_shift(device, spacenum);
1494            int abits = cpu_get_addrbus_width(device, spacenum);
1495            int dbits = cpu_get_databus_width(device, spacenum);
1496            int endianness = cpu_get_endianness(device);
1497            int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
1498            int entrynum;
14911499
1492         /* initialize each address space with an actual address bus */
1493         for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
1494            if (cputype_get_addrbus_width(cputype, spacenum) > 0)
1495            {
1496               address_space *space = malloc_or_die(sizeof(*space));
1497               int logbits = cputype_get_logaddr_width(cputype, spacenum);
1498               int ashift = cputype_get_addrbus_shift(cputype, spacenum);
1499               int abits = cputype_get_addrbus_width(cputype, spacenum);
1500               int dbits = cputype_get_databus_width(cputype, spacenum);
1501               int endianness = cputype_get_endianness(cputype);
1502               int accessorindex = (dbits == 8) ? 0 : (dbits == 16) ? 1 : (dbits == 32) ? 2 : 3;
1503               int entrynum;
1500            /* if logbits is 0, revert to abits */
1501            if (logbits == 0)
1502               logbits = abits;
15041503
1505               /* if logbits is 0, revert to abits */
1506               if (logbits == 0)
1507                  logbits = abits;
1504            /* determine the address and data bits */
1505            memset(space, 0, sizeof(*space));
1506            space->machine = machine;
1507            space->cpu = device;
1508            space->name = address_space_names[spacenum];
1509            space->accessors = memory_accessors[accessorindex][(endianness == ENDIANNESS_LITTLE) ? 0 : 1];
1510            space->addrmask = 0xffffffffUL >> (32 - abits);
1511            space->bytemask = (ashift < 0) ? ((space->addrmask << -ashift) | ((1 << -ashift) - 1)) : (space->addrmask >> ashift);
1512            space->logaddrmask = 0xffffffffUL >> (32 - logbits);
1513            space->logbytemask = (ashift < 0) ? ((space->logaddrmask << -ashift) | ((1 << -ashift) - 1)) : (space->logaddrmask >> ashift);
1514            space->spacenum = spacenum;
1515            space->endianness = endianness;
1516            space->ashift = ashift;
1517            space->pageshift = cpu_get_page_shift(device, spacenum);
1518            space->abits = abits;
1519            space->dbits = dbits;
1520            space->addrchars = (abits + 3) / 4;
1521            space->logaddrchars = (logbits + 3) / 4;
1522            space->log_unmap = TRUE;
15081523
1509               /* determine the address and data bits */
1510               memset(space, 0, sizeof(*space));
1511               space->machine = machine;
1512               space->cpu = machine->cpu[cpunum];
1513               space->name = address_space_names[spacenum];
1514               space->accessors = memory_accessors[accessorindex][(endianness == ENDIANNESS_LITTLE) ? 0 : 1];
1515               space->addrmask = 0xffffffffUL >> (32 - abits);
1516               space->bytemask = (ashift < 0) ? ((space->addrmask << -ashift) | ((1 << -ashift) - 1)) : (space->addrmask >> ashift);
1517               space->logaddrmask = 0xffffffffUL >> (32 - logbits);
1518               space->logbytemask = (ashift < 0) ? ((space->logaddrmask << -ashift) | ((1 << -ashift) - 1)) : (space->logaddrmask >> ashift);
1519               space->spacenum = spacenum;
1520               space->endianness = endianness;
1521               space->ashift = ashift;
1522               space->pageshift = cputype_get_page_shift(cputype, spacenum);
1523               space->abits = abits;
1524               space->dbits = dbits;
1525               space->addrchars = (abits + 3) / 4;
1526               space->logaddrchars = (logbits + 3) / 4;
1527               space->log_unmap = TRUE;
1524            /* allocate subtable information; we malloc this manually because it will be realloc'ed */
1525            space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
1526            memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
1527            space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
1528            memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
15281529
1529               /* allocate subtable information; we malloc this manually because it will be realloc'ed */
1530               space->read.subtable = auto_malloc(sizeof(*space->read.subtable) * SUBTABLE_COUNT);
1531               memset(space->read.subtable, 0, sizeof(*space->read.subtable) * SUBTABLE_COUNT);
1532               space->write.subtable = auto_malloc(sizeof(*space->write.subtable) * SUBTABLE_COUNT);
1533               memset(space->write.subtable, 0, sizeof(*space->write.subtable) * SUBTABLE_COUNT);
1530            /* allocate the handler table */
1531            space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
1532            memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
1533            space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
1534            memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
1535            for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
1536            {
1537               space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
1538               space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
1539            }
15341540
1535               /* allocate the handler table */
1536               space->read.handlers[0] = auto_malloc(sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
1537               memset(space->read.handlers[0], 0, sizeof(*space->read.handlers[0]) * ARRAY_LENGTH(space->read.handlers));
1538               space->write.handlers[0] = auto_malloc(sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
1539               memset(space->write.handlers[0], 0, sizeof(*space->write.handlers[0]) * ARRAY_LENGTH(space->write.handlers));
1540               for (entrynum = 1; entrynum < ARRAY_LENGTH(space->read.handlers); entrynum++)
1541               {
1542                  space->read.handlers[entrynum] = space->read.handlers[0] + entrynum;
1543                  space->write.handlers[entrynum] = space->write.handlers[0] + entrynum;
1544               }
1541            /* init the static handlers */
1542            for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
1543            {
1544               space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
1545               space->read.handlers[entrynum]->object = space;
1546               space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
1547               space->write.handlers[entrynum]->object = space;
1548            }
15451549
1546               /* init the static handlers */
1547               for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++)
1548               {
1549                  space->read.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 0, entrynum);
1550                  space->read.handlers[entrynum]->object = space;
1551                  space->write.handlers[entrynum]->handler.generic = get_static_handler(space->dbits, 1, entrynum);
1552                  space->write.handlers[entrynum]->object = space;
1553               }
1550            /* make sure we fix up the mask for the unmap and watchpoint handlers */
1551            space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
1552            space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
1553            space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
1554            space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
15541555
1555               /* make sure we fix up the mask for the unmap and watchpoint handlers */
1556               space->read.handlers[STATIC_UNMAP]->bytemask = ~0;
1557               space->write.handlers[STATIC_UNMAP]->bytemask = ~0;
1558               space->read.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
1559               space->write.handlers[STATIC_WATCHPOINT]->bytemask = ~0;
1556            /* allocate memory; these aren't auto-malloc'ed as we need to expand them */
1557            space->read.table = malloc_or_die(1 << LEVEL1_BITS);
1558            space->write.table = malloc_or_die(1 << LEVEL1_BITS);
15601559
1561               /* allocate memory; these aren't auto-malloc'ed as we need to expand them */
1562               space->read.table = malloc_or_die(1 << LEVEL1_BITS);
1563               space->write.table = malloc_or_die(1 << LEVEL1_BITS);
1560            /* initialize everything to unmapped */
1561            memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
1562            memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
15641563
1565               /* initialize everything to unmapped */
1566               memset(space->read.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
1567               memset(space->write.table, STATIC_UNMAP, 1 << LEVEL1_BITS);
1564            /* initialize the lookups */
1565            space->readlookup = space->read.table;
1566            space->writelookup = space->write.table;
15681567
1569               /* initialize the lookups */
1570               space->readlookup = space->read.table;
1571               space->writelookup = space->write.table;
1568            /* set the direct access information base */
1569            space->direct.raw = space->direct.decrypted = NULL;
1570            space->direct.mask = space->bytemask;
1571            space->direct.min = 1;
1572            space->direct.max = 0;
1573            space->direct.entry = STATIC_UNMAP;
1574            space->directupdate = NULL;
15721575
1573               /* set the direct access information base */
1574               space->direct.raw = space->direct.decrypted = NULL;
1575               space->direct.mask = space->bytemask;
1576               space->direct.min = 1;
1577               space->direct.max = 0;
1578               space->direct.entry = STATIC_UNMAP;
1579               space->directupdate = NULL;
1580
1581               /* link us in */
1582               *nextptr = space;
1583               nextptr = (address_space **)&space->next;
1584            }
1585      }
1576            /* link us in */
1577            *nextptr = space;
1578            nextptr = (address_space **)&space->next;
1579         }
15861580}
15871581
15881582
r3957r3958
16071601      int entrynum;
16081602
16091603      /* allocate the address map */
1610      space->map = address_map_alloc(machine->config, machine->gamedrv, cpu_get_index(space->cpu), space->spacenum);
1604      space->map = address_map_alloc(space->cpu, machine->gamedrv, space->spacenum);
16111605
16121606      /* extract global parameters specified by the map */
16131607      space->unmap = (space->map->unmapval == 0) ? 0 : ~0;
src/emu/video.h
r3957r3958
9696***************************************************************************/
9797
9898#define MDRV_SCREEN_ADD(_tag, _type) \
99   MDRV_DEVICE_ADD(_tag, VIDEO_SCREEN) \
99   MDRV_DEVICE_ADD(_tag, VIDEO_SCREEN, 0) \
100100   MDRV_DEVICE_CONFIG_DATA32(screen_config, type, SCREEN_TYPE_##_type)
101101
102102#define MDRV_SCREEN_REMOVE(_tag) \
src/emu/memory.h
r3957r3958
861861/* ----- address maps ----- */
862862
863863/* build and allocate an address map for a CPU's address space */
864address_map *address_map_alloc(const machine_config *drv, const game_driver *driver, int cpunum, int spacenum);
864address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum);
865865
866866/* release allocated memory for an address map */
867867void address_map_free(address_map *map);
src/emu/mame.c
r3957r3958
2525            - calls init_machine() [mame.c]
2626
2727            init_machine() [mame.c]
28                - calls cpuintrf_init() [cpuintrf.c] to determine which CPUs are available
2928                - calls sndintrf_init() [sndintrf.c] to determine which sound chips are available
3029                - calls fileio_init() [fileio.c] to initialize file I/O info
3130                - calls config_init() [config.c] to initialize configuration system
r3957r3958
182181***************************************************************************/
183182
184183/* the active machine */
185running_machine *Machine;
184static running_machine *Machine;
186185
187186/* the current options */
188187static core_options *mame_opts;
r3957r3958
216215static int parse_ini_file(core_options *options, const char *name);
217216
218217static running_machine *create_machine(const game_driver *driver);
219static void prepare_machine(running_machine *machine);
220218static void destroy_machine(running_machine *machine);
221219static void init_machine(running_machine *machine);
222220static TIMER_CALLBACK( soft_reset );
r3957r3958
241239
242240INLINE void eat_all_cpu_cycles(running_machine *machine)
243241{
244   int cpunum;
242   const device_config *cpu;
245243
246   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
247      if (machine->cpu[cpunum] != NULL)
248         cpu_eat_cycles(machine->cpu[cpunum], 1000000000);
244   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
245      cpu_eat_cycles(cpu, 1000000000);
249246}
250247
251248
r3957r3958
301298
302299      /* create the machine structure and driver */
303300      machine = create_machine(driver);
304      prepare_machine(machine);
305301      mame = machine->mame_data;
306302
307303      /* start in the "pre-init phase" */
r3957r3958
11481144
11491145void CLIB_DECL fatalerror(const char *text, ...)
11501146{
1147   extern running_machine *Machine;
11511148   running_machine *machine = Machine;
11521149   va_list arg;
11531150
r3957r3958
12061203
12071204void CLIB_DECL logerror(const char *format, ...)
12081205{
1206   extern running_machine *Machine;
12091207   running_machine *machine = Machine;
12101208
12111209   /* currently, we need a machine to do this */
r3957r3958
14041402   machine->basename = mame_strdup(driver->name);
14051403   machine->config = machine_config_alloc(driver->machine_config);
14061404
1407   /* temporary: create fake CPU devices */
1408   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1409      if (machine->config->cpu[cpunum].type != CPU_DUMMY)
1410         machine->cpu[cpunum] = cpuexec_create_cpu_device(&machine->config->cpu[cpunum]);
1411
14121405   /* allocate the driver data */
14131406   if (machine->config->driver_data_size != 0)
14141407   {
14151408      machine->driver_data = malloc(machine->config->driver_data_size);
14161409      if (machine->driver_data == NULL)
14171410         goto error;
1411      memset(machine->driver_data, 0, machine->config->driver_data_size);
14181412   }
1413
1414   /* find devices */
1415   machine->cpu[0] = cpu_first(machine->config);
1416   for (cpunum = 1; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum - 1] != NULL; cpunum++)
1417      machine->cpu[cpunum] = machine->cpu[cpunum - 1]->typenext;
1418   machine->primary_screen = video_screen_first(machine->config);
1419
1420   /* attach this machine to all the devices in the configuration */
1421   device_list_attach_machine(machine);
1422
1423   /* fetch core options */
1424   machine->sample_rate = options_get_int(mame_options(), OPTION_SAMPLERATE);
1425   machine->debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
1426
14191427   return machine;
14201428
14211429error:
r3957r3958
14321440
14331441
14341442/*-------------------------------------------------
1435    prepare_machine - reset the state of the
1436    machine object
1437-------------------------------------------------*/
1438
1439static void prepare_machine(running_machine *machine)
1440{
1441   /* reset most portions of the machine */
1442
1443   /* graphics layout */
1444   memset(machine->gfx, 0, sizeof(machine->gfx));
1445
1446   /* palette-related information */
1447   machine->pens = NULL;
1448   machine->shadow_table = NULL;
1449
1450   /* audio-related information */
1451   machine->sample_rate = options_get_int(mame_options(), OPTION_SAMPLERATE);
1452
1453   /* input-related information */
1454   machine->portconfig = NULL;
1455
1456   /* debugger-related information */
1457   machine->debug_flags = options_get_bool(mame_options(), OPTION_DEBUG) ? (DEBUG_FLAG_ENABLED | DEBUG_FLAG_CALL_HOOK) : 0;
1458
1459   /* reset the global MAME data and clear the other privates */
1460   memset(machine->mame_data, 0, sizeof(*machine->mame_data));
1461   machine->palette_data = NULL;
1462   machine->streams_data = NULL;
1463
1464   /* reset the driver data */
1465   if (machine->config->driver_data_size != 0)
1466      memset(machine->driver_data, 0, machine->config->driver_data_size);
1467}
1468
1469
1470
1471/*-------------------------------------------------
14721443    destroy_machine - free the machine data
14731444-------------------------------------------------*/
14741445
14751446static void destroy_machine(running_machine *machine)
14761447{
1477   int cpunum;
1478
14791448   assert(machine == Machine);
14801449
1481   /* temporary: free the fake CPU devices */
1482   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1483      if (machine->cpu[cpunum] != NULL)
1484         free((void *)machine->cpu[cpunum]);
1485
14861450   if (machine->driver_data != NULL)
14871451      free(machine->driver_data);
14881452   if (machine->config != NULL)
r3957r3958
15071471   time_t newbase;
15081472
15091473   /* initialize basic can't-fail systems here */
1510   cpuintrf_init(machine);
15111474   sndintrf_init(machine);
15121475   fileio_init(machine);
15131476   config_init(machine);
r3957r3958
15601523   mess_predevice_init(machine);
15611524#endif /* MESS */
15621525
1526   /* start up the devices */
1527   device_list_start(machine);
1528
15631529   /* call the game driver's init function */
15641530   /* this is where decryption is done and memory maps are altered */
15651531   /* so this location in the init order is important */
r3957r3958
15671533   if (machine->gamedrv->driver_init != NULL)
15681534      (*machine->gamedrv->driver_init)(machine);
15691535
1570   /* start up the devices */
1571   device_list_start(machine);
1572
15731536#ifdef MESS
15741537   /* second MESS initialization */
15751538   mess_postdevice_init(machine);
src/emu/inptport.c
r3957r3958
628628    buffer
629629-------------------------------------------------*/
630630
631INLINE void *error_buf_append(char *errorbuf, int errorbuflen, const char *format, ...)
631INLINE void* ATTR_PRINTF(3,4) error_buf_append(char *errorbuf, int errorbuflen, const char *format, ...)
632632{
633633   int curlen = (errorbuf != NULL) ? strlen(errorbuf) : 0;
634634   int bytesleft = errorbuflen - curlen;
src/emu/devintrf.c
r3957r3958
5050    a temporary string buffer
5151-------------------------------------------------*/
5252
53INLINE char *get_temp_string_buffer(void)
53char *get_temp_string_buffer(void)
5454{
5555   char *string = &temp_string_pool[temp_string_pool_index++ % TEMP_STRING_POOL_ENTRIES][0];
5656   string[0] = 0;
r3957r3958
8080    end of a device list
8181-------------------------------------------------*/
8282
83device_config *device_list_add(device_config **listheadptr, device_type type, const char *tag)
83device_config *device_list_add(device_config **listheadptr, const device_config *owner, device_type type, const char *tag, UINT32 clock)
8484{
85   device_config **devptr;
86   device_config *device;
85   device_config **devptr, **tempdevptr;
86   device_config *device, *tempdevice;
8787   UINT32 configlen;
88   deviceinfo info;
8988
9089   assert(listheadptr != NULL);
9190   assert(type != NULL);
r3957r3958
9493   /* find the end of the list, and ensure no duplicates along the way */
9594   for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
9695      if (type == (*devptr)->type && strcmp(tag, (*devptr)->tag) == 0)
97         fatalerror("Attempted to add duplicate device: type=%s tag=%s\n", devtype_get_name(type), tag);
96         fatalerror("Attempted to add duplicate device: type=%s tag=%s\n", device_get_name(*devptr), tag);
9897
9998   /* get the size of the inline config */
10099   configlen = (UINT32)devtype_get_info_int(type, DEVINFO_INT_INLINE_CONFIG_BYTES);
r3957r3958
102101   /* allocate a new device */
103102   device = malloc_or_die(sizeof(*device) + strlen(tag) + configlen);
104103
105   /* populate all fields */
104   /* populate device relationships */
106105   device->next = NULL;
106   device->owner = (device_config *)owner;
107   device->typenext = NULL;
108   device->classnext = NULL;
109
110   /* populate device properties */
107111   device->type = type;
108112   device->class = devtype_get_info_int(type, DEVINFO_INT_CLASS);
113   device->set_info = (device_set_info_func)devtype_get_info_fct(type, DEVINFO_FCT_SET_INFO);
114   device->execute = NULL;
115
116   /* populate device configuration */
117   device->clock = clock;
109118   device->static_config = NULL;
110119   device->inline_config = (configlen == 0) ? NULL : (device->tag + strlen(tag) + 1);
120
121   /* ensure live fields are all cleared */
122   device->machine = NULL;
111123   device->started = FALSE;
112124   device->token = NULL;
113   device->machine = NULL;
125   device->tokenbytes = 0;
114126   device->region = NULL;
115127   device->regionbytes = 0;
128
129   /* append the tag */
116130   strcpy(device->tag, tag);
117131
118132   /* reset the inline_config to 0 */
r3957r3958
120134      memset(device->inline_config, 0, configlen);
121135
122136   /* fetch function pointers to the core functions */
123   info.set_info = NULL;
124   (*type)(NULL, DEVINFO_FCT_SET_INFO, &info);
125   device->set_info = info.set_info;
126137
127   info.start = NULL;
128   (*type)(NULL, DEVINFO_FCT_START, &info);
129   device->start = info.start;
138   /* before adding us to the global list, add us to the end of the type list */
139   tempdevice = (device_config *)device_list_first(*listheadptr, type);
140   for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->typenext) ;
141   *tempdevptr = device;
130142
131   info.stop = NULL;
132   (*type)(NULL, DEVINFO_FCT_STOP, &info);
133   device->stop = info.stop;
143   /* and to the end of the class list */
144   tempdevice = (device_config *)device_list_class_first(*listheadptr, device->class);
145   for (tempdevptr = &tempdevice; *tempdevptr != NULL; tempdevptr = &(*tempdevptr)->classnext) ;
146   *tempdevptr = device;
134147
135   info.reset = NULL;
136   (*type)(NULL, DEVINFO_FCT_RESET, &info);
137   device->reset = info.reset;
138
139   info.nvram = NULL;
140   (*type)(NULL, DEVINFO_FCT_NVRAM, &info);
141   device->nvram = info.nvram;
142
143   /* link us to the end and return */
148   /* link us to the end of the master list and return */
144149   *devptr = device;
145150   return device;
146151}
r3957r3958
153158
154159void device_list_remove(device_config **listheadptr, device_type type, const char *tag)
155160{
156   device_config **devptr;
157   device_config *device;
161   device_config **devptr, **tempdevptr;
162   device_config *device, *tempdevice;
158163
159164   assert(listheadptr != NULL);
160165   assert(type != NULL);
r3957r3958
164169   for (devptr = listheadptr; *devptr != NULL; devptr = &(*devptr)->next)
165170      if (type == (*devptr)->type && strcmp(tag, (*devptr)->tag) == 0)
166171         break;
167   if (*devptr == NULL)
172   device = *devptr;
173   if (device == NULL)
168174      fatalerror("Attempted to remove non-existant device: type=%s tag=%s\n", devtype_get_name(type), tag);
169175
176   /* before removing us from the global list, remove us from the type list */
177   tempdevice = (device_config *)device_list_first(*listheadptr, type);
178   for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->typenext) ;
179   assert(*tempdevptr == device);
180   *tempdevptr = device->typenext;
181
182   /* and from the class list */
183   tempdevice = (device_config *)device_list_class_first(*listheadptr, device->class);
184   for (tempdevptr = &tempdevice; *tempdevptr != device; tempdevptr = &(*tempdevptr)->classnext) ;
185   assert(*tempdevptr == device);
186   *tempdevptr = device->classnext;
187
170188   /* remove the device from the list */
171   device = *devptr;
172189   *devptr = device->next;
173190
174191   /* free the device object */
r3957r3958
181198    the device's name and the given tag
182199-------------------------------------------------*/
183200
184const char *device_build_tag(astring *dest, const char *devicetag, const char *tag)
201const char *device_build_tag(astring *dest, const device_config *device, const char *tag)
185202{
186   if (devicetag != NULL)
203   if (device != NULL)
187204   {
188      astring_cpyc(dest, devicetag);
205      astring_cpyc(dest, device->tag);
189206      astring_catc(dest, ":");
190207      astring_catc(dest, tag);
191208   }
r3957r3958
230247   const device_config *curdev;
231248   int count = 0;
232249
233   assert(type != NULL);
234
235250   /* locate all devices */
236   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
237      count += device_matches_type(curdev, type);
251   if (type == DEVICE_TYPE_WILDCARD)
252   {
253      for (curdev = listhead; curdev != NULL; curdev = curdev->next)
254         count++;
255   }
238256
257   /* locate all devices of a given type */
258   else
259   {
260      for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
261      for ( ; curdev != NULL; curdev = curdev->typenext)
262         count++;
263   }
264
239265   return count;
240266}
241267
r3957r3958
250276{
251277   const device_config *curdev;
252278
253   /* scan forward starting with the list head */
254   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
255      if (device_matches_type(curdev, type))
256         return curdev;
279   /* first of any device type */
280   if (type == DEVICE_TYPE_WILDCARD)
281      return listhead;
257282
258   return NULL;
283   /* first of a given type */
284   for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
285   return curdev;
259286}
260287
261288
r3957r3958
267294
268295const device_config *device_list_next(const device_config *prevdevice, device_type type)
269296{
270   const device_config *curdev;
271
272297   assert(prevdevice != NULL);
273
274   /* scan forward starting with the item after the previous one */
275   for (curdev = prevdevice->next; curdev != NULL; curdev = curdev->next)
276      if (device_matches_type(curdev, type))
277         return curdev;
278
279   return NULL;
298   return (type == DEVICE_TYPE_WILDCARD) ? prevdevice->next : prevdevice->typenext;
280299}
281300
282301
283302/*-------------------------------------------------
284303    device_list_find_by_tag - retrieve a device
285    configuration based on a type and tag
304    configuration based on a type and tag;
305    DEVICE_TYPE_WILDCARD is allowed
286306-------------------------------------------------*/
287307
288308const device_config *device_list_find_by_tag(const device_config *listhead, device_type type, const char *tag)
r3957r3958
291311
292312   assert(tag != NULL);
293313
294   /* find the device in the list */
295   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
296      if (device_matches_type(curdev, type) && strcmp(tag, curdev->tag) == 0)
297         return curdev;
314   /* locate among all devices */
315   if (type == DEVICE_TYPE_WILDCARD)
316   {
317      for (curdev = listhead; curdev != NULL; curdev = curdev->next)
318         if (strcmp(tag, curdev->tag) == 0)
319            return curdev;
320   }
298321
322   /* locate among all devices of a given type */
323   else
324   {
325      for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
326      for ( ; curdev != NULL; curdev = curdev->typenext)
327         if (strcmp(tag, curdev->tag) == 0)
328            return curdev;
329   }
330
299331   /* fail */
300332   return NULL;
301333}
r3957r3958
312344   const device_config *curdev;
313345   int index = 0;
314346
315   assert(type != NULL);
316347   assert(tag != NULL);
317348
318   /* locate all devices */
319   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
320      if (device_matches_type(curdev, type))
349   /* locate among all devices */
350   if (type == DEVICE_TYPE_WILDCARD)
351   {
352      for (curdev = listhead; curdev != NULL; curdev = curdev->next)
321353      {
322354         if (strcmp(tag, curdev->tag) == 0)
323355            return index;
324356         index++;
325357      }
358   }
326359
360   /* locate among all devices of a given type */
361   else
362   {
363      for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
364      for ( ; curdev != NULL; curdev = curdev->typenext)
365      {
366         if (strcmp(tag, curdev->tag) == 0)
367            return index;
368         index++;
369      }
370   }
371
327372   return -1;
328373}
329374
r3957r3958
337382{
338383   const device_config *curdev;
339384
340   assert(type != NULL);
341   assert(index >= 0);
385   /* locate among all devices */
386   if (type == DEVICE_TYPE_WILDCARD)
387   {
388      for (curdev = listhead; curdev != NULL; curdev = curdev->next)
389         if (index-- == 0)
390            return curdev;
391   }
342392
343   /* find the device in the list */
344   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
345      if (device_matches_type(curdev, type) && index-- == 0)
346         return curdev;
393   /* locate among all devices of a given type */
394   else
395   {
396      for (curdev = listhead; curdev != NULL && curdev->type != type; curdev = curdev->next) ;
397      for ( ; curdev != NULL; curdev = curdev->typenext)
398         if (index-- == 0)
399            return curdev;
400   }
347401
348402   /* fail */
349403   return NULL;
r3957r3958
365419   const device_config *curdev;
366420   int count = 0;
367421
368   /* locate all devices */
369   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
370      count += (curdev->class == class);
422   /* locate all devices of a given class */
423   for (curdev = listhead; curdev != NULL && curdev->class != class; curdev = curdev->next) ;
424   for ( ; curdev != NULL; curdev = curdev->classnext)
425      count++;
371426
372427   return count;
373428}
r3957r3958
382437{
383438   const device_config *curdev;
384439
385   /* scan forward starting with the list head */
386   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
387      if (curdev->class == class)
388         return curdev;
389
390   return NULL;
440   /* first of a given class */
441   for (curdev = listhead; curdev != NULL && curdev->class != class; curdev = curdev->next) ;
442   return curdev;
391443}
392444
393445
r3957r3958
398450
399451const device_config *device_list_class_next(const device_config *prevdevice, device_class class)
400452{
401   const device_config *curdev;
402
403453   assert(prevdevice != NULL);
404
405   /* scan forward starting with the item after the previous one */
406   for (curdev = prevdevice->next; curdev != NULL; curdev = curdev->next)
407      if (curdev->class == class)
408         return curdev;
409
410   return NULL;
454   return prevdevice->classnext;
411455}
412456
413457
r3957r3958
422466
423467   assert(tag != NULL);
424468
425   /* find the device in the list */
426   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
427      if (curdev->class == class && strcmp(tag, curdev->tag) == 0)
469   /* locate among all devices of a given class */
470   for (curdev = listhead; curdev != NULL && curdev->class != class; curdev = curdev->next) ;
471   for ( ; curdev != NULL; curdev = curdev->classnext)
472      if (strcmp(tag, curdev->tag) == 0)
428473         return curdev;
429474
430475   /* fail */
r3957r3958
444489
445490   assert(tag != NULL);
446491
447   /* locate all devices */
448   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
449      if (curdev->class == class)
450      {
451         if (strcmp(tag, curdev->tag) == 0)
452            return index;
453         index++;
454      }
492   /* locate among all devices of a given class */
493   for (curdev = listhead; curdev != NULL && curdev->class != class; curdev = curdev->next) ;
494   for ( ; curdev != NULL; curdev = curdev->classnext)
495   {
496      if (strcmp(tag, curdev->tag) == 0)
497         return index;
498      index++;
499   }
455500
456501   return -1;
457502}
r3957r3958
467512{
468513   const device_config *curdev;
469514
470   assert(index >= 0);
471
472   /* find the device in the list */
473   for (curdev = listhead; curdev != NULL; curdev = curdev->next)
474      if (curdev->class == class && index-- == 0)
515   /* locate among all devices of a given class */
516   for (curdev = listhead; curdev != NULL && curdev->class != class; curdev = curdev->next) ;
517   for ( ; curdev != NULL; curdev = curdev->classnext)
518      if (index-- == 0)
475519         return curdev;
476520
477521   /* fail */
r3957r3958
485529***************************************************************************/
486530
487531/*-------------------------------------------------
532    device_list_attach_machine - "attach" a
533    running_machine to its list of devices
534-------------------------------------------------*/
535
536void device_list_attach_machine(running_machine *machine)
537{
538   device_config *device;
539
540   assert(machine != NULL);
541
542   /* iterate over devices and assign the machine to them */
543   for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
544      device->machine = machine;
545}
546
547
548/*-------------------------------------------------
488549    device_list_start - start the configured list
489550    of devices for a machine
490551-------------------------------------------------*/
r3957r3958
504565   /* iterate over devices and allocate memory for them */
505566   for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
506567   {
507      UINT32 tokenlen;
508
509568      assert(!device->started);
569      assert(device->machine == machine);
510570      assert(device->token == NULL);
511571      assert(device->type != NULL);
512      assert(device->start != NULL);
513572
514573      devcount++;
515574
516      /* get the size of the token data */
517      tokenlen = (UINT32)devtype_get_info_int(device->type, DEVINFO_INT_TOKEN_BYTES);
518      if (tokenlen == 0)
519         fatalerror("Device %s specifies a 0 token length!\n", devtype_get_name(device->type));
575      /* get the size of the token data; we do it directly because we can't call device_get_info_* with no token */
576      device->tokenbytes = device_get_info_int(device, DEVINFO_INT_TOKEN_BYTES);
577      if (device->tokenbytes == 0)
578         fatalerror("Device %s specifies a 0 token length!\n", device_get_name(device));
520579
521580      /* allocate memory for the token */
522      device->token = malloc_or_die(tokenlen);
523      memset(device->token, 0, tokenlen);
581      device->token = malloc_or_die(device->tokenbytes);
582      memset(device->token, 0, device->tokenbytes);
524583
525584      /* fill in the remaining runtime fields */
585      device->execute = (device_execute_func)device_get_info_fct(device, DEVINFO_FCT_EXECUTE);
526586      device->machine = machine;
527587      device->region = memory_region(machine, device->tag);
528588      device->regionbytes = memory_region_length(machine, device->tag);
r3957r3958
537597      /* iterate over devices and start them */
538598      for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
539599      {
540         if (!device->started && (*device->start)(device) == DEVICE_START_OK)
600         device_start_func start = (device_start_func)device_get_info_fct(device, DEVINFO_FCT_START);
601
602         assert(start != NULL);
603         if (!device->started && (*start)(device) == DEVICE_START_OK)
541604            device->started = TRUE;
542605         numstarted += device->started;
543606      }
r3957r3958
563626   /* iterate over devices and stop them */
564627   for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
565628   {
629      device_stop_func stop = (device_stop_func)device_get_info_fct(device, DEVINFO_FCT_STOP);
630
566631      assert(device->token != NULL);
567632      assert(device->type != NULL);
568633
569634      /* if we have a stop function, call it */
570      if (device->stop != NULL)
571         (*device->stop)(device);
635      if (stop != NULL)
636         (*stop)(device);
572637
573638      /* free allocated memory for the token */
574639      if (device->token != NULL)
r3957r3958
576641
577642      /* reset all runtime fields */
578643      device->token = NULL;
644      device->tokenbytes = 0;
579645      device->machine = NULL;
580646      device->region = NULL;
581647      device->regionbytes = 0;
r3957r3958
607673
608674void device_reset(const device_config *device)
609675{
676   device_reset_func reset;
677
610678   assert(device != NULL);
611679   assert(device->token != NULL);
612680   assert(device->type != NULL);
613681
614682   /* if we have a reset function, call it */
615   if (device->reset != NULL)
616      (*device->reset)(device);
683   reset = (device_reset_func)device_get_info_fct(device, DEVINFO_FCT_RESET);
684   if (reset != NULL)
685      (*reset)(device);
617686}
618687
619688
620void devtag_reset(running_machine *machine, device_type type, const char *tag)
689/*-------------------------------------------------
690    device_set_clock - change the clock on a
691    device
692-------------------------------------------------*/
693
694void device_set_clock(const device_config *device, UINT32 clock)
621695{
622   const device_config *device;
696   device_config *devicerw = (device_config *)device;
623697
624   assert(machine != NULL);
625   assert(type != NULL);
626   assert(tag != NULL);
627
628   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
629   if (device == NULL)
630      fatalerror("devtag_reset failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
631   device_reset(device);
698   /* not much for now */
699   devicerw->clock = clock;
632700}
633701
634702
r3957r3958
638706***************************************************************************/
639707
640708/*-------------------------------------------------
641    devtag_get_token - return the token associated
642    with an allocated device
643-------------------------------------------------*/
644
645void *devtag_get_token(running_machine *machine, device_type type, const char *tag)
646{
647   const device_config *device;
648
649   assert(machine != NULL);
650   assert(type != NULL);
651   assert(tag != NULL);
652
653   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
654   if (device == NULL)
655      fatalerror("devtag_get_token failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
656   return device->token;
657}
658
659
660/*-------------------------------------------------
661    devtag_get_device - return the device associated
662    with a tag
663-------------------------------------------------*/
664
665const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag)
666{
667   const device_config *device;
668
669   assert(machine != NULL);
670   assert(type != NULL);
671   assert(tag != NULL);
672
673   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
674   if (device == NULL)
675      fatalerror("devtag_get_device failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
676   return device;
677}
678
679
680/*-------------------------------------------------
681    devtag_get_static_config - return a pointer to
682    the static configuration for a device based on
683    type and tag
684-------------------------------------------------*/
685
686const void *devtag_get_static_config(running_machine *machine, device_type type, const char *tag)
687{
688   const device_config *device;
689
690   assert(machine != NULL);
691   assert(type != NULL);
692   assert(tag != NULL);
693
694   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
695   if (device == NULL)
696      fatalerror("devtag_get_static_config failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
697   return device->static_config;
698}
699
700
701/*-------------------------------------------------
702    devtag_get_inline_config - return a pointer to
703    the inline configuration for a device based on
704    type and tag
705-------------------------------------------------*/
706
707const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag)
708{
709   const device_config *device;
710
711   assert(machine != NULL);
712   assert(type != NULL);
713   assert(tag != NULL);
714
715   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
716   if (device == NULL)
717      fatalerror("devtag_get_inline_config failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
718   return device->inline_config;
719}
720
721
722/*-------------------------------------------------
723709    device_get_info_int - return an integer state
724710    value from an allocated device
725711-------------------------------------------------*/
r3957r3958
729715   deviceinfo info;
730716
731717   assert(device != NULL);
732   assert(device->token != NULL);
733718   assert(device->type != NULL);
734719   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
735720
r3957r3958
740725}
741726
742727
743INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state)
744{
745   const device_config *device;
746
747   assert(machine != NULL);
748   assert(type != NULL);
749   assert(tag != NULL);
750   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
751
752   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
753   if (device == NULL)
754      fatalerror("devtag_get_info_int failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
755   return device_get_info_int(device, state);
756}
757
758
759728/*-------------------------------------------------
760729    device_get_info_ptr - return a pointer state
761730    value from an allocated device
r3957r3958
776745}
777746
778747
779void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state)
780{
781   const device_config *device;
782
783   assert(machine != NULL);
784   assert(type != NULL);
785   assert(tag != NULL);
786   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
787
788   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
789   if (device == NULL)
790      fatalerror("devtag_get_info_ptr failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
791   return device_get_info_ptr(device, state);
792}
793
794
795748/*-------------------------------------------------
796749    device_get_info_fct - return a function
797750    pointer state value from an allocated device
r3957r3958
812765}
813766
814767
815genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state)
816{
817   const device_config *device;
818
819   assert(machine != NULL);
820   assert(type != NULL);
821   assert(tag != NULL);
822   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
823
824   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
825   if (device == NULL)
826      fatalerror("device_get_info_fct failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
827   return device_get_info_fct(device, state);
828}
829
830
831768/*-------------------------------------------------
832769    device_get_info_string - return a string value
833770    from an allocated device
r3957r3958
848785}
849786
850787
851const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state)
852{
853   const device_config *device;
854788
855   assert(machine != NULL);
856   assert(type != NULL);
857   assert(tag != NULL);
858   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
859
860   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
861   if (device == NULL)
862      fatalerror("device_get_info_string failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
863   return device_get_info_string(device, state);
864}
865
866
867
868789/***************************************************************************
869790    DEVICE TYPE INFORMATION SETTERS
870791***************************************************************************/
r3957r3958
890811
891812
892813/*-------------------------------------------------
814    devtype_get_info_int - return a function
815    pointer from a device type (does not need to
816    be allocated)
817-------------------------------------------------*/
818
819genf *devtype_get_info_fct(device_type type, UINT32 state)
820{
821   deviceinfo info;
822
823   assert(type != NULL);
824   assert(state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST);
825
826   /* retrieve the value */
827   info.f = 0;
828   (*type)(NULL, state, &info);
829   return info.f;
830}
831
832
833/*-------------------------------------------------
893834    devtype_get_info_string - return a string value
894835    from a device type (does not need to be
895836    allocated)
r3957r3958
934875}
935876
936877
937void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data)
938{
939   const device_config *device;
940
941   assert(machine != NULL);
942   assert(type != NULL);
943   assert(tag != NULL);
944   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
945
946   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
947   if (device == NULL)
948      fatalerror("devtag_set_info_int failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
949   device_set_info_int(device, state, data);
950}
951
952
953878/*-------------------------------------------------
954879    device_set_info_ptr - set a pointer state
955880    value for an allocated device
r3957r3958
970895}
971896
972897
973void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data)
974{
975   const device_config *device;
976
977   assert(machine != NULL);
978   assert(type != NULL);
979   assert(tag != NULL);
980   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
981
982   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
983   if (device == NULL)
984      fatalerror("devtag_set_info_ptr failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
985   device_set_info_ptr(device, state, data);
986}
987
988
989898/*-------------------------------------------------
990899    device_set_info_fct - set a function pointer
991900    state value for an allocated device
r3957r3958
1004913   info.f = data;
1005914   (*device->set_info)(device, state, &info);
1006915}
1007
1008
1009void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data)
1010{
1011   const device_config *device;
1012
1013   assert(machine != NULL);
1014   assert(type != NULL);
1015   assert(tag != NULL);
1016   assert(state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST);
1017
1018   device = device_list_find_by_tag(machine->config->devicelist, type, tag);
1019   if (device == NULL)
1020      fatalerror("devtag_set_info_fct failed to find device: type=%s tag=%s\n", devtype_get_name(type), tag);
1021   device_set_info_fct(device, state, data);
1022}
src/emu/machine/rtc65271.h
r3957r3958
44
55extern int rtc65271_file_load(running_machine *machine, mame_file *file);
66extern int rtc65271_file_save(mame_file *file);
7extern void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(int state));
7extern void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(running_machine *machine, int state));
88extern UINT8 rtc65271_r(int xramsel, offs_t offset);
99extern void rtc65271_w(int xramsel, offs_t offset, UINT8 data);
src/emu/machine/cr589.c
r3957r3958
44 */
55
66#include "driver.h"
7#include "deprecat.h"
87#include "cr589.h"
98
109typedef struct
r3957r3958
111110
112111static void cr589_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion )
113112{
114   running_machine *machine = Machine;
113   running_machine *machine = scsiInstance->machine;
115114   SCSICr589 *our_this = SCSIThis( &SCSIClassCr589, scsiInstance );
116115
117116   our_this->download = 0;
src/emu/machine/x76f100.c
r3957r3958
1010 */
1111
1212#include "driver.h"
13#include "deprecat.h"
1413#include "machine/x76f100.h"
1514
1615#define VERBOSE_LEVEL ( 0 )
r3957r3958
127126   state_save_register_item_pointer( machine, "x76f100", NULL, chip, c->data, SIZE_DATA );
128127}
129128
130void x76f100_cs_write( int chip, int cs )
129void x76f100_cs_write( running_machine *machine, int chip, int cs )
131130{
132   running_machine *machine = Machine;
133131   struct x76f100_chip *c;
134132
135133   if( chip >= X76F100_MAXCHIP )
r3957r3958
159157   c->cs = cs;
160158}
161159
162void x76f100_rst_write( int chip, int rst )
160void x76f100_rst_write( running_machine *machine, int chip, int rst )
163161{
164   running_machine *machine = Machine;
165162   struct x76f100_chip *c;
166163
167164   if( chip >= X76F100_MAXCHIP )
r3957r3958
219216   return ( block_offset * SIZE_WRITE_BUFFER ) + c->byte;
220217}
221218
222void x76f100_scl_write( int chip, int scl )
219void x76f100_scl_write( running_machine *machine, int chip, int scl )
223220{
224   running_machine *machine = Machine;
225221   struct x76f100_chip *c;
226222
227223   if( chip >= X76F100_MAXCHIP )
r3957r3958
385381   c->scl = scl;
386382}
387383
388void x76f100_sda_write( int chip, int sda )
384void x76f100_sda_write( running_machine *machine, int chip, int sda )
389385{
390   running_machine *machine = Machine;
391386   struct x76f100_chip *c;
392387
393388   if( chip >= X76F100_MAXCHIP )
r3957r3958
444439   c->sdaw = sda;
445440}
446441
447int x76f100_sda_read( int chip )
442int x76f100_sda_read( running_machine *machine, int chip )
448443{
449   running_machine *machine = Machine;
450444   struct x76f100_chip *c;
451445
452446   if( chip >= X76F100_MAXCHIP )
r3957r3958
466460   return c->sdar;
467461}
468462
469static void nvram_handler_x76f100( int chip, running_machine *machine, mame_file *file, int read_or_write )
463static void nvram_handler_x76f100( running_machine *machine, mame_file *file, int read_or_write, int chip )
470464{
471465   struct x76f100_chip *c;
472466
r3957r3958
492486   }
493487}
494488
495NVRAM_HANDLER( x76f100_0 ) { nvram_handler_x76f100( 0, machine, file, read_or_write ); }
496NVRAM_HANDLER( x76f100_1 ) { nvram_handler_x76f100( 1, machine, file, read_or_write ); }
489NVRAM_HANDLER( x76f100_0 ) { nvram_handler_x76f100( machine, file, read_or_write, 0 ); }
490NVRAM_HANDLER( x76f100_1 ) { nvram_handler_x76f100( machine, file, read_or_write, 1 ); }
src/emu/machine/timekpr.c
r3957r3958
285285static DEVICE_START(timekeeper)
286286{
287287   timekeeper_state *c = get_safe_token(device);
288   const timekeeper_config *config;
289288   emu_timer *timer;
290289   attotime duration;
291290   mame_system_time systime;
r3957r3958
311310   c->century = make_bcd( systime.local_time.year / 100 );
312311   c->data = auto_malloc( c->size );
313312
314   config = device->static_config;
315   if( config != NULL && config->data != NULL )
313   c->default_data = device->region;
314   if (c->default_data != NULL)
316315   {
317      c->default_data = memory_region( device->machine, config->data );
318      if( c->default_data != NULL )
319      {
320         assert( memory_region_length( device->machine, config->data ) == c->size );
321      }
316      assert( device->regionbytes == c->size );
322317   }
323318
324319   state_save_register_device_item( device, 0, c->control );
r3957r3958
486481      case DEVINFO_FCT_NVRAM:               info->nvram = DEVICE_NVRAM_NAME(timekeeper); break;
487482
488483      /* --- the following bits of info are returned as NULL-terminated strings --- */
489      case DEVINFO_STR_NAME:               info->s = "Timekeeper"; break;
490      case DEVINFO_STR_FAMILY:            info->s = "EEPROM"; break;
491      case DEVINFO_STR_VERSION:            info->s = "1.0"; break;
492      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__; break;
493      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
484      case DEVINFO_STR_NAME:               strcpy(info->s, "Timekeeper"); break;
485      case DEVINFO_STR_FAMILY:            strcpy(info->s, "EEPROM"); break;
486      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0"); break;
487      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__); break;
488      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
494489   }
495490}
496491
r3957r3958
499494   switch (state)
500495   {
501496      /* --- the following bits of info are returned as NULL-terminated strings --- */
502      case DEVINFO_STR_NAME:                     info->s = "M48T02";               break;
497      case DEVINFO_STR_NAME:                     strcpy(info->s, "M48T02");               break;
503498
504499      /* --- the following bits of info are returned as pointers to data or functions --- */
505500      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(m48t02);   break;
506501
507      default:                               DEVICE_GET_INFO_CALL(timekeeper);            break;
502      default:                               DEVICE_GET_INFO_CALL(timekeeper);         break;
508503   }
509504}
510505
r3957r3958
513508   switch (state)
514509   {
515510      /* --- the following bits of info are returned as NULL-terminated strings --- */
516      case DEVINFO_STR_NAME:                     info->s = "M48T35";               break;
511      case DEVINFO_STR_NAME:                     strcpy(info->s, "M48T35");               break;
517512
518513      /* --- the following bits of info are returned as pointers to data or functions --- */
519514      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(m48t35);   break;
520515
521      default:                               DEVICE_GET_INFO_CALL(timekeeper);            break;
516      default:                               DEVICE_GET_INFO_CALL(timekeeper);         break;
522517   }
523518}
524519
r3957r3958
527522   switch (state)
528523   {
529524      /* --- the following bits of info are returned as NULL-terminated strings --- */
530      case DEVINFO_STR_NAME:                     info->s = "M48T58";               break;
525      case DEVINFO_STR_NAME:                     strcpy(info->s, "M48T58");               break;
531526
532527      /* --- the following bits of info are returned as pointers to data or functions --- */
533528      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(m48t58);   break;
534529
535      default:                               DEVICE_GET_INFO_CALL(timekeeper);            break;
530      default:                               DEVICE_GET_INFO_CALL(timekeeper);         break;
536531   }
537532}
538533
r3957r3958
541536   switch (state)
542537   {
543538      /* --- the following bits of info are returned as NULL-terminated strings --- */
544      case DEVINFO_STR_NAME:                     info->s = "MK48T08";               break;
539      case DEVINFO_STR_NAME:                     strcpy(info->s, "MK48T08");               break;
545540
546541      /* --- the following bits of info are returned as pointers to data or functions --- */
547542      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mk48t08);   break;
548543
549      default:                               DEVICE_GET_INFO_CALL(timekeeper);            break;
544      default:                               DEVICE_GET_INFO_CALL(timekeeper);         break;
550545   }
551546}
src/emu/machine/scsihd.c
r3957r3958
1111#ifdef MESS
1212#include "devices/harddriv.h"
1313#endif
14#include "deprecat.h"
1514#include "scsihd.h"
1615
1716typedef struct
r3957r3958
225224
226225static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion )
227226{
228   running_machine *machine = Machine;
227   running_machine *machine = scsiInstance->machine;
229228   SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance );
230229
231230   our_this->lba = 0;
r3957r3958
236235
237236#ifdef MESS
238237   /* TODO: get rid of this ifdef MESS section */
239   our_this->disk = mess_hd_get_hard_disk_file( device_list_find_by_tag( Machine->config->devicelist, HARDDISK, diskregion ) );
238   our_this->disk = mess_hd_get_hard_disk_file( device_list_find_by_tag( machine->config->devicelist, HARDDISK, diskregion ) );
240239#else
241240   our_this->disk = hard_disk_open(get_disk_handle( diskregion ));
242241
src/emu/machine/6526cia.c
r3957r3958
6767{
6868   const device_config *device;
6969   void         (*irq_func)(const device_config *device, int state);
70   int            clock;
7170
7271   cia_port      port[2];
7372   cia_timer      timer[2];
r3957r3958
141140   /* clear out CIA structure, and copy the interface */
142141   memset(cia, 0, sizeof(*cia));
143142   cia->device = device;
144   cia->clock = (intf->clock != 0) ? intf->clock : cpu_get_clock(device->machine->cpu[0]);
145143   cia->irq_func = intf->irq_func;
146144
147145   /* setup ports */
r3957r3958
309307   /* update the timer count, if necessary */
310308   if ((new_count == -1) && is_timer_active(timer->timer))
311309   {
312      UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->clock));
310      UINT16 current_count = attotime_to_double(attotime_mul(timer_timeelapsed(timer->timer), timer->cia->device->clock));
313311      timer->count = timer->count - MIN(timer->count, current_count);
314312   }
315313
r3957r3958
321319   if ((timer->mode & 0x01) && ((timer->mode & (which ? 0x60 : 0x20)) == 0x00))
322320   {
323321      /* timer is on and is connected to clock */
324      attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->clock), (timer->count ? timer->count : 0x10000));
322      attotime period = attotime_mul(ATTOTIME_IN_HZ(timer->cia->device->clock), (timer->count ? timer->count : 0x10000));
325323      timer_adjust_oneshot(timer->timer, period, 0);
326324   }
327325   else
r3957r3958
856854      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cia);      break;
857855
858856      /* --- the following bits of info are returned as NULL-terminated strings --- */
859      case DEVINFO_STR_NAME:                     info->s = "6526 CIA rev1";               break;
860      case DEVINFO_STR_FAMILY:                  info->s = "6526 CIA";                  break;
861      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
862      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
857      case DEVINFO_STR_NAME:                     strcpy(info->s, "6526 CIA rev1");         break;
858      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "6526 CIA");            break;
859      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
860      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
863861      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
864862   }
865863}
r3957r3958
874872   switch (state)
875873   {
876874      /* --- the following bits of info are returned as NULL-terminated strings --- */
877      case DEVINFO_STR_NAME:                     info->s = "6526 CIA rev2";               break;
875      case DEVINFO_STR_NAME:                     strcpy(info->s, "6526 CIA rev2");         break;
878876      default:   DEVICE_GET_INFO_CALL(cia6526r1);   break;
879877   }
880878}
r3957r3958
889887   switch (state)
890888   {
891889      /* --- the following bits of info are returned as NULL-terminated strings --- */
892      case DEVINFO_STR_NAME:                     info->s = "8520 CIA";                  break;
890      case DEVINFO_STR_NAME:                     strcpy(info->s, "8520 CIA");            break;
893891      default:   DEVICE_GET_INFO_CALL(cia6526r1);   break;
894892   }
895893}
src/emu/machine/x76f100.h
r3957r3958
1010#define X76F100_MAXCHIP ( 2 )
1111
1212extern void x76f100_init( running_machine *machine, int chip, UINT8 *data );
13extern void x76f100_cs_write( int chip, int cs );
14extern void x76f100_rst_write( int chip, int rst );
15extern void x76f100_scl_write( int chip, int scl );
16extern void x76f100_sda_write( int chip, int sda );
17extern int x76f100_sda_read( int chip );
13extern void x76f100_cs_write( running_machine *machine, int chip, int cs );
14extern void x76f100_rst_write( running_machine *machine, int chip, int rst );
15extern void x76f100_scl_write( running_machine *machine, int chip, int scl );
16extern void x76f100_sda_write( running_machine *machine, int chip, int sda );
17extern int x76f100_sda_read( running_machine *machine, int chip );
1818extern NVRAM_HANDLER( x76f100_0 );
1919extern NVRAM_HANDLER( x76f100_1 );
2020
src/emu/machine/timekpr.h
r3957r3958
2121#define M48T02 DEVICE_GET_INFO_NAME(m48t02)
2222DEVICE_GET_INFO(m48t02);
2323
24#define MDRV_M48T02_ADD(_tag) \
25   MDRV_DEVICE_ADD(_tag, M48T02, 0)
26
27#define MDRV_M48T02_REMOVE(_tag) \
28   MDRV_DEVICE_REMOVE(_tag, M48T02)
29
30
2431#define M48T35 DEVICE_GET_INFO_NAME(m48t35)
2532DEVICE_GET_INFO(m48t35);
2633
34#define MDRV_M48T35_ADD(_tag) \
35   MDRV_DEVICE_ADD(_tag, M48T35, 0)
36
37#define MDRV_M48T35_REMOVE(_tag) \
38   MDRV_DEVICE_REMOVE(_tag, M48T35)
39
40
2741#define M48T58 DEVICE_GET_INFO_NAME(m48t58)
2842DEVICE_GET_INFO(m48t58);
2943
44#define MDRV_M48T58_ADD(_tag) \
45   MDRV_DEVICE_ADD(_tag, M48T58, 0)
46
47#define MDRV_M48T58_REMOVE(_tag) \
48   MDRV_DEVICE_REMOVE(_tag, M48T58)
49
50
3051#define MK48T08 DEVICE_GET_INFO_NAME(mk48t08)
3152DEVICE_GET_INFO(mk48t08);
3253
54#define MDRV_MK48T08_ADD(_tag) \
55   MDRV_DEVICE_ADD(_tag, MK48T08, 0)
56
57#define MDRV_MK48T08_REMOVE(_tag) \
58   MDRV_DEVICE_REMOVE(_tag, MK48T08)
59
60
3361/* memory handlers */
3462
3563WRITE8_DEVICE_HANDLER( timekeeper_w );
src/emu/machine/74123.c
r3957r3958
244244      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(ttl74123);         break;
245245
246246      /* --- the following bits of info are returned as NULL-terminated strings --- */
247      case DEVINFO_STR_NAME:                     info->s = "74123";                           break;
248      case DEVINFO_STR_FAMILY:                  info->s = "TTL";                           break;
249      case DEVINFO_STR_VERSION:                  info->s = "1.0";                           break;
250      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                           break;
251      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
247      case DEVINFO_STR_NAME:                     strcpy(info->s, "74123");                     break;
248      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "TTL");                        break;
249      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                        break;
250      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
251      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
252252   }
253253}
src/emu/machine/6526cia.h
r3957r3958
1919#define CIA6526R2      DEVICE_GET_INFO_NAME(cia6526r1)
2020#define CIA8520         DEVICE_GET_INFO_NAME(cia8520)
2121
22#define MDRV_CIA6526_ADD(_tag, _variant, _clock, _config) \
23   MDRV_DEVICE_ADD(_tag, _variant, _clock) \
24   MDRV_DEVICE_CONFIG(_config)
2225
26#define MDRV_CIA6526_REMOVE(_tag, _variant) \
27   MDRV_DEVICE_REMOVE(_tag, _variant)
28
29#define MDRV_CIA8520_ADD(_tag, _clock, _config) \
30   MDRV_DEVICE_ADD(_tag, CIA8520, _clock) \
31   MDRV_DEVICE_CONFIG(_config)
32
33#define MDRV_CIA8520_REMOVE(_tag) \
34   MDRV_DEVICE_REMOVE(_tag, CIA8520)
35
36
37
2338/***************************************************************************
2439    TYPE DEFINITIONS
2540***************************************************************************/
r3957r3958
2843struct _cia6526_interface
2944{
3045   void (*irq_func)(const device_config *device, int state);
31   int clock;
3246   int tod_clock;
3347
3448   struct
src/emu/machine/74123.h
r3957r3958
4848
4949#define TTL74123      DEVICE_GET_INFO_NAME(ttl74123)
5050
51#define MDRV_TTL74123_ADD(_tag, _config) \
52   MDRV_DEVICE_ADD(_tag, TTL74123, 0) \
53   MDRV_DEVICE_CONFIG(_config)
5154
55#define MDRV_TTL74123_REMOVE(_tag) \
56   MDRV_DEVICE_REMOVE(_tag, TTL74123)
57
58
5259/* constants for the different ways the cap/res can be connected.
5360   This determines the formula for calculating the pulse width */
5461#define TTL74123_NOT_GROUNDED_NO_DIODE      (1)
src/emu/machine/adc1213x.c
r3957r3958
2727   int output_shift_reg;
2828   int end_conv;
2929
30   double (*input_callback)(int input);
30   double (*input_callback)(running_machine *machine, int input);
3131} ADC1213X;
3232
3333static ADC1213X adc1213x[MAX_ADC1213X_CHIPS];
r3957r3958
5353   adc1213x[chip].data_in = state & 1;
5454}
5555
56static void adc1213x_convert(int chip, int channel, int bits16, int lsbfirst)
56static void adc1213x_convert(running_machine *machine, int chip, int channel, int bits16, int lsbfirst)
5757{
5858   int i;
5959   int bits;
r3957r3958
7070   {
7171      case 0x8:      // H L L L - CH0 (single-ended)
7272      {
73         input = adc1213x[chip].input_callback(0);
73         input = adc1213x[chip].input_callback(machine, 0);
7474         break;
7575      }
7676      case 0xc:      // H H L L - CH1 (single-ended)
7777      {
78         input = adc1213x[chip].input_callback(1);
78         input = adc1213x[chip].input_callback(machine, 1);
7979         break;
8080      }
8181      case 0x9:      // H L L H - CH2 (single-ended)
8282      {
83         input = adc1213x[chip].input_callback(2);
83         input = adc1213x[chip].input_callback(machine, 2);
8484         break;
8585      }
8686      case 0xd:      // H H L H - CH3 (single-ended)
8787      {
88         input = adc1213x[chip].input_callback(3);
88         input = adc1213x[chip].input_callback(machine, 3);
8989         break;
9090      }
9191      case 0xa:      // H L H L - CH4 (single-ended)
9292      {
93         input = adc1213x[chip].input_callback(4);
93         input = adc1213x[chip].input_callback(machine, 4);
9494         break;
9595      }
9696      case 0xe:      // H H H L - CH5 (single-ended)
9797      {
98         input = adc1213x[chip].input_callback(5);
98         input = adc1213x[chip].input_callback(machine, 5);
9999         break;
100100      }
101101      case 0xb:      // H L H H - CH6 (single-ended)
102102      {
103         input = adc1213x[chip].input_callback(6);
103         input = adc1213x[chip].input_callback(machine, 6);
104104         break;
105105      }
106106      case 0xf:      // H H H H - CH7 (single-ended)
107107      {
108         input = adc1213x[chip].input_callback(7);
108         input = adc1213x[chip].input_callback(machine, 7);
109109         break;
110110      }
111111      default:
r3957r3958
139139   adc1213x[chip].output_shift_reg >>= 1;
140140}
141141
142void adc1213x_cs_w(int chip, int state)
142void adc1213x_cs_w(running_machine *machine, int chip, int state)
143143{
144144   if (state)
145145   {
r3957r3958
153153         {
154154            case 0x0:      // X X X X L L L L - 12 or 13 Bit MSB First conversion
155155            {
156               adc1213x_convert(chip, (mode >> 4) & 0xf, 0, 0);
156               adc1213x_convert(machine, chip, (mode >> 4) & 0xf, 0, 0);
157157               break;
158158            }
159159            case 0x1:      // X X X X L L L H - 16 or 17 Bit MSB First conversion
160160            {
161               adc1213x_convert(chip, (mode >> 4) & 0xf, 1, 0);
161               adc1213x_convert(machine, chip, (mode >> 4) & 0xf, 1, 0);
162162               break;
163163            }
164164            case 0x4:      // X X X X L H L L - 12 or 13 Bit LSB First conversion
165165            {
166               adc1213x_convert(chip, (mode >> 4) & 0xf, 0, 1);
166               adc1213x_convert(machine, chip, (mode >> 4) & 0xf, 0, 1);
167167               break;
168168            }
169169            case 0x5:      // X X X X L H L H - 16 or 17 Bit LSB First conversion
170170            {
171               adc1213x_convert(chip, (mode >> 4) & 0xf, 1, 1);
171               adc1213x_convert(machine, chip, (mode >> 4) & 0xf, 1, 1);
172172               break;
173173            }
174174
r3957r3958
237237   return adc1213x[chip].end_conv;
238238}
239239
240void adc1213x_init(int chip, double (*input_callback)( int input ))
240void adc1213x_init(int chip, double (*input_callback)( running_machine *machine, int input ))
241241{
242242   memset(&adc1213x[chip], 0, sizeof(ADC1213X));
243243
src/emu/machine/idectrl.c
r3957r3958
18241824      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(ide_controller);break;
18251825
18261826      /* --- the following bits of info are returned as NULL-terminated strings --- */
1827      case DEVINFO_STR_NAME:               info->s = "IDE Controller";            break;
1828      case DEVINFO_STR_FAMILY:            info->s = "Disk Controller";         break;
1829      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
1830      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
1831      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1827      case DEVINFO_STR_NAME:               strcpy(info->s, "IDE Controller");      break;
1828      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Disk Controller");      break;
1829      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
1830      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
1831      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
18321832   }
18331833}
src/emu/machine/74148.c
r3957r3958
4747struct TTL74148
4848{
4949   /* callback */
50   void (*output_cb)(void);
50   void (*output_cb)(running_machine *machine);
5151
5252   /* inputs */
5353   int input_lines[8];   /* pins 1-4,10-13 */
r3957r3958
6767static struct TTL74148 chips[MAX_TTL74148];
6868
6969
70void TTL74148_update(int which)
70void TTL74148_update(running_machine *machine, int which)
7171{
7272   if (chips[which].enable_input)
7373   {
r3957r3958
131131      chips[which].last_output_valid = chips[which].output_valid;
132132      chips[which].last_enable_output = chips[which].enable_output;
133133
134      chips[which].output_cb();
134      chips[which].output_cb(machine);
135135   }
136136}
137137
src/emu/machine/6821pia.c
r3957r3958
55**********************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98#include "6821pia.h"
109
1110
r3957r3958
2423typedef struct _pia6821 pia6821;
2524struct _pia6821
2625{
26   running_machine *machine;
2727   const pia6821_interface *intf;
2828
2929   UINT8 in_a;
r3957r3958
125125   p = &pias[which];
126126   memset(p, 0, sizeof(pias[0]));
127127
128   p->machine = machine;
128129   p->intf = intf;
129130
130131   state_save_register_item(machine, "6821pia", NULL, which, p->in_a);
r3957r3958
176177   /* zap each structure, preserving the interface and swizzle */
177178   for (i = 0; i < MAX_PIA; i++)
178179   {
180      running_machine *machine = pias[i].machine;
179181      const pia6821_interface *intf = pias[i].intf;
180182
181183      if (intf == NULL)  continue;
182184
183185      memset(&pias[i], 0, sizeof(pias[i]));
184186
187      pias[i].machine = machine;
185188      pias[i].intf = intf;
186189
187190      /*
r3957r3958
195198      pias[i].in_ca2 = TRUE;
196199
197200      /* clear the IRQs */
198      if (intf->irq_a_func) (*intf->irq_a_func)(Machine, FALSE);
199      if (intf->irq_b_func) (*intf->irq_b_func)(Machine, FALSE);
201      if (intf->irq_a_func) (*intf->irq_a_func)(machine, FALSE);
202      if (intf->irq_b_func) (*intf->irq_b_func)(machine, FALSE);
200203   }
201204}
202205
r3957r3958
586589      default: /* impossible */
587590      case 0x00:
588591         if (OUTPUT_SELECTED(p->ctl_a))
589            ret = port_a_r(Machine, which);
592            ret = port_a_r(p->machine, which);
590593         else
591            ret = ddr_a_r(Machine, which);
594            ret = ddr_a_r(p->machine, which);
592595         break;
593596
594597      case 0x01:
595         ret = control_a_r(Machine, which);
598         ret = control_a_r(p->machine, which);
596599         break;
597600
598601      case 0x02:
599602         if (OUTPUT_SELECTED(p->ctl_b))
600            ret = port_b_r(Machine, which);
603            ret = port_b_r(p->machine, which);
601604         else
602            ret = ddr_b_r(Machine, which);
605            ret = ddr_b_r(p->machine, which);
603606         break;
604607
605608      case 0x03:
606         ret = control_b_r(Machine, which);
609         ret = control_b_r(p->machine, which);
607610         break;
608611   }
609612
r3957r3958
821824      default: /* impossible */
822825      case 0x00:
823826         if (OUTPUT_SELECTED(p->ctl_a))
824            port_a_w(Machine, which, data);
827            port_a_w(p->machine, which, data);
825828         else
826            ddr_a_w(Machine, which, data);
829            ddr_a_w(p->machine, which, data);
827830         break;
828831
829832      case 0x01:
830         control_a_w(Machine, which, data);
833         control_a_w(p->machine, which, data);
831834         break;
832835
833836      case 0x02:
834837         if (OUTPUT_SELECTED(p->ctl_b))
835            port_b_w(Machine, which, data);
838            port_b_w(p->machine, which, data);
836839         else
837            ddr_b_w(Machine, which, data);
840            ddr_b_w(p->machine, which, data);
838841         break;
839842
840843      case 0x03:
841         control_b_w(Machine, which, data);
844         control_b_w(p->machine, which, data);
842845         break;
843846   }
844847}
r3957r3958
893896
894897   p->out_a_needs_pulled = FALSE;
895898
896   return get_out_a_value(Machine, which);
899   return get_out_a_value(p->machine, which);
897900}
898901
899902
r3957r3958
931934      p->irq_a1 = TRUE;
932935
933936      /* update externals */
934      update_interrupts(Machine, p);
937      update_interrupts(p->machine, p);
935938
936939      /* CA2 is configured as output and in read strobe mode and cleared by a CA1 transition */
937940      if (C2_OUTPUT(p->ctl_a) && C2_STROBE_MODE(p->ctl_a) && STROBE_C1_RESET(p->ctl_a))
938         set_out_ca2(Machine, which, TRUE);
941         set_out_ca2(p->machine, which, TRUE);
939942   }
940943
941944   /* set the new value for CA1 */
r3957r3958
979982      p->irq_a2 = TRUE;
980983
981984      /* update externals */
982      update_interrupts(Machine, p);
985      update_interrupts(p->machine, p);
983986   }
984987
985988   /* set the new value for CA2 */
r3957r3958
10841087      p->irq_b1 = 1;
10851088
10861089      /* update externals */
1087      update_interrupts(Machine, p);
1090      update_interrupts(p->machine, p);
10881091
10891092      /* If CB2 is configured as a write-strobe output which is reset by a CB1
10901093           transition, this reset will only happen when a read from port B implicitly
r3957r3958
11331136      p->irq_b2 = 1;
11341137
11351138      /* update externals */
1136      update_interrupts(Machine, p);
1139      update_interrupts(p->machine, p);
11371140   }
11381141
11391142   /* set the new value for CA2 */
src/emu/machine/adc1213x.h
r3957r3958
99
1010int adc1213x_do_r(int chip);
1111void adc1213x_di_w(int chip, int state);
12void adc1213x_cs_w(int chip, int state);
12void adc1213x_cs_w(running_machine *machine, int chip, int state);
1313void adc1213x_sclk_w(int chip, int state);
1414void adc1213x_conv_w(int chip, int state);
1515int adc1213x_eoc_r(int chip);
16void adc1213x_init(int chip, double (*input_callback)( int input ));
16void adc1213x_init(int chip, double (*input_callback)( running_machine *machine, int input ));
1717
1818#endif
src/emu/machine/idectrl.h
r3957r3958
3838***************************************************************************/
3939
4040#define MDRV_IDE_CONTROLLER_ADD(_tag, _callback) \
41   MDRV_DEVICE_ADD(_tag, IDE_CONTROLLER) \
41   MDRV_DEVICE_ADD(_tag, IDE_CONTROLLER, 0) \
4242   MDRV_DEVICE_CONFIG_DATAPTR(ide_config, interrupt, _callback)
4343
4444#define MDRV_IDE_CONTROLLER_REGIONS(_master, _slave) \
src/emu/machine/74148.h
r3957r3958
4545/* The interface structure */
4646struct TTL74148_interface
4747{
48   void (*output_cb)(void);
48   void (*output_cb)(running_machine *machine);
4949};
5050
5151
5252void TTL74148_config(int which, const struct TTL74148_interface *intf);
5353
5454/* must call TTL74148_update() after setting the inputs */
55void TTL74148_update(int which);
55void TTL74148_update(running_machine *machine, int which);
5656
5757void TTL74148_input_line_w(int which, int input_line, int data);
5858void TTL74148_enable_input_w(int which, int data);
src/emu/machine/68681.c
r3957r3958
400400            case 0x07: /* Timer, CLK/16 */
401401               {
402402                  double hz;
403                  //attotime rate = attotime_mul(ATTOTIME_IN_HZ(duart68681->duart_config->frequency), 16*duart68681->CTR.w.l);
404                  attotime rate = ATTOTIME_IN_HZ(2*duart68681->duart_config->frequency/(2*16*16*duart68681->CTR.w.l));
403                  //attotime rate = attotime_mul(ATTOTIME_IN_HZ(duart68681->clock), 16*duart68681->CTR.w.l);
404                  attotime rate = ATTOTIME_IN_HZ(2*device->clock/(2*16*16*duart68681->CTR.w.l));
405405                  hz = ATTOSECONDS_TO_HZ(rate.attoseconds);
406406                  timer_adjust_periodic(duart68681->duart_timer, rate, 0, rate);
407407               }
r3957r3958
640640      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(duart68681);break;
641641
642642      /* --- the following bits of info are returned as NULL-terminated strings --- */
643      case DEVINFO_STR_NAME:               info->s = "DUART 68681";            break;
644      case DEVINFO_STR_FAMILY:            info->s = "DUART";                  break;
645      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
646      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
647      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
643      case DEVINFO_STR_NAME:               strcpy(info->s, "DUART 68681");         break;
644      case DEVINFO_STR_FAMILY:            strcpy(info->s, "DUART");            break;
645      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
646      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
647      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
648648   }
649649}
src/emu/machine/6532riot.c
r3957r3958
4949typedef struct _riot6532_state riot6532_state;
5050struct _riot6532_state
5151{
52   const device_config *device;
5253   const riot6532_interface *intf;
5354   int            index;
5455
r3957r3958
6364   UINT8         timershift;
6465   UINT8         timerstate;
6566   emu_timer *      timer;
66
67   UINT32         clock;
6867};
6968
7069
r3957r3958
147146
148147   /* if counting, return the number of ticks remaining */
149148   else if (riot->timerstate == TIMER_COUNTING)
150      return attotime_to_ticks(timer_timeleft(riot->timer), riot->clock) >> riot->timershift;
149      return attotime_to_ticks(timer_timeleft(riot->timer), riot->device->clock) >> riot->timershift;
151150
152151   /* if finishing, return the number of ticks without the shift */
153152   else
154      return attotime_to_ticks(timer_timeleft(riot->timer), riot->clock);
153      return attotime_to_ticks(timer_timeleft(riot->timer), riot->device->clock);
155154}
156155
157156
r3957r3958
176175   if (riot->timerstate == TIMER_COUNTING)
177176   {
178177      riot->timerstate = TIMER_FINISHING;
179      timer_adjust_oneshot(riot->timer, ticks_to_attotime(256, riot->clock), 0);
178      timer_adjust_oneshot(riot->timer, ticks_to_attotime(256, device->clock), 0);
180179
181180      /* signal timer IRQ as well */
182181      riot->irqstate |= TIMER_FLAG;
r3957r3958
228227
229228      /* update the timer */
230229      riot->timerstate = TIMER_COUNTING;
231      target = attotime_to_ticks(curtime, riot->clock) + 1 + (data << riot->timershift);
232      timer_adjust_oneshot(riot->timer, attotime_sub(ticks_to_attotime(target, riot->clock), curtime), 0);
230      target = attotime_to_ticks(curtime, device->clock) + 1 + (data << riot->timershift);
231      timer_adjust_oneshot(riot->timer, attotime_sub(ticks_to_attotime(target, device->clock), curtime), 0);
233232   }
234233
235234   /* if A4 == 0 and A2 == 1, we are writing to the edge detect control */
r3957r3958
426425
427426static DEVICE_START( riot6532 )
428427{
429   const riot6532_config *config = device->inline_config;
430428   riot6532_state *riot = get_safe_token(device);
431429
432430   /* validate arguments */
r3957r3958
435433   assert(strlen(device->tag) < 20);
436434
437435   /* set static values */
436   riot->device = device;
438437   riot->intf = device->static_config;
439438   riot->index = device_list_index(device->machine->config->devicelist, RIOT6532, device->tag);
440   riot->clock = config->clock;
441439
442440   /* configure the ports */
443441   riot->port[0].in_func = riot->intf->in_a_func;
r3957r3958
510508   {
511509      /* --- the following bits of info are returned as 64-bit signed integers --- */
512510      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(riot6532_state);      break;
513      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(riot6532_config);      break;
511      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                     break;
514512      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;      break;
515513
516514      /* --- the following bits of info are returned as pointers to data or functions --- */
r3957r3958
520518      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(riot6532);break;
521519
522520      /* --- the following bits of info are returned as NULL-terminated strings --- */
523      case DEVINFO_STR_NAME:                     info->s = "6532 (RIOT)";            break;
524      case DEVINFO_STR_FAMILY:                  info->s = "I/O devices";            break;
525      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
526      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
527      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
521      case DEVINFO_STR_NAME:                     strcpy(info->s, "6532 (RIOT)");         break;
522      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "I/O devices");         break;
523      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
524      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
525      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
528526   }
529527}
src/emu/machine/6522via.c
r3957r3958
8080
8181   emu_timer *shift_timer;
8282   UINT8 shift_counter;
83
84   int clock;
8583};
8684
8785
r3957r3958
184182}
185183
186184
187INLINE const via6522_inline_config *get_inline_config(const device_config *device)
188{
189   assert(device != NULL);
190   assert((device->type == VIA6522));
191   return (const via6522_inline_config *) device->inline_config;
192}
193
194
195185INLINE attotime v_cycles_to_time(const device_config *device, int c)
196186{
197   via6522_t *v = get_token(device);
198   return attotime_mul(ATTOTIME_IN_HZ(v->clock), c);
187   return attotime_mul(ATTOTIME_IN_HZ(device->clock), c);
199188}
200189
201190
202191INLINE UINT32 v_time_to_cycles(const device_config *device, attotime t)
203192{
204   via6522_t *v = get_token(device);
205   return attotime_to_double(attotime_mul(t, v->clock));
193   return attotime_to_double(attotime_mul(t, device->clock));
206194}
207195
208196
r3957r3958
231219static DEVICE_START( via6522 )
232220{
233221   via6522_t *v = get_token(device);
234   const via6522_inline_config *inline_config = get_inline_config(device);
235222
236223   memset(v, 0, sizeof(*v));
237224   v->t1ll = 0xf3; /* via at 0x9110 in vic20 show these values */
r3957r3958
244231   v->shift_timer = timer_alloc(device->machine, via_shift_callback, (void *) device);
245232
246233   /* Default clock is from CPU1 */
247   v->clock = (inline_config != NULL) && (inline_config->clck != 0)
248      ? inline_config->clck
249      : cpu_get_clock(device->machine->cpu[0]);
234   if (device->clock == 0)
235      device_set_clock(device, device->machine->cpu[0]->clock);
236
250237   return DEVICE_START_OK;
251238}
252239
r3957r3958
12221209   {
12231210      /* --- the following bits of info are returned as 64-bit signed integers --- */
12241211      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(via6522_t);            break;
1225      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(via6522_inline_config);   break;
1212      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
12261213      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
12271214
12281215      /* --- the following bits of info are returned as pointers to data or functions --- */
r3957r3958
12321219      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(via6522);   break;
12331220
12341221      /* --- the following bits of info are returned as NULL-terminated strings --- */
1235      case DEVINFO_STR_NAME:                     info->s = "6522 VIA";                  break;
1236      case DEVINFO_STR_FAMILY:                  info->s = "6522 VIA";                  break;
1237      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
1238      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
1222      case DEVINFO_STR_NAME:                     strcpy(info->s, "6522 VIA");            break;
1223      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "6522 VIA");            break;
1224      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
1225      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
12391226      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
12401227   }
12411228}
src/emu/machine/scsidev.c
r3957r3958
55***************************************************************************/
66
77#include "scsidev.h"
8#include "deprecat.h"
98
109typedef struct
1110{
r3957r3958
2827         return 0;
2928
3029      default:
31         logerror( "%s: SCSIDEV unknown command %02x\n", cpuexec_describe_context(Machine), command[ 0 ] );
30         logerror( "%s: SCSIDEV unknown command %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
3231         return 0;
3332   }
3433}
r3957r3958
4342   switch( command[ 0 ] )
4443   {
4544      default:
46         logerror( "%s: SCSIDEV unknown read %02x\n", cpuexec_describe_context(Machine), command[ 0 ] );
45         logerror( "%s: SCSIDEV unknown read %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
4746         break;
4847   }
4948}
r3957r3958
5857   switch( command[ 0 ] )
5958   {
6059      default:
61         logerror( "%s: SCSIDEV unknown write %02x\n", cpuexec_describe_context(Machine), command[ 0 ] );
60         logerror( "%s: SCSIDEV unknown write %02x\n", cpuexec_describe_context(scsiInstance->machine), command[ 0 ] );
6261         break;
6362   }
6463}
r3957r3958
10099
101100static void scsidev_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion )
102101{
103   running_machine *machine = Machine;
102   running_machine *machine = scsiInstance->machine;
104103   SCSIDev *our_this = SCSIThis( &SCSIClassDevice, scsiInstance );
105104
106105   state_save_register_item_array( machine, "scsidev", diskregion, 0, our_this->command );
r3957r3958
141140
142141      case SCSIOP_ALLOC_INSTANCE:
143142         params = ptrparm;
144         params->instance = SCSIMalloc( file );
143         params->instance = SCSIMalloc( params->machine, file );
145144         scsidev_alloc_instance( params->instance, params->diskregion );
146145         return 0;
147146
src/emu/machine/68681.h
r3957r3958
44typedef struct _duart68681_config duart68681_config;
55struct _duart68681_config
66{
7   int frequency;
87   void (*irq_handler)(const device_config *device, UINT8 vector);
98   void (*tx_callback)(const device_config *device, int channel, UINT8 data);
109   UINT8 (*input_port_read)(const device_config *device);
r3957r3958
1413#define DUART68681 DEVICE_GET_INFO_NAME(duart68681)
1514DEVICE_GET_INFO(duart68681);
1615
16#define MDRV_DUART68681_ADD(_tag, _clock, _config) \
17   MDRV_DEVICE_ADD(_tag, DUART68681, _clock) \
18   MDRV_DEVICE_CONFIG(_config)
19
20#define MDRV_DUART_68681_REMOVE(_tag) \
21   MDRV_DEVICE_REMOVE(_tag, DUART68681)
22
23
1724READ8_DEVICE_HANDLER(duart68681_r);
1825WRITE8_DEVICE_HANDLER(duart68681_w);
1926
src/emu/machine/6532riot.h
r3957r3958
1212    TYPE DEFINITIONS
1313***************************************************************************/
1414
15typedef struct _riot6532_config riot6532_config;
16struct _riot6532_config
17{
18   UINT32               clock;
19};
20
21
2215typedef UINT8 (*riot_read_func)(const device_config *device, UINT8 olddata);
2316typedef void (*riot_write_func)(const device_config *device, UINT8 newdata, UINT8 olddata);
2417typedef void (*riot_irq_func)(const device_config *device, int state);
r3957r3958
4134***************************************************************************/
4235
4336#define MDRV_RIOT6532_ADD(_tag, _clock, _intrf) \
44   MDRV_DEVICE_ADD(_tag, RIOT6532) \
45   MDRV_DEVICE_CONFIG_DATA32(riot6532_config, clock, _clock) \
37   MDRV_DEVICE_ADD(_tag, RIOT6532, _clock) \
4638   MDRV_DEVICE_CONFIG(_intrf)
4739
4840#define MDRV_RIOT6532_REMOVE(_tag) \
src/emu/machine/6522via.h
r3957r3958
2222#define VIA6522      DEVICE_GET_INFO_NAME(via6522)
2323
2424#define MDRV_VIA6522_ADD(_tag, _clock, _intrf) \
25   MDRV_DEVICE_ADD(_tag, VIA6522) \
26   MDRV_DEVICE_CONFIG_DATA32(via6522_inline_config, clck, _clock) \
25   MDRV_DEVICE_ADD(_tag, VIA6522, _clock) \
2726   MDRV_DEVICE_CONFIG(_intrf)
2827
2928#define MDRV_VIA6522_REMOVE(_tag) \
r3957r3958
6968   void (*irq_func)(const device_config *device, int state);
7069};
7170
72typedef struct _via6522_inline_config via6522_inline_config;
73struct _via6522_inline_config
74{
75   int clck;
76};
7771
78
7972/***************************************************************************
8073    PROTOTYPES
8174***************************************************************************/
src/emu/machine/7474.c
r3957r3958
4646struct TTL7474
4747{
4848   /* callback */
49   void (*output_cb)(void);
49   void (*output_cb)(running_machine *);
5050
5151   /* inputs */
5252   UINT8 clear;         /* pin 1/13 */
r3957r3958
6767static struct TTL7474 chips[MAX_TTL7474];
6868
6969
70void TTL7474_update(int which)
70void TTL7474_update(running_machine *machine, int which)
7171{
7272   if (!chips[which].preset && chips[which].clear)           /* line 1 in truth table */
7373   {
r3957r3958
101101      chips[which].last_output = chips[which].output;
102102      chips[which].last_output_comp = chips[which].output_comp;
103103
104      chips[which].output_cb();
104      chips[which].output_cb(machine);
105105   }
106106}
107107
src/emu/machine/scsicd.c
r3957r3958
1111#ifdef MESS
1212#include "devices/chd_cd.h"
1313#endif
14#include "deprecat.h"
1514#include "scsicd.h"
1615
1716typedef struct
r3957r3958
673672
674673static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskregion )
675674{
676   running_machine *machine = Machine;
675   running_machine *machine = scsiInstance->machine;
677676   SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance );
678677
679678   our_this->lba = 0;
r3957r3958
694693
695694#ifdef MESS
696695   /* TODO: get rid of this ifdef MESS section */
697   our_this->cdrom = mess_cd_get_cdrom_file( device_list_find_by_tag( Machine->config->devicelist, CDROM, diskregion ) );
696   our_this->cdrom = mess_cd_get_cdrom_file( device_list_find_by_tag( machine->config->devicelist, CDROM, diskregion ) );
698697#else
699698   our_this->cdrom = cdrom_open(get_disk_handle( diskregion ));
700699
src/emu/machine/7474.h
r3957r3958
4444/* The interface structure */
4545struct TTL7474_interface
4646{
47   void (*output_cb)(void);
47   void (*output_cb)(running_machine *machine);
4848};
4949
5050
5151void TTL7474_config(running_machine *machine, int which, const struct TTL7474_interface *intf);
5252
5353/* must call TTL7474_update() after setting the inputs */
54void TTL7474_update(int which);
54void TTL7474_update(running_machine *machine, int which);
5555
5656void TTL7474_clear_w(int which, int data);
5757void TTL7474_preset_w(int which, int data);
src/emu/machine/ldpr8210.c
r3957r3958
242242***************************************************************************/
243243
244244/*-------------------------------------------------
245    find_pr8210 - find our device; assumes there
246    is only one
247-------------------------------------------------*/
248
249INLINE laserdisc_state *find_pr8210(running_machine *machine)
250{
251   return ldcore_get_safe_token(device_list_first(machine->config->devicelist, LASERDISC));
252}
253
254
255/*-------------------------------------------------
256245    update_video_squelch - update the state of
257246    the video squelch
258247-------------------------------------------------*/
r3957r3958
360349   player->slowtrg = curtime;
361350
362351   /* find our CPU */
363   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device->tag, "pr8210"));
352   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device, "pr8210"));
364353   astring_free(tempstring);
365354
366355   /* we don't have the Simutrek player overrides */
r3957r3958
600589
601590static READ8_HANDLER( pr8210_pia_r )
602591{
603   laserdisc_state *ld = find_pr8210(space->machine);
592   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
604593   ldplayer_data *player = ld->player;
605594   UINT8 result = 0xff;
606595
r3957r3958
651640
652641static WRITE8_HANDLER( pr8210_pia_w )
653642{
654   laserdisc_state *ld = find_pr8210(space->machine);
643   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
655644   ldplayer_data *player = ld->player;
656645   UINT8 value;
657646
r3957r3958
735724       $02 = (in) FG via op-amp (spindle motor stop detector)
736725       $01 = (in) SLOW TIMER OUT
737726    */
738   laserdisc_state *ld = find_pr8210(space->machine);
727   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
739728   ldplayer_data *player = ld->player;
740729   slider_position sliderpos = ldcore_get_slider_position(ld);
741730   UINT8 focus_on = !(player->port1 & 0x08);
r3957r3958
783772       $02 = (out) SCAN A (/SCAN)
784773       $01 = (out) JUMP TRG (jump back trigger, clock on high->low)
785774    */
786   laserdisc_state *ld = find_pr8210(space->machine);
775   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
787776   ldplayer_data *player = ld->player;
788777   UINT8 prev = player->port1;
789778   int direction;
r3957r3958
845834       $02 = (out) ???
846835       $01 = (out) LASER ON
847836    */
848   laserdisc_state *ld = find_pr8210(space->machine);
837   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
849838   ldplayer_data *player = ld->player;
850839   UINT8 prev = player->port2;
851840
r3957r3958
873862static READ8_HANDLER( pr8210_t0_r )
874863{
875864   /* returns VSYNC state */
876   laserdisc_state *ld = find_pr8210(space->machine);
865   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
877866   return !ld->player->vsync;
878867}
879868
r3957r3958
10961085   player->simutrek.data_ready = 1;
10971086
10981087   /* find the Simutrek CPU */
1099   player->simutrek.cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device->tag, "simutrek"));
1088   player->simutrek.cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device, "simutrek"));
11001089   astring_free(tempstring);
11011090}
11021091
r3957r3958
12081197
12091198static READ8_HANDLER( simutrek_port2_r )
12101199{
1211   laserdisc_state *ld = find_pr8210(space->machine);
1200   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
12121201   ldplayer_data *player = ld->player;
12131202
12141203   /* bit $80 is the pr8210 video squelch */
r3957r3958
12231212
12241213static WRITE8_HANDLER( simutrek_port2_w )
12251214{
1226   laserdisc_state *ld = find_pr8210(space->machine);
1215   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
12271216   ldplayer_data *player = ld->player;
12281217   UINT8 prev = player->simutrek.port2;
12291218
r3957r3958
12621251
12631252static READ8_HANDLER( simutrek_data_r )
12641253{
1265   laserdisc_state *ld = find_pr8210(space->machine);
1254   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
12661255   ldplayer_data *player = ld->player;
12671256
12681257   /* acknowledge the read and clear the data ready flag */
r3957r3958
12791268static READ8_HANDLER( simutrek_t0_r )
12801269{
12811270   /* return 1 if data is waiting from main CPU */
1282   laserdisc_state *ld = find_pr8210(space->machine);
1271   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
12831272   return ld->player->simutrek.data_ready;
12841273}
src/emu/machine/ds2401.c
r3957r3958
88
99#include <stdarg.h>
1010#include "driver.h"
11#include "deprecat.h"
1211#include "state.h"
1312#include "machine/ds2401.h"
1413
r3957r3958
160159   c->reset_timer = timer_alloc(machine, ds2401_reset , NULL);
161160}
162161
163void ds2401_write( int which, int data )
162void ds2401_write( running_machine *machine, int which, int data )
164163{
165   running_machine *machine = Machine;
166164   struct ds2401_chip *c = &ds2401[ which ];
167165
168166   verboselog( machine, 1, "ds2401_write( %d, %d )\n", which, data );
r3957r3958
214212   c->rx = data;
215213}
216214
217int ds2401_read( int which )
215int ds2401_read( running_machine *machine, int which )
218216{
219217   struct ds2401_chip *c = &ds2401[ which ];
220218
221   verboselog( Machine, 2, "ds2401_read( %d ) %d\n", which, c->tx & c->rx );
219   verboselog( machine, 2, "ds2401_read( %d ) %d\n", which, c->tx & c->rx );
222220   return c->tx & c->rx;
223221}
224222
src/emu/machine/ds2401.h
r3957r3958
1212#define DS2401_MAXCHIP ( 3 )
1313
1414extern void ds2401_init( running_machine *machine, int which, const UINT8 *data );
15extern void ds2401_write( int which, int data );
16extern int ds2401_read( int which );
15extern void ds2401_write( running_machine *machine, int which, int data );
16extern int ds2401_read( running_machine *machine, int which );
1717
1818#endif
src/emu/machine/74153.c
r3957r3958
4141
4242struct TTL74153
4343{
44   running_machine *machine;
45
4446   /* callback */
45   void (*output_cb)(void);
47   void (*output_cb)(running_machine *machine);
4648
4749   /* inputs */
4850   int a;               /* pin 14 */
r3957r3958
8789      chips[which].last_output[0] = chips[which].output[0];
8890      chips[which].last_output[1] = chips[which].output[1];
8991
90      chips[which].output_cb();
92      chips[which].output_cb(chips[which].machine);
9193   }
9294}
9395
r3957r3958
123125
124126
125127
126void TTL74153_config(int which, const struct TTL74153_interface *intf)
128void TTL74153_config(running_machine *machine, int which, const struct TTL74153_interface *intf)
127129{
128130   if (which >= MAX_TTL74153)
129131   {
r3957r3958
132134   }
133135
134136
137   chips[which].machine = machine;
135138   chips[which].output_cb = (intf ? intf->output_cb : 0);
136139   chips[which].a = 1;
137140   chips[which].b = 1;
src/emu/machine/74153.h
r3957r3958
4040/* The interface structure */
4141struct TTL74153_interface
4242{
43   void (*output_cb)(void);
43   void (*output_cb)(running_machine *machine);
4444};
4545
4646
47void TTL74153_config(int which, const struct TTL74153_interface *intf);
47void TTL74153_config(running_machine *machine, int which, const struct TTL74153_interface *intf);
4848
4949/* must call TTL74153_update() after setting the inputs */
5050void TTL74153_update(int which);
src/emu/machine/am53cf96.c
r3957r3958
221221   // try to open the devices
222222   for (i = 0; i < interface->scsidevs->devs_present; i++)
223223   {
224      SCSIAllocInstance( interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
224      SCSIAllocInstance( machine, interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
225225   }
226226
227227   state_save_register_global_array(machine, scsi_regs);
src/emu/machine/z80dma.c
r3957r3958
242242   {
243243      z80dma->is_read = 1;
244244      z80dma->cur_cycle = (PORTA_IS_SOURCE(z80dma) ? PORTA_CYCLE_LEN(z80dma) : PORTB_CYCLE_LEN(z80dma));
245      next = ATTOTIME_IN_HZ(z80dma->intf->clockhz);
245      next = ATTOTIME_IN_HZ(device->clock);
246246      timer_adjust_periodic(z80dma->timer,
247247         attotime_zero,
248248         0,
r3957r3958
256256   }
257257
258258   /* set the halt line */
259   if (z80dma->intf && z80dma->intf->cpunum >= 0)
259   if (z80dma->intf && z80dma->intf->cputag != NULL)
260260   {
261261      //FIXME: Synchronization is done by BUSREQ!
262      cpu_set_input_line(device->machine->cpu[z80dma->intf->cpunum], INPUT_LINE_HALT,
262      cputag_set_input_line(device->machine, z80dma->intf->cputag, INPUT_LINE_HALT,
263263         pending_transfer ? ASSERT_LINE : CLEAR_LINE);
264264   }
265265}
r3957r3958
511511      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80dma_irq_reti;      break;
512512
513513      /* --- the following bits of info are returned as NULL-terminated strings --- */
514      case DEVINFO_STR_NAME:                     info->s = "Z80DMA";                  break;
515      case DEVINFO_STR_FAMILY:                  info->s = "DMA controllers";         break;
516      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
517      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
518      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
514      case DEVINFO_STR_NAME:                     strcpy(info->s, "Z80DMA");            break;
515      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "DMA controllers");      break;
516      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
517      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
518      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
519519   }
520520}
521521
src/emu/machine/z80dma.h
r3957r3958
99
1010#define Z80DMA DEVICE_GET_INFO_NAME(z80dma)
1111
12#define MDRV_Z80DMA_ADD(_tag, _clock, _config) \
13   MDRV_DEVICE_ADD(_tag, Z80DMA, _clock) \
14   MDRV_DEVICE_CONFIG(_config)
15
16#define MDRV_Z80DMA_REMOVE(_tag) \
17   MDRV_DEVICE_REMOVE(_tag, Z80DMA)
18
1219typedef struct _z80dma_interface z80dma_interface;
1320struct _z80dma_interface
1421{
1522   /* CPU to halt when DMA is active */
16   int cpunum;
23   const char *cputag;
1724
18   /* clock */
19   int clockhz;
20
2125   /* accessors to main memory */
2226   read8_device_func   memory_read;
2327   write8_device_func   memory_write;
src/emu/machine/8255ppi.c
r3957r3958
581581      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(ppi8255);   break;
582582
583583      /* --- the following bits of info are returned as NULL-terminated strings --- */
584      case DEVINFO_STR_NAME:                  info->s = "Intel PPI8255";               break;
585      case DEVINFO_STR_FAMILY:               info->s = "PPI8255";                  break;
586      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
587      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
588      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams"; break;
584      case DEVINFO_STR_NAME:                  strcpy(info->s, "Intel PPI8255");         break;
585      case DEVINFO_STR_FAMILY:               strcpy(info->s, "PPI8255");               break;
586      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
587      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
588      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MAME and MESS Teams"); break;
589589   }
590590}
591591
src/emu/machine/generic.c
r3957r3958
1010*********************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413#include "config.h"
1514#include "generic.h"
1615
r3957r3958
272271void nvram_load(running_machine *machine)
273272{
274273   mame_file *nvram_file = NULL;
275   device_config *device;
274   const device_config *device;
276275
277276   if (machine->config->nvram_handler != NULL)
278277   {
r3957r3958
280279      (*machine->config->nvram_handler)(machine, nvram_file, 0);
281280   }
282281
283   for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
282   for (device = machine->config->devicelist; device != NULL; device = device->next)
284283   {
285      if (device->nvram != NULL)
284      device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
285      if (nvram != NULL)
286286      {
287287         if (nvram_file == NULL)
288         {
289288            nvram_file = nvram_fopen(machine, OPEN_FLAG_READ);
290         }
291
292         (*device->nvram)(device, nvram_file, 0);
289         (*nvram)(device, nvram_file, 0);
293290      }
294291   }
295292
296293   if (nvram_file != NULL)
297   {
298294      mame_fclose(nvram_file);
299   }
300295}
301296
302297
r3957r3958
307302void nvram_save(running_machine *machine)
308303{
309304   mame_file *nvram_file = NULL;
310   device_config *device;
305   const device_config *device;
311306
312307   if (machine->config->nvram_handler != NULL)
313308   {
r3957r3958
315310      (*machine->config->nvram_handler)(machine, nvram_file, 1);
316311   }
317312
318   for (device = (device_config *)machine->config->devicelist; device != NULL; device = device->next)
313   for (device = machine->config->devicelist; device != NULL; device = device->next)
319314   {
320      if (device->nvram != NULL)
315      device_nvram_func nvram = (device_nvram_func)device_get_info_fct(device, DEVINFO_FCT_NVRAM);
316      if (nvram != NULL)
321317      {
322318         if (nvram_file == NULL)
323         {
324319            nvram_file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
325         }
326
327         (*device->nvram)(device, nvram_file, 1);
320         (*nvram)(device, nvram_file, 1);
328321      }
329322   }
330323
331324   if (nvram_file != NULL)
332   {
333325      mame_fclose(nvram_file);
334   }
335326}
336327
337328
r3957r3958
579570
580571static TIMER_CALLBACK( clear_all_lines )
581572{
582   int cpunum = param;
583   int inputcount = cpu_get_input_lines(machine->cpu[cpunum]);
573   const device_config *device = ptr;
574   int inputcount = cpu_get_input_lines(device);
584575   int line;
585576
586577   /* clear NMI and all inputs */
587   cpu_set_input_line(machine->cpu[cpunum], INPUT_LINE_NMI, CLEAR_LINE);
578   cpu_set_input_line(device, INPUT_LINE_NMI, CLEAR_LINE);
588579   for (line = 0; line < inputcount; line++)
589      cpu_set_input_line(machine->cpu[cpunum], line, CLEAR_LINE);
580      cpu_set_input_line(device, line, CLEAR_LINE);
590581}
591582
592583
r3957r3958
637628    disable value for global interrupts
638629-------------------------------------------------*/
639630
640void cpu_interrupt_enable(int cpunum, int enabled)
631void cpu_interrupt_enable(const device_config *device, int enabled)
641632{
642   assert_always(cpunum >= 0 && cpunum < ARRAY_LENGTH(Machine->cpu) && Machine->cpu[cpunum] != NULL, "cpu_interrupt_enable() called for invalid cpu num!");
633   int cpunum = cpu_get_index(device);
643634
635   assert_always(device != NULL, "cpu_interrupt_enable() called for invalid cpu!");
636
644637   /* set the new state */
645638   interrupt_enable[cpunum] = enabled;
646639
647640   /* make sure there are no queued interrupts */
648641   if (enabled == 0)
649      timer_call_after_resynch(Machine, NULL, cpunum, clear_all_lines);
642      timer_call_after_resynch(device->machine, (void *)device, 0, clear_all_lines);
650643}
651644
652645
r3957r3958
657650
658651WRITE8_HANDLER( interrupt_enable_w )
659652{
660   cpu_interrupt_enable(cpu_get_index(space->cpu), data);
653   cpu_interrupt_enable(space->cpu, data);
661654}
662655
663656
src/emu/machine/x76f041.c
r3957r3958
1212 */
1313
1414#include "driver.h"
15#include "deprecat.h"
1615#include "machine/x76f041.h"
1716
1817#define VERBOSE_LEVEL ( 0 )
r3957r3958
166165   state_save_register_item_pointer( machine, "x76f041", NULL, chip, c->data, SIZE_DATA );
167166}
168167
169void x76f041_cs_write( int chip, int cs )
168void x76f041_cs_write( running_machine *machine, int chip, int cs )
170169{
171   running_machine *machine = Machine;
172170   struct x76f041_chip *c;
173171
174172   if( chip >= X76F041_MAXCHIP )
r3957r3958
198196   c->cs = cs;
199197}
200198
201void x76f041_rst_write( int chip, int rst )
199void x76f041_rst_write( running_machine *machine, int chip, int rst )
202200{
203   running_machine *machine = Machine;
204201   struct x76f041_chip *c;
205202
206203   if( chip >= X76F041_MAXCHIP )
r3957r3958
285282   }
286283}
287284
288static void x76f041_load_address( int chip )
285static void x76f041_load_address( running_machine *machine, int chip )
289286{
290   running_machine *machine = Machine;
291287   /* todo: handle other bcr bits */
292288   struct x76f041_chip *c = &x76f041[ chip ];
293289   int bcr;
r3957r3958
340336   return ( block_offset & 0x180 ) | ( ( block_offset + c->byte ) & 0x7f );
341337}
342338
343void x76f041_scl_write( int chip, int scl )
339void x76f041_scl_write( running_machine *machine, int chip, int scl )
344340{
345   running_machine *machine = Machine;
346341   struct x76f041_chip *c;
347342
348343   if( chip >= X76F041_MAXCHIP )
r3957r3958
411406                  c->state = STATE_LOAD_ADDRESS;
412407                  break;
413408               case STATE_LOAD_ADDRESS:
414                  x76f041_load_address( chip );
409                  x76f041_load_address( machine, chip );
415410                  break;
416411               case STATE_LOAD_PASSWORD:
417412                  verboselog( machine, 1, "x76f041(%d) -> password: %02x\n", chip, c->shift );
r3957r3958
512507   c->scl = scl;
513508}
514509
515void x76f041_sda_write( int chip, int sda )
510void x76f041_sda_write( running_machine *machine, int chip, int sda )
516511{
517   running_machine *machine = Machine;
518512   struct x76f041_chip *c;
519513
520514   if( chip >= X76F041_MAXCHIP )
r3957r3958
567561   c->sdaw = sda;
568562}
569563
570int x76f041_sda_read( int chip )
564int x76f041_sda_read( running_machine *machine, int chip )
571565{
572   running_machine *machine = Machine;
573566   struct x76f041_chip *c;
574567
575568   if( chip >= X76F041_MAXCHIP )
r3957r3958
589582   return c->sdar;
590583}
591584
592static void nvram_handler_x76f041( int chip, running_machine *machine, mame_file *file, int read_or_write )
585static void nvram_handler_x76f041( running_machine *machine, mame_file *file, int read_or_write, int chip )
593586{
594587   struct x76f041_chip *c;
595588
r3957r3958
619612   }
620613}
621614
622NVRAM_HANDLER( x76f041_0 ) { nvram_handler_x76f041( 0, machine, file, read_or_write ); }
623NVRAM_HANDLER( x76f041_1 ) { nvram_handler_x76f041( 1, machine, file, read_or_write ); }
615NVRAM_HANDLER( x76f041_0 ) { nvram_handler_x76f041( machine, file, read_or_write, 0 ); }
616NVRAM_HANDLER( x76f041_1 ) { nvram_handler_x76f041( machine, file, read_or_write, 1 ); }
src/emu/machine/smc91c9x.c
r3957r3958
624624
625625      /* --- the following bits of info are returned as NULL-terminated strings --- */
626626      case DEVINFO_STR_NAME:               /* provided by subclasses */         break;
627      case DEVINFO_STR_FAMILY:            info->s = "SMC91C9X Ethernet Controller";break;
628      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
629      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
630      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
627      case DEVINFO_STR_FAMILY:            strcpy(info->s, "SMC91C9X Ethernet Controller");break;
628      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
629      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
630      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
631631   }
632632}
633633
r3957r3958
636636   switch (state)
637637   {
638638      /* --- the following bits of info are returned as NULL-terminated strings --- */
639      case DEVINFO_STR_NAME:               info->s = "SMC91C94";               break;
639      case DEVINFO_STR_NAME:               strcpy(info->s, "SMC91C94");         break;
640640      default:                        DEVICE_GET_INFO_CALL(smc91c9x);         break;
641641   }
642642}
r3957r3958
646646   switch (state)
647647   {
648648      /* --- the following bits of info are returned as NULL-terminated strings --- */
649      case DEVINFO_STR_NAME:               info->s = "SMC91C96";               break;
649      case DEVINFO_STR_NAME:               strcpy(info->s, "SMC91C96");         break;
650650      default:                        DEVICE_GET_INFO_CALL(smc91c9x);         break;
651651   }
652652}
src/emu/machine/8255ppi.h
r3957r3958
3333***************************************************************************/
3434
3535#define MDRV_PPI8255_ADD(_tag, _intrf) \
36   MDRV_DEVICE_ADD(_tag, PPI8255) \
36   MDRV_DEVICE_ADD(_tag, PPI8255, 0) \
3737   MDRV_DEVICE_CONFIG(_intrf)
3838
3939#define MDRV_PPI8255_RECONFIG(_tag, _intrf) \
src/emu/machine/generic.h
r3957r3958
121121
122122void generic_pulse_irq_line(const device_config *device, int irqline);
123123void generic_pulse_irq_line_and_vector(const device_config *device, int irqline, int vector);
124void cpu_interrupt_enable(int cpu, int enabled);
124void cpu_interrupt_enable(const device_config *device, int enabled);
125125READ8_HANDLER( interrupt_enable_r );
126126WRITE8_HANDLER( interrupt_enable_w );
127127
src/emu/machine/x76f041.h
r3957r3958
1010#define X76F041_MAXCHIP ( 2 )
1111
1212extern void x76f041_init( running_machine *machine, int chip, UINT8 *data );
13extern void x76f041_cs_write( int chip, int cs );
14extern void x76f041_rst_write( int chip, int rst );
15extern void x76f041_scl_write( int chip, int scl );
16extern void x76f041_sda_write( int chip, int sda );
17extern int x76f041_sda_read( int chip );
13extern void x76f041_cs_write( running_machine *machine, int chip, int cs );
14extern void x76f041_rst_write( running_machine *machine, int chip, int rst );
15extern void x76f041_scl_write( running_machine *machine, int chip, int scl );
16extern void x76f041_sda_write( running_machine *machine, int chip, int sda );
17extern int x76f041_sda_read( running_machine *machine, int chip );
1818extern NVRAM_HANDLER( x76f041_0 );
1919extern NVRAM_HANDLER( x76f041_1 );
2020
src/emu/machine/smc91c9x.h
r3957r3958
3030***************************************************************************/
3131
3232#define MDRV_SMC91C94_ADD(_tag, _callback) \
33   MDRV_DEVICE_ADD(_tag, SMC91C94) \
33   MDRV_DEVICE_ADD(_tag, SMC91C94, 0) \
3434   MDRV_DEVICE_CONFIG_DATAPTR(smc91c9x_config, interrupt, _callback)
3535
3636#define MDRV_SMC91C96_ADD(_tag, _callback) \
37   MDRV_DEVICE_ADD(_tag, SMC91C96) \
37   MDRV_DEVICE_ADD(_tag, SMC91C96, 0) \
3838   MDRV_DEVICE_CONFIG_DATAPTR(smc91c9x_config, interrupt, _callback)
3939
4040#define MDRV_SMC91C94_REMOVE(_tag) \
src/emu/machine/8257dma.c
r3957r3958
204204
205205   if (pending_transfer)
206206   {
207      next = ATTOTIME_IN_HZ(dma8257->intf->clockhz / 4 );
207      next = ATTOTIME_IN_HZ(device->clock / 4 );
208208      timer_adjust_periodic(dma8257->timer,
209209         attotime_zero,
210210         0,
r3957r3958
218218   }
219219
220220   /* set the halt line */
221   if (dma8257->intf && dma8257->intf->cpunum >= 0)
221   if (dma8257->intf && dma8257->intf->cputag != NULL)
222222   {
223      cpu_set_input_line(device->machine->cpu[dma8257->intf->cpunum], INPUT_LINE_HALT,
223      cputag_set_input_line(device->machine, dma8257->intf->cputag, INPUT_LINE_HALT,
224224         pending_transfer ? ASSERT_LINE : CLEAR_LINE);
225225   }
226226
r3957r3958
413413   switch (state)
414414   {
415415      /* --- the following bits of info are returned as 64-bit signed integers --- */
416      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(dma8257_t);            break;
416      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(dma8257_t);         break;
417417      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                     break;
418418      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;      break;
419419
r3957r3958
424424      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(dma8257);break;
425425
426426      /* --- the following bits of info are returned as NULL-terminated strings --- */
427      case DEVINFO_STR_NAME:                     info->s = "DMA8257";               break;
428      case DEVINFO_STR_FAMILY:                  info->s = "DMA controllers";         break;
429      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
430      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
431      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
427      case DEVINFO_STR_NAME:                     strcpy(info->s, "DMA8257");            break;
428      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "DMA controllers");      break;
429      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
430      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
431      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
432432   }
433433}
src/emu/machine/z80pio.c
r3957r3958
11/***************************************************************************
22
3    Z80 PIO Parallel Input/Output Controller emulation
3    Z80 PIO implementation
44
5    based on original version (c) 1997, Tatsuyuki Satoh
6
57    Copyright Nicola Salmoria and the MAME Team.
68    Visit http://mamedev.org for licensing and usage restrictions.
79
r3957r3958
1214#include "cpu/z80/z80.h"
1315#include "cpu/z80/z80daisy.h"
1416
17
18
1519/***************************************************************************
1620    DEBUGGING
1721***************************************************************************/
1822
19#define VERBOSE
23#define VERBOSE     
2024
21#define LOGERROR if (VERBOSE) logerror
25#define VPRINTF(x) do { if (VERBOSE) logerror x; } while (0)
2226
27
28
2329/***************************************************************************
2430    CONSTANTS
2531***************************************************************************/
2632
27enum
28{
29   PIO_MODE_OUTPUT = 0,
30   PIO_MODE_INPUT,
31   PIO_MODE_BIDIRECTIONAL,
32   PIO_MODE_CONTROL
33};
33#define PIO_MODE0      0x00      /* output mode */
34#define PIO_MODE1      0x01      /* input  mode */
35#define PIO_MODE2      0x02      /* i/o    mode */
36#define PIO_MODE3      0x03      /* bit    mode */
3437
35enum
36{
37   PIO_STATE_NORMAL = 0,
38   PIO_STATE_DDR,
39   PIO_STATE_MASK
40};
38/* pio controll port operation (bit 0-3) */
39#define PIO_OP_MODE      0x0f      /* mode select        */
40#define PIO_OP_INTC      0x07      /* interrupt controll */
41#define PIO_OP_INTE      0x03      /* interrupt enable   */
4142
42enum
43{
44   PIO_PORT_A = 0,
45   PIO_PORT_B,
46   PIO_PORT_COUNT
47};
43/* pio interrupt controll nit */
44#define PIO_INT_ENABLE   0x80      /* ENABLE : 0=disable , 1=enable */
45#define PIO_INT_AND      0x40      /* LOGIC  : 0=OR      , 1=AND    */
46#define PIO_INT_HIGH   0x20      /* LEVEL  : 0=low     , 1=high   */
47#define PIO_INT_MASK   0x10      /* MASK   : 0=off     , 1=on     */
4848
49#define PIO_MODE_CONTROL_WORD   0x0f
50#define PIO_IRQ_CONTROL_WORD   0x07
51#define PIO_IRQ_DISABLE_WORD   0x03
5249
53#define PIO_IRQ_MASK_FOLLOWS   0x10
54#define PIO_IRQ_ACTIVE_HIGH      0x20
55#define PIO_IRQ_AND            0x40
56#define PIO_IRQ_ENABLE         0x80
5750
5851/***************************************************************************
5952    TYPE DEFINITIONS
r3957r3958
6255typedef struct _z80pio z80pio_t;
6356struct _z80pio
6457{
65   const z80pio_interface *intf;         /* interface */
58   UINT8 vector[2];                      /* interrupt vector               */
59   void (*intr)(const device_config *, int which);            /* interrupt callbacks            */
60   void (*rdyr[2])(const device_config *, int data);          /* RDY active callback            */
61   read8_device_func  port_read[2];     /* port read callbacks            */
62   write8_device_func port_write[2];    /* port write callbacks           */
63   UINT8 mode[2];                        /* mode 00=in,01=out,02=i/o,03=bit*/
64   UINT8 enable[2];                      /* interrupt enable               */
65   UINT8 mask[2];                        /* mask folowers                  */
66   UINT8 dir[2];                         /* direction (bit mode)           */
67   UINT8 rdy[2];                         /* ready pin level                */
68   UINT8 in[2];                          /* input port data                */
69   UINT8 out[2];                         /* output port                    */
70   UINT8 strobe[2];                  /* strobe inputs */
71   UINT8 int_state[2];                   /* interrupt status (daisy chain) */
72};
6673
67   int clock;                        /* clock frequency */
6874
69   int state[PIO_PORT_COUNT];            /* control register state */
70   int mode[PIO_PORT_COUNT];            /* mode control register */
71   int irq_enable[PIO_PORT_COUNT];         /* interrupt enable flag */
72   int irq_pending[PIO_PORT_COUNT];      /* interrupt pending flag */
73   int int_state[PIO_PORT_COUNT];         /* interrupt status */
74   UINT8 enable[PIO_PORT_COUNT];         /* interrupt control word */
75   UINT8 input[PIO_PORT_COUNT];         /* data input register */
76   UINT8 output[PIO_PORT_COUNT];         /* data output register */
77   UINT8 vector[PIO_PORT_COUNT];         /* interrupt vector */
78   UINT8 mask[PIO_PORT_COUNT];            /* mask register */
79   UINT8 ddr[PIO_PORT_COUNT];            /* input/output select register */
80   int strobe[PIO_PORT_COUNT];            /* strobe pulse */
81   int match[PIO_PORT_COUNT];            /* control mode bit logic equation match */
8275
83   /* timers */
84   emu_timer *poll_timer;               /* mode 3 poll timer */
85   emu_timer *irq_timer;               /* interrupt enable timer */
86};
87
8876/***************************************************************************
8977    FUNCTION PROTOTYPES
9078***************************************************************************/
r3957r3958
9381static int z80pio_irq_ack(const device_config *device);
9482static void z80pio_irq_reti(const device_config *device);
9583
84
85
9686/***************************************************************************
9787    INLINE FUNCTIONS
9888***************************************************************************/
r3957r3958
10292   assert(device != NULL);
10393   assert(device->token != NULL);
10494   assert(device->type == Z80PIO);
105
10695   return (z80pio_t *)device->token;
10796}
10897
98
10999/***************************************************************************
110100    INTERNAL STATE MANAGEMENT
111101***************************************************************************/
112102
113static void z80pio_check_interrupt(const device_config *device)
103INLINE void set_rdy(const device_config *device, int ch, int state)
114104{
115   z80pio_t *z80pio = get_safe_token(device);
116   int channel;
105   z80pio_t *z80pio = get_safe_token( device );
106   /* set state */
107   z80pio->rdy[ch] = state;
117108
118   for (channel = PIO_PORT_A; channel < PIO_PORT_COUNT; channel++)
119   {
120      if (z80pio->irq_enable[channel])
121      {
122         if (z80pio->irq_pending[channel])
123         {
124            /* trigger interrupt request */
125            z80pio->int_state[channel] |= Z80_DAISY_INT;
126
127            /* reset interrupt pending */
128            z80pio->irq_pending[channel] = 0;
129
130            LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Request\n", device->tag, 'A' + channel);
131         }
132      }
133      else
134      {
135         /* clear interrupt request */
136         z80pio->int_state[channel] &= ~Z80_DAISY_INT;
137      }
138   }
139
140   if (z80pio->intf->on_int_changed)
141   {
142      z80pio->intf->on_int_changed(device, (z80pio_irq_state(device) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE);
143   }
109   /* call callback with state */
110   if (z80pio->rdyr[ch])
111      z80pio->rdyr[ch](device, z80pio->rdy[ch]);
144112}
145113
146static void z80pio_trigger_interrupt(const device_config *device, int channel)
147{
148   z80pio_t *z80pio = get_safe_token(device);
149114
150   if (z80pio->irq_enable[channel])
151   {
152      z80pio->int_state[channel] |= Z80_DAISY_INT;
153      z80pio_check_interrupt(device);
154
155      LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Request\n", device->tag, 'A' + channel);
156   }
157   else
158   {
159      /* set interrupt pending */
160      z80pio->irq_pending[channel] = 1;
161      z80pio_check_interrupt(device);
162
163      LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Pending\n", device->tag, 'A' + channel);
164   }
165}
166
167static TIMER_CALLBACK( z80pio_irq_tick )
115INLINE void interrupt_check(const device_config *device)
168116{
169   const device_config *device = (device_config *) ptr;
170   z80pio_t *z80pio = get_safe_token(device);
117   z80pio_t *z80pio = get_safe_token( device );
171118
172   int channel = BIT(param, 1);
173   int state = BIT(param, 0);
174
175   /* set interrupt enable */
176   z80pio->irq_enable[channel] = state;
177
178   LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Enable %u\n", device->tag, 'A' + channel, state);
179
180   /* check interrupt status */
181   z80pio_check_interrupt(device);
119   /* if we have a callback, update it with the current state */
120   if (z80pio->intr)
121      z80pio->intr(device, (z80pio_irq_state(device) & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE);
182122}
183123
184static void z80pio_set_irq_enable(const device_config *device, int channel, int state)
185{
186   z80pio_t *z80pio = get_safe_token(device);
187124
188   if (state)
189   {
190      /* enable interrupt on next _M1 */
191      int param = (channel << 1) | state;
192
193      timer_adjust_oneshot(z80pio->irq_timer, ATTOTIME_IN_HZ(z80pio->clock * 4), param);
194   }
195   else
196   {
197      /* disable interrupt immediately */
198      z80pio->irq_enable[channel] = state;
199
200      LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Enable %u\n", device->tag, 'A' + channel, state);
201   }
202}
203
204static void z80pio_ready_w(const device_config *device, int channel, int state)
125static void update_irq_state(const device_config *device, int ch)
205126{
206   z80pio_t *z80pio = get_safe_token(device);
127   z80pio_t *z80pio = get_safe_token( device );
128   int old_state = z80pio->int_state[ch];
129   int irq = 0;
130   int data;
131   if (z80pio->mode[ch] == 0x13 || (z80pio->enable[ch] & PIO_INT_MASK)) return;
207132
208   LOGERROR("Z80PIO \"%s\" Port %c : Ready %u\n", device->tag, 'A' + channel, state);
209
210   if (channel == PIO_PORT_A)
133   /* only check if interrupts are enabled */
134   if (z80pio->enable[ch] & PIO_INT_ENABLE)
211135   {
212      if (z80pio->intf->on_ardy_changed)
136      /* in mode 3, interrupts are tricky */
137      if (z80pio->mode[ch] == PIO_MODE3)
213138      {
214         z80pio->intf->on_ardy_changed(device, state);
215      }
216   }
217   else
218   {
219      if (z80pio->intf->on_brdy_changed)
220      {
221         z80pio->intf->on_brdy_changed(device, state);
222      }
223   }
224}
139         /* fetch input data (ignore output lines) */
140         data = z80pio->in[ch] & z80pio->dir[ch];
225141
226static UINT8 z80pio_port_r(const device_config *device, int channel)
227{
228   z80pio_t *z80pio = get_safe_token(device);
229   UINT8 data = 0;
142         /* keep only relevant bits */
143         data &= ~z80pio->mask[ch];
230144
231   if (channel == PIO_PORT_A)
232   {
233      if (z80pio->intf->port_a_r)
234      {
235         data = z80pio->intf->port_a_r(device, 0);
236      }
237   }
238   else
239   {
240      if (z80pio->intf->port_b_r)
241      {
242         data = z80pio->intf->port_b_r(device, 0);
243      }
244   }
145         /* if active low, invert the bits */
146         if (!(z80pio->enable[ch] & PIO_INT_HIGH))
147            data ^= z80pio->mask[ch];
245148
246   //LOGERROR("Z80PIO \"%s\" Port %c : Input Data '%02x'\n", device->tag, 'A' + channel, data);
149         /* if AND logic, interrupt if all bits are set */
150         if (z80pio->enable[ch] & PIO_INT_AND)
151            irq = (data == z80pio->mask[ch]);
247152
248   return data;
249}
153         /* otherwise, interrupt if at least one bit is set */
154         else
155            irq = (data != 0);
250156
251static void z80pio_port_w(const device_config *device, int channel)
252{
253   z80pio_t *z80pio = get_safe_token(device);
254   UINT8 data = z80pio->output[channel];
157         /* if portB, portA mode 2 check */
158         if (ch && (z80pio->mode[0] == PIO_MODE2))
159         {
160            if (z80pio->rdy[ch] == 0)
161               irq = 1;
162         }
163      }
255164
256   if (z80pio->mode[channel] == PIO_MODE_CONTROL)
257   {
258      /* mask input pins */
259      data &= ~z80pio->ddr[channel];
165      /* otherwise, just interrupt when ready is cleared */
166      else
167         irq = (z80pio->rdy[ch] == 0);
260168   }
261169
262   if (channel == PIO_PORT_A)
263   {
264      if (z80pio->intf->port_a_w)
265      {
266         z80pio->intf->port_a_w(device, 0, data);
267      }
268   }
170   if (irq)
171      z80pio->int_state[ch] |=  Z80_DAISY_INT;
269172   else
270   {
271      if (z80pio->intf->port_b_w)
272      {
273         z80pio->intf->port_b_w(device, 0, data);
274      }
275   }
173      z80pio->int_state[ch] &= ~Z80_DAISY_INT;
276174
277   //LOGERROR("Z80PIO \"%s\" Port %c : Output Data '%02x'\n", device->tag, 'A' + channel, data);
175   if (old_state != z80pio->int_state[ch])
176      interrupt_check(device);
278177}
279178
280static void z80pio_set_mode(const device_config *device, int channel, UINT8 data)
281{
282   z80pio_t *z80pio = get_safe_token(device);
283179
284   int mode = data >> 6;
285180
286   switch (mode)
287   {
288   case PIO_MODE_OUTPUT:
289      LOGERROR("Z80PIO \"%s\" Port %c : Mode %u (Byte Output)\n", device->tag, 'A' + channel, mode);
290
291      /* set mode */
292      z80pio->mode[channel] = mode;
293
294      /* enable data output */
295      z80pio_port_w(device, channel);
296
297      /* assert ready line */
298      z80pio_ready_w(device, channel, 1);
299      break;
300
301   case PIO_MODE_INPUT:
302      LOGERROR("Z80PIO \"%s\" Port %c : Mode %u (Byte Input)\n", device->tag, 'A' + channel, mode);
303
304      /* set mode */
305      z80pio->mode[channel] = mode;
306      break;
307
308   case PIO_MODE_BIDIRECTIONAL:
309      if (channel == PIO_PORT_A)
310      {
311         LOGERROR("Z80PIO \"%s\" Port %c : Mode %u (Bidirectional)\n", device->tag, 'A' + channel, mode);
312
313         /* set mode */
314         z80pio->mode[channel] = mode;
315      }
316      break;
317
318   case PIO_MODE_CONTROL:
319      LOGERROR("Z80PIO \"%s\" Port %c : Mode %u (Bit Control)\n", device->tag, 'A' + channel, mode);
320
321      /* set mode */
322      z80pio->mode[channel] = mode;
323
324      if ((channel == PIO_PORT_A) || (z80pio->mode[PIO_PORT_A] != PIO_MODE_BIDIRECTIONAL))
325      {
326         /* clear ready line */
327         z80pio_ready_w(device, channel, 0);
328      }
329
330      /* disable interrupts until DDR is written */
331      z80pio_set_irq_enable(device, channel, 0);
332
333      /* set logic equation to false */
334      z80pio->match[channel] = 0;
335
336      /* next word is I/O control */
337      z80pio->state[channel] = PIO_STATE_DDR;
338      break;
339   }
340}
341
342181/***************************************************************************
343182    CONTROL REGISTER READ/WRITE
344183***************************************************************************/
345184
346READ8_DEVICE_HANDLER( lh0081_c_r )
185WRITE8_DEVICE_HANDLER( z80pio_c_w )
347186{
348   z80pio_t *z80pio = get_safe_token(device);
187   z80pio_t *z80pio = get_safe_token( device );
349188
350   return (z80pio->enable[PIO_PORT_A] & 0xc0) | (z80pio->enable[PIO_PORT_B] >> 4);
351}
189   /* There are only 2 channels */
190   offset &= 0x01;
352191
353READ8_DEVICE_HANDLER( z80pio_c_r )
354{
355   return 0;
356}
192   /* load direction phase ? */
193   if (z80pio->mode[offset] == 0x13)
194   {
195      VPRINTF(("PIO-%c Bits %02x\n", 'A' + offset, data));
196      z80pio->dir[offset] = data;
197      z80pio->mode[offset] = 0x03;
198      return;
199   }
357200
358WRITE8_DEVICE_HANDLER( z80pio_c_w )
359{
360   z80pio_t *z80pio = get_safe_token(device);
361   int channel = offset & 0x01;
201   /* load mask folows phase ? */
202   if (z80pio->enable[offset] & PIO_INT_MASK)
203   {
204      /* load mask folows */
205      z80pio->mask[offset] = data;
206      z80pio->enable[offset] &= ~PIO_INT_MASK;
207      VPRINTF(("PIO-%c interrupt mask %02x\n",'A'+offset,data ));
208      return;
209   }
362210
363   switch (z80pio->state[channel])
211   switch (data & 0x0f)
364212   {
365   case PIO_STATE_NORMAL:
366      if (!BIT(data, 0))
367      {
368         LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Vector Word '%02x'\n", device->tag, 'A' + channel, z80pio->vector[channel]);
213      case PIO_OP_MODE:   /* mode select 0=out,1=in,2=i/o,3=bit */
214         z80pio->mode[offset] = (data >> 6);
215         VPRINTF(("PIO-%c Mode %x\n", 'A' + offset, z80pio->mode[offset]));
216         if (z80pio->mode[offset] == 0x03)
217            z80pio->mode[offset] = 0x13;
218         return;
369219
370         /* load interrupt vector */
371         z80pio->vector[channel] = data & 0xfe;
372      }
373      else if ((data & 0x0f) == PIO_IRQ_DISABLE_WORD)
374      {
375         LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Disable Word '%02x'\n", device->tag, 'A' + channel, data);
220      case PIO_OP_INTC:      /* interrupt control */
221         z80pio->enable[offset] = data & 0xf0;
222         z80pio->mask[offset] = 0x00;
223         /* when interrupt enable , set vector request flag */
224         VPRINTF(("PIO-%c Controll %02x\n", 'A' + offset, data));
225         break;
376226
377         /* set interrupt enable */
378         z80pio->enable[channel] = (data & 0x80) | (z80pio->enable[channel] & 0x7f);
379         z80pio_set_irq_enable(device, channel, BIT(data, 7));
380      }
381      else if ((data & 0x0f) == PIO_MODE_CONTROL_WORD)
382      {
383         LOGERROR("Z80PIO \"%s\" Port %c : Mode Control Word '%02x'\n", device->tag, 'A' + channel, data);
227      case PIO_OP_INTE:      /* interrupt enable controll */
228         z80pio->enable[offset] &= ~PIO_INT_ENABLE;
229         z80pio->enable[offset] |= (data & PIO_INT_ENABLE);
230         VPRINTF(("PIO-%c enable %02x\n", 'A' + offset, data & 0x80));
231         break;
384232
385         /* set operating mode */
386         z80pio_set_mode(device, channel, data);
387      }
388      else if ((data & 0x0f) == PIO_IRQ_CONTROL_WORD)
389      {
390         LOGERROR("Z80PIO \"%s\" Port %c : Interrupt Control Word '%02x'\n", device->tag, 'A' + channel, data);
391
392         /* set interrupt control word */
393         z80pio->enable[channel] = data & 0xf0;
394
395         if (data & PIO_IRQ_MASK_FOLLOWS)
233      default:
234         if (!(data & 1))
396235         {
397            /* disable interrupts until mask is written */
398            z80pio_set_irq_enable(device, channel, 0);
399
400            /* reset pending interrupt */
401            z80pio->irq_pending[channel] = 0;
402
403            /* set logic equation to false */
404            z80pio->match[channel] = 0;
405
406            /* next word is mask control */
407            z80pio->state[channel] = PIO_STATE_MASK;
236            z80pio->vector[offset] = data;
237            VPRINTF(("PIO-%c vector %02x\n", 'A' + offset, data));
408238         }
409239         else
410         {
411            /* set interrupt enable */
412            z80pio_set_irq_enable(device, channel, BIT(data, 7));
413         }
414      }
415      break;
240            VPRINTF(("PIO-%c illegal command %02x\n", 'A' + offset, data));
241         break;
242   }
416243
417   case PIO_STATE_DDR:
418      LOGERROR("Z80PIO \"%s\" Port %c : I/O Control Word '%02x'\n", device->tag, 'A' + channel, data);
244   /* interrupt check */
245   update_irq_state(device, offset);
246}
419247
420      /* set data direction */
421      z80pio->ddr[channel] = data;
422248
423      /* set interrupt enable */
424      z80pio_set_irq_enable(device, channel, BIT(z80pio->enable[channel], 7));
249READ8_DEVICE_HANDLER( z80pio_c_r )
250{
251   /* There are only 2 channels */
252   offset &= 0x01;
425253
426      /* next word is indeterminate */
427      z80pio->state[channel] = PIO_STATE_NORMAL;
428      break;
254   VPRINTF(("PIO-%c controll read\n", 'A' + offset ));
255   return 0;
256}
429257
430   case PIO_STATE_MASK:
431      LOGERROR("Z80PIO \"%s\" Port %c : Mask Control Word '%02x'\n", device->tag, 'A' + channel, data);
432258
433      /* set interrupt mask */
434      z80pio->mask[channel] = data;
435259
436      /* set interrupt enable */
437      z80pio_set_irq_enable(device, channel, BIT(z80pio->enable[channel], 7));
438
439      /* next word is indeterminate */
440      z80pio->state[channel] = PIO_STATE_NORMAL;
441      break;
442   }
443}
444
445260/***************************************************************************
446261    DATA REGISTER READ/WRITE
447262***************************************************************************/
448263
449READ8_DEVICE_HANDLER( z80pio_d_r )
264WRITE8_DEVICE_HANDLER( z80pio_d_w )
450265{
451266   z80pio_t *z80pio = get_safe_token( device );
452   int channel = offset & 0x01;
453   UINT8 data = 0;
454267
455   switch (z80pio->mode[channel])
456   {
457   case PIO_MODE_OUTPUT:
458      data = z80pio->output[channel];
459      break;
268   /* There are only 2 channels */
269   offset &= 0x01;
460270
461   case PIO_MODE_INPUT:
462      data = z80pio->input[channel];
271   z80pio->out[offset] = data;   /* latch out data */
272   if(z80pio->port_write[offset])
273      z80pio->port_write[offset](device, 0, data);
463274
464      /* clear ready line */
465      z80pio_ready_w(device, channel, 0);
275   switch (z80pio->mode[offset])
276   {
277      case PIO_MODE0:         /* mode 0 output */
278      case PIO_MODE2:         /* mode 2 i/o */
279         set_rdy(device, offset, 1); /* ready = H */
280         update_irq_state(device, offset);
281         return;
466282
467      /* assert ready line */
468      z80pio_ready_w(device, channel, 1);
469      break;
283      case PIO_MODE1:         /* mode 1 input */
284      case PIO_MODE3:         /* mode 0 bit */
285         return;
470286
471   case PIO_MODE_BIDIRECTIONAL:
472      data = z80pio->input[PIO_PORT_A] | (z80pio->output[PIO_PORT_A] & (~z80pio->ddr[PIO_PORT_A]));
473
474      /* clear ready line */
475      z80pio_ready_w(device, 1, 0);
476
477      /* assert ready line */
478      z80pio_ready_w(device, 1, 1);
479      break;
480
481   case PIO_MODE_CONTROL:
482      z80pio->input[channel] = z80pio_port_r(device, channel);
483
484      data = (z80pio->input[channel] & z80pio->ddr[channel]) | (z80pio->output[channel] & (~z80pio->ddr[channel]));
485      break;
287      default:
288         VPRINTF(("PIO-%c data write,bad mode\n",'A'+offset ));
486289   }
487
488   LOGERROR("Z80PIO \"%s\" Port %c : Data Register Read '%02x'\n", device->tag, 'A' + channel, data);
489
490   return data;
491290}
492291
493WRITE8_DEVICE_HANDLER( z80pio_d_w )
292
293READ8_DEVICE_HANDLER( z80pio_d_r )
494294{
495295   z80pio_t *z80pio = get_safe_token( device );
496   int channel = offset & 0x01;
497296
498   LOGERROR("Z80PIO \"%s\" Port %c : Data Register Write '%02x'\n", device->tag, 'A' + channel, data);
297   /* There are only 2 channels */
298   offset &= 0x01;
499299
500   switch (z80pio->mode[channel])
300   switch (z80pio->mode[offset])
501301   {
502   case PIO_MODE_OUTPUT:
503      /* clear ready line */
504      z80pio_ready_w(device, channel, 0);
302      case PIO_MODE0:         /* mode 0 output */
303         return z80pio->out[offset];
505304
506      /* output data */
507      z80pio->output[channel] = data;
508      z80pio_port_w(device, channel);
305      case PIO_MODE1:         /* mode 1 input */
306         set_rdy(device, offset, 1);   /* ready = H */
307         if(z80pio->port_read[offset])
308            z80pio->in[offset] = z80pio->port_read[offset](device, 0);
309         update_irq_state(device, offset);
310         return z80pio->in[offset];
509311
510      /* assert ready line */
511      z80pio_ready_w(device, channel, 1);
512      break;
312      case PIO_MODE2:         /* mode 2 i/o */
313         if (offset) VPRINTF(("PIO-B mode 2 \n"));
314         set_rdy(device, 1, 1); /* brdy = H */
315         if(z80pio->port_read[offset])
316            z80pio->in[offset] = z80pio->port_read[offset](device, 0);
317         update_irq_state(device, offset);
318         return z80pio->in[offset];
513319
514   case PIO_MODE_INPUT:
515      /* do nothing */
516      break;
517
518   case PIO_MODE_BIDIRECTIONAL:
519      /* clear ready line */
520      z80pio_ready_w(device, channel, 0);
521
522      /* latch output data */
523      z80pio->output[channel] = data;
524
525      if (!z80pio->strobe[channel])
526      {
527         /* output data if ASTB active */
528         z80pio_port_w(device, channel);
529      }
530
531      /* assert ready line */
532      z80pio_ready_w(device, channel, 1);
533      break;
534
535   case PIO_MODE_CONTROL:
536      /* output data */
537      z80pio->output[channel] = data;
538      z80pio_port_w(device, channel);
539      break;
320      case PIO_MODE3:         /* mode 3 bit */
321         if(z80pio->port_read[offset])
322            z80pio->in[offset] = z80pio->port_read[offset](device, 0);
323         return (z80pio->in[offset] & z80pio->dir[offset]) | (z80pio->out[offset] & ~z80pio->dir[offset]);
540324   }
325   VPRINTF(("PIO-%c data read,bad mode\n",'A'+offset ));
326   return 0;
541327}
542328
329
330
543331/***************************************************************************
544    STROBE STATE MANAGEMENT
332    PORT I/O
545333***************************************************************************/
546334
547static TIMER_CALLBACK( z80pio_poll_tick )
335WRITE8_DEVICE_HANDLER( z80pio_p_w )
548336{
549   const device_config *device = (device_config *) ptr;
550   z80pio_t *z80pio = get_safe_token(device);
551   int channel;
337   z80pio_t *z80pio = get_safe_token( device );
552338
553   for (channel = PIO_PORT_A; channel < PIO_PORT_COUNT; channel++)
339   /* There are only 2 channels */
340   offset &= 0x01;
341
342   z80pio->in[offset]  = data;
343   switch (z80pio->mode[offset])
554344   {
555      if ((z80pio->mode[channel] == PIO_MODE_CONTROL) && (z80pio->mask[channel] != 0xff))
556      {
557         int bit;
558         int match = 0;
345      case PIO_MODE0:
346         VPRINTF(("PIO-%c OUTPUT mode and data write\n",'A'+offset ));
347         break;
559348
560         int edge = (z80pio->enable[channel] & PIO_IRQ_ACTIVE_HIGH) ? 1 : 0;
349      case PIO_MODE2:   /* only port A */
350         offset = 1;      /* handshake and IRQ is use portB */
561351
562         UINT8 mask = z80pio->mask[channel];
563         UINT8 ddr = z80pio->ddr[channel];
564         UINT8 old_data = z80pio->input[channel] & ddr;
565         UINT8 data = z80pio_port_r(device, channel) & ddr;
352      case PIO_MODE1:
353         set_rdy(device, offset, 0);
354         update_irq_state(device, offset);
355         break;
566356
567         if (old_data == data) continue;
357      case PIO_MODE3:
358         /* irq check */
359         update_irq_state(device, offset);
360         break;
361   }
362}
568363
569         for (bit = 0; bit < 8; bit++)
570         {
571            if (BIT(mask, bit)) continue; /* masked out */
572            if (!BIT(ddr, bit)) continue; /* output bit */
573364
574            if ((BIT(old_data, bit) ^ edge) && !(BIT(data, bit) ^ edge)) /* falling edge */
575            {
576               /* logic equation is true, until proven otherwise */
577               match = 1;
365READ8_DEVICE_HANDLER( z80pio_p_r )
366{
367   z80pio_t *z80pio = get_safe_token( device );
578368
579               LOGERROR("Z80PIO \"%s\" Port %c : Edge Transition detected on bit %u, data %02x %02x\n", device->tag, 'A' + channel, bit, old_data, data);
580            }
581            else if (z80pio->enable[channel] & PIO_IRQ_AND)
582            {
583               /* all bits must match in AND mode, so logic equation is false */
584               match = 0;
585               break;
586            }
587         }
369   /* There are only 2 channels */
370   offset &= 0x01;
588371
589         if (!z80pio->match[channel] && match) /* rising edge */
590         {
591            /* trigger interrupt only once */
592            z80pio_trigger_interrupt(device, channel);
593            z80pio->input[channel] = data;
594         }
372   switch (z80pio->mode[offset])
373   {
374      case PIO_MODE2:      /* port A only */
375      case PIO_MODE0:
376         set_rdy(device, offset, 0);
377         update_irq_state(device, offset);
378         break;
595379
596         z80pio->match[channel] = match;
597      }
380      case PIO_MODE1:
381         VPRINTF(("PIO-%c INPUT mode and data read\n",'A'+offset ));
382         break;
383
384      case PIO_MODE3:
385         return (z80pio->in[offset] & z80pio->dir[offset]) | (z80pio->out[offset] & ~z80pio->dir[offset]);
598386   }
387   return z80pio->out[offset];
599388}
600389
390
601391/***************************************************************************
602392    STROBE STATE MANAGEMENT
603393***************************************************************************/
604394
605static void z80pio_strobe_bidirectional(const device_config *device, int channel, int state)
395static void z80pio_update_strobe(const device_config *device, int ch, int state)
606396{
607   z80pio_t *z80pio = get_safe_token(device);
397   z80pio_t *z80pio = get_safe_token( device );
608398
609   switch (channel)
399   switch (z80pio->mode[ch])
610400   {
611   case PIO_PORT_A:
612      if (!state) /* low level */
401      /* output mode: a positive edge is used by peripheral to acknowledge
402            the receipt of data */
403      case PIO_MODE0:
613404      {
614         /* output data */
615         z80pio_port_w(device, PIO_PORT_A);
616      }
617      else if (!z80pio->strobe[channel] && state) /* rising edge */
618      {
619         /* trigger interrupt */
620         z80pio_trigger_interrupt(device, channel);
405         /* ensure valid */
406         state = state & 0x01;
621407
622         /* clear ready line */
623         z80pio_ready_w(device, channel, 0);
624      }
625      break;
408         /* strobe changed state? */
409         if ((z80pio->strobe[ch] ^ state) != 0)
410         {
411            /* yes */
412            if (state != 0)
413            {
414               /* positive edge */
415               VPRINTF(("PIO-%c positive strobe\n",'A' + ch));
626416
627   case PIO_PORT_B:
628      if (!state) /* low level */
629      {
630         /* input data */
631         z80pio->input[channel] = z80pio_port_r(device, PIO_PORT_A);
632      }
633      else if (!z80pio->strobe[channel] && state) /* rising edge */
634      {
635         /* trigger interrupt */
636         z80pio_trigger_interrupt(device, channel);
417               /* ready is now inactive */
418               set_rdy(device, ch, 0);
637419
638         /* clear ready line */
639         z80pio_ready_w(device, channel, 0);
640      }
641      break;
642   }
420               /* int enabled? */
421               if (z80pio->enable[ch] & PIO_INT_ENABLE)
422               {
423                  /* trigger an int request */
424                  z80pio->int_state[ch] |= Z80_DAISY_INT;
425               }
426            }
427         }
643428
644   /* latch strobe state */
645   z80pio->strobe[channel] = state;
646}
429         /* store strobe state */
430         z80pio->strobe[ch] = state;
647431
648static void z80pio_strobe(const device_config *device, int channel, int state)
649{
650   z80pio_t *z80pio = get_safe_token(device);
651
652   switch (z80pio->mode[channel])
653   {
654   case PIO_MODE_OUTPUT:
655      if (!z80pio->strobe[channel] && state) /* rising edge */
656      {
657         /* trigger interrupt */
658         z80pio_trigger_interrupt(device, channel);
659
660         /* clear ready line */
661         z80pio_ready_w(device, channel, 0);
432         /* check interrupt */
433         interrupt_check(device);
662434      }
663435      break;
664436
665   case PIO_MODE_INPUT:
666      if (!state) /* low level */
667      {
668         /* strobe data in */
669         z80pio->input[channel] = z80pio_port_r(device, channel);
670      }
671      else if (!z80pio->strobe[channel] && state) /* rising edge */
672      {
673         /* trigger interrupt */
674         z80pio_trigger_interrupt(device, channel);
437      /* input mode: strobe is used by peripheral to load data from the peripheral
438            into port a input register, data loaded into pio when signal is active */
675439
676         /* clear ready line */
677         z80pio_ready_w(device, channel, 0);
678      }
679      break;
680
681   case PIO_MODE_CONTROL:
682      /* ignore strobes */
683      break;
440      default:
441         break;
684442   }
685
686   /* latch strobe state */
687   z80pio->strobe[channel] = state;
688443}
689444
690static void z80pio_strobe_w(const device_config *device, int channel, int state)
691{
692   z80pio_t *z80pio = get_safe_token(device);
693445
694   LOGERROR("Z80PIO \"%s\" Port %c : Strobe %u\n", device->tag, 'A' + channel, state);
446void z80pio_astb_w(const device_config *device, int state) { z80pio_update_strobe(device, 0, state); }
447void z80pio_bstb_w(const device_config *device, int state) { z80pio_update_strobe(device, 1, state); }
695448
696   if (z80pio->mode[PIO_PORT_A] == PIO_MODE_BIDIRECTIONAL)
697   {
698      /* port A bidirectional mode */
699      z80pio_strobe_bidirectional(device, channel, state);
700   }
701   else
702   {
703      z80pio_strobe(device, channel, state);
704   }
705}
706449
707void z80pio_astb_w(const device_config *device, int state)
708{
709   z80pio_strobe_w(device, PIO_PORT_A, state);
710}
711450
712void z80pio_bstb_w(const device_config *device, int state)
713{
714   z80pio_strobe_w(device, PIO_PORT_B, state);
715}
716
717451/***************************************************************************
718452    DAISY CHAIN INTERFACE
719453***************************************************************************/
r3957r3958
722456{
723457   z80pio_t *z80pio = get_safe_token( device );
724458   int state = 0;
725   int channel;
459   int ch;
726460
727461   /* loop over all channels */
728   for (channel = PIO_PORT_A; channel < PIO_PORT_COUNT; channel++)
462   for (ch = 0; ch < 2; ch++)
729463   {
730464      /* if we're servicing a request, don't indicate more interrupts */
731      if (z80pio->int_state[channel] & Z80_DAISY_IEO)
465      if (z80pio->int_state[ch] & Z80_DAISY_IEO)
732466      {
733467         state |= Z80_DAISY_IEO;
734468         break;
735469      }
736
737      state |= z80pio->int_state[channel];
470      state |= z80pio->int_state[ch];
738471   }
739
740   LOGERROR("Z80PIO \"%s\" : Interrupt State %u\n", device->tag, state);
741
742472   return state;
743473}
744474
475
745476static int z80pio_irq_ack(const device_config *device)
746477{
747478   z80pio_t *z80pio = get_safe_token( device );
748   int channel;
479   int ch;
749480
750   LOGERROR("Z80PIO \"%s\" Interrupt Acknowledge\n", device->tag);
751
752481   /* loop over all channels */
753   for (channel = PIO_PORT_A; channel < PIO_PORT_COUNT; channel++)
754   {
482   for (ch = 0; ch < 2; ch++)
483
755484      /* find the first channel with an interrupt requested */
756      if (z80pio->int_state[channel] & Z80_DAISY_INT)
485      if (z80pio->int_state[ch] & Z80_DAISY_INT)
757486      {
758487         /* clear interrupt, switch to the IEO state, and update the IRQs */
759         z80pio->int_state[channel] = Z80_DAISY_IEO;
760         z80pio_check_interrupt(device);
761
762         return z80pio->vector[channel];
488         z80pio->int_state[ch] = Z80_DAISY_IEO;
489         interrupt_check(device);
490         return z80pio->vector[ch];
763491      }
764   }
765492
766   LOGERROR("z80pio_irq_ack: failed to find an interrupt to ack!");
767
493   VPRINTF(("z80pio_irq_ack: failed to find an interrupt to ack!"));
768494   return z80pio->vector[0];
769495}
770496
497
771498static void z80pio_irq_reti(const device_config *device)
772499{
773500   z80pio_t *z80pio = get_safe_token( device );
774   int channel;
501   int ch;
775502
776   LOGERROR("Z80PIO \"%s\" Return from Interrupt\n", device->tag);
777
778503   /* loop over all channels */
779   for (channel = PIO_PORT_A; channel < PIO_PORT_COUNT; channel++)
780   {
504   for (ch = 0; ch < 2; ch++)
505
781506      /* find the first channel with an IEO pending */
782      if (z80pio->int_state[channel] & Z80_DAISY_IEO)
507      if (z80pio->int_state[ch] & Z80_DAISY_IEO)
783508      {
784509         /* clear the IEO state and update the IRQs */
785         z80pio->int_state[channel] &= ~Z80_DAISY_IEO;
786         z80pio_check_interrupt(device);
787
510         z80pio->int_state[ch] &= ~Z80_DAISY_IEO;
511         interrupt_check(device);
788512         return;
789513      }
790   }
791514
792   LOGERROR("z80pio_irq_reti: failed to find an interrupt to clear IEO on!");
515   VPRINTF(("z80pio_irq_reti: failed to find an interrupt to clear IEO on!"));
793516}
794517
518
795519/***************************************************************************
796520    READ/WRITE HANDLERS
797521***************************************************************************/
798
799522READ8_DEVICE_HANDLER(z80pio_r)
800523{
801524   return (offset & 2) ? z80pio_c_r(device, offset & 1) : z80pio_d_r(device, offset & 1);
r3957r3958
809532      z80pio_d_w(device, offset & 1, data);
810533}
811534
812READ8_DEVICE_HANDLER(z80pio_alt_r)
813{
814   int channel = BIT(offset, 1);
815535
816   return (offset & 1) ? z80pio_c_r(device, channel) : z80pio_d_r(device, channel);
817}
818
819WRITE8_DEVICE_HANDLER(z80pio_alt_w)
820{
821   int channel = BIT(offset, 1);
822
823   if (offset & 1)
824      z80pio_c_w(device, channel, data);
825   else
826      z80pio_d_w(device, channel, data);
827}
828
829/***************************************************************************
830    DEVICE INTERFACE
831***************************************************************************/
832
833536static DEVICE_START( z80pio )
834537{
835538   const z80pio_interface *intf = device->static_config;
836539   z80pio_t *z80pio = get_safe_token( device );
837   const device_config *cpu = NULL;
838540
839   assert(intf != NULL);
840   z80pio->intf = intf;
541   z80pio->intr = intf->intr;
542   z80pio->port_read[0] = intf->portAread;
543   z80pio->port_read[1] = intf->portBread;
544   z80pio->port_write[0] = intf->portAwrite;
545   z80pio->port_write[1] = intf->portBwrite;
546   z80pio->rdyr[0] = intf->rdyA;
547   z80pio->rdyr[1] = intf->rdyB;
841548
842   /* get clock */
843
844   if (intf->cpu != NULL)
845   {
846      cpu = cputag_get_cpu(device->machine, intf->cpu);
847   }
848
849   if (cpu != NULL)
850   {
851      z80pio->clock = cpu_get_clock(cpu);
852   }
853   else
854   {
855      assert(intf->clock > 0);
856      z80pio->clock = intf->clock;
857   }
858
859   /* allocate poll timer */
860
861   z80pio->poll_timer = timer_alloc(device->machine, z80pio_poll_tick, (void *)device);
862   timer_adjust_periodic(z80pio->poll_timer, attotime_zero, 0, ATTOTIME_IN_HZ(z80pio->clock / 16));
863
864   /* allocate interrupt enable timer */
865
866   z80pio->irq_timer = timer_alloc(device->machine, z80pio_irq_tick, (void *)device);
867
868   /* register for state saving */
869
870   state_save_register_device_item_array(device, 0, z80pio->state);
549   /* register for save states */
550   state_save_register_device_item_array(device, 0, z80pio->vector);
871551   state_save_register_device_item_array(device, 0, z80pio->mode);
872   state_save_register_device_item_array(device, 0, z80pio->irq_enable);
873   state_save_register_device_item_array(device, 0, z80pio->irq_pending);
874   state_save_register_device_item_array(device, 0, z80pio->int_state);
875552   state_save_register_device_item_array(device, 0, z80pio->enable);
876   state_save_register_device_item_array(device, 0, z80pio->input);
877   state_save_register_device_item_array(device, 0, z80pio->output);
878   state_save_register_device_item_array(device, 0, z80pio->vector);
879553   state_save_register_device_item_array(device, 0, z80pio->mask);
880   state_save_register_device_item_array(device, 0, z80pio->ddr);
554   state_save_register_device_item_array(device, 0, z80pio->dir);
555   state_save_register_device_item_array(device, 0, z80pio->rdy);
556   state_save_register_device_item_array(device, 0, z80pio->in);
557   state_save_register_device_item_array(device, 0, z80pio->out);
881558   state_save_register_device_item_array(device, 0, z80pio->strobe);
882   state_save_register_device_item_array(device, 0, z80pio->match);
559   state_save_register_device_item_array(device, 0, z80pio->int_state);
883560
884561   return DEVICE_START_OK;
885562}
886563
564
887565static DEVICE_RESET( z80pio )
888566{
889   z80pio_t *z80pio = get_safe_token(device);
890   int channel;
567   z80pio_t   *z80pio = get_safe_token( device );
568   int i;
891569
892   LOGERROR("Z80PIO \"%s\" : Reset\n", device->tag);
893
894   for (channel = 0; channel < 2; channel++)
570   for (i = 0; i < 2; i++)
895571   {
896      /* set mode 1 */
897      z80pio->mode[channel] = PIO_MODE_INPUT;
898
899      /* disable interrupt */
900      z80pio->enable[channel] &= 0x7f;
901      z80pio->irq_enable[channel] = 0;
902      z80pio->irq_pending[channel] = 0;
903      z80pio->int_state[channel] = 0;
904      z80pio->match[channel] = 0;
905
906      /* reset all bits of the data I/O register */
907      z80pio->ddr[channel] = 0;
908
909      /* set all bits of the mask control register */
910      z80pio->mask[channel] = 0xff;
911
912      /* reset output register */
913      z80pio->output[channel] = 0;
914
915      /* clear ready line */
916      z80pio_ready_w(device, channel, 0);
572      z80pio->mask[i]   = 0xff;   /* mask all on */
573      z80pio->enable[i] = 0x00;   /* disable     */
574      z80pio->mode[i]   = 0x01;   /* mode input  */
575      z80pio->dir[i]    = 0x01;   /* dir  input  */
576      set_rdy(device, i, 0);   /* RDY = low   */
577      z80pio->out[i]    = 0x00;   /* outdata = 0 */
578      z80pio->int_state[i] = 0;
579      z80pio->strobe[i] = 0;
917580   }
918
919   z80pio_check_interrupt(device);
581   interrupt_check(device);
920582}
921583
584
922585static DEVICE_SET_INFO( z80pio )
923586{
924587   switch (state)
r3957r3958
927590   }
928591}
929592
593
930594DEVICE_GET_INFO( z80pio )
931595{
932596   switch (state)
r3957r3958
946610      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80pio_irq_reti;      break;
947611
948612      /* --- the following bits of info are returned as NULL-terminated strings --- */
949      case DEVINFO_STR_NAME:                     info->s = "Zilog Z80 PIO";            break;
950      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                  break;
951      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
952      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
953      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
613      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 PIO");      break;
614      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");               break;
615      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
616      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
617      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
954618   }
955619}
956620
957DEVICE_GET_INFO( z8420 )
958{
959   switch (state)
960   {
961      /* --- the following bits of info are returned as NULL-terminated strings --- */
962      case DEVINFO_STR_NAME:                     info->s = "Zilog Z8420";            break;
963      case DEVINFO_STR_FAMILY:                  info->s = "Z80 PIO";               break;
964
965      default:                              DEVICE_GET_INFO_CALL(z80pio);
966   }
967}
968
969DEVICE_GET_INFO( lh0081 )
970{
971   switch (state)
972   {
973      /* --- the following bits of info are returned as NULL-terminated strings --- */
974      case DEVINFO_STR_NAME:                     info->s = "Sharp LH0081";            break;
975      case DEVINFO_STR_FAMILY:                  info->s = "Z80 PIO";               break;
976
977      default:                              DEVICE_GET_INFO_CALL(z80pio);
978   }
979}
980
981DEVICE_GET_INFO( mk3881 )
982{
983   switch (state)
984   {
985      /* --- the following bits of info are returned as NULL-terminated strings --- */
986      case DEVINFO_STR_NAME:                     info->s = "Mostek MK3881";            break;
987      case DEVINFO_STR_FAMILY:                  info->s = "Z80 PIO";               break;
988
989      default:                              DEVICE_GET_INFO_CALL(z80pio);
990   }
991}
src/emu/machine/8257dma.h
r3957r3958
99
1010#define DMA8257 DEVICE_GET_INFO_NAME(dma8257)
1111
12#define MDRV_DMA8257_ADD(_tag, _clock, _config) \
13   MDRV_DEVICE_ADD(_tag, DMA8257, _clock) \
14   MDRV_DEVICE_CONFIG(_config)
15
16#define MDRV_DMA8257_REMOVE(_tag) \
17   MDRV_DEVICE_REMOVE(_tag, DMA8257)
18
19
1220#define DMA8257_STATUS_UPDATE      0x10
1321#define DMA8257_STATUS_TC_CH3      0x08
1422#define DMA8257_STATUS_TC_CH2      0x04
r3957r3958
2230struct _dma8257_interface
2331{
2432   /* CPU to halt when DMA is active */
25   int cpunum;
33   const char *cputag;
2634
27   /* clock */
28   int clockhz;
29
3035   /* accessors to main memory */
3136   read8_device_func   memory_read;
3237   write8_device_func   memory_write;
src/emu/machine/z80pio.h
r3957r3958
11/***************************************************************************
22
3    Z80 PIO Parallel Input/Output Controller emulation
3    Z80 PIO (Z8420) implementation
44
55    Copyright Nicola Salmoria and the MAME Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
77
8****************************************************************************
8***************************************************************************
99                            _____   _____
1010                    D2   1 |*    \_/     | 40  D3
1111                    D7   2 |             | 39  D4
r3957r3958
3333#ifndef __Z80PIO_H__
3434#define __Z80PIO_H__
3535
36/***************************************************************************
37    CALLBACK FUNCTION PROTOTYPES
38***************************************************************************/
3936
40typedef void (*z80pio_on_int_changed_func) (const device_config *device, int state);
41#define Z80PIO_ON_INT_CHANGED(name) void name(const device_config *device, int state)
42
43typedef void (*z80pio_on_ardy_changed_func) (const device_config *device, int state);
44#define Z80PIO_ON_ARDY_CHANGED(name) void name(const device_config *device, int state)
45
46typedef void (*z80pio_on_brdy_changed_func) (const device_config *device, int state);
47#define Z80PIO_ON_BRDY_CHANGED(name) void name(const device_config *device, int state)
48
4937/***************************************************************************
5038    TYPE DEFINITIONS
5139***************************************************************************/
r3957r3958
5341typedef struct _z80pio_interface z80pio_interface;
5442struct _z80pio_interface
5543{
56   const char *cpu;            /* CPU whose clock we use for our base */
57   int clock;                  /* clock (pin 25) of the chip */
44   void (*intr)(const device_config *device, int which);    /* callback when change interrupt status */
45   read8_device_func portAread;    /* port A read callback */
46   read8_device_func portBread;    /* port B read callback */
47   write8_device_func portAwrite;  /* port A write callback */
48   write8_device_func portBwrite;  /* port B write callback */
49   void (*rdyA)(const device_config *device, int data);     /* portA ready active callback (do not support yet)*/
50   void (*rdyB)(const device_config *device, int data);     /* portB ready active callback (do not support yet)*/
51};
5852
59   /* this gets called for every change of the _INT pin (pin 23) */
60   z80pio_on_int_changed_func      on_int_changed;
6153
62   /* this gets called for every read from port A */
63   read8_device_func            port_a_r;
6454
65   /* this gets called for every read from port B */
66   read8_device_func            port_b_r;
67
68   /* this gets called for every write to port A */
69   write8_device_func            port_a_w;
70
71   /* this gets called for every write to port B */
72   write8_device_func            port_b_w;
73
74   /* this gets called for every change of the ARDY pin (pin 18) */
75   z80pio_on_ardy_changed_func      on_ardy_changed;
76
77   /* this gets called for every change of the BRDY pin (pin 21) */
78   z80pio_on_brdy_changed_func      on_brdy_changed;
79};
80#define Z80PIO_INTERFACE(name) const z80pio_interface (name)=
81
8255/***************************************************************************
8356    DEVICE CONFIGURATION MACROS
8457***************************************************************************/
8558
8659#define MDRV_Z80PIO_ADD(_tag, _intrf) \
87   MDRV_DEVICE_ADD(_tag, Z80PIO) \
60   MDRV_DEVICE_ADD(_tag, Z80PIO, 0) \
8861   MDRV_DEVICE_CONFIG(_intrf)
8962
9063#define MDRV_Z80PIO_REMOVE(_tag) \
9164   MDRV_DEVICE_REMOVE(_tag, Z80PIO)
9265
66
67
9368/***************************************************************************
9469    CONTROL REGISTER READ/WRITE
9570***************************************************************************/
9671
97READ8_DEVICE_HANDLER( z80pio_c_r );
9872WRITE8_DEVICE_HANDLER( z80pio_c_w );
73READ8_DEVICE_HANDLER( z80pio_c_r );
9974
100READ8_DEVICE_HANDLER( lh0081_c_r );
10175
10276/***************************************************************************
10377    DATA REGISTER READ/WRITE
10478***************************************************************************/
10579
106READ8_DEVICE_HANDLER( z80pio_d_r );
10780WRITE8_DEVICE_HANDLER( z80pio_d_w );
81READ8_DEVICE_HANDLER( z80pio_d_r );
10882
83
10984/***************************************************************************
85    PORT I/O
86***************************************************************************/
87
88WRITE8_DEVICE_HANDLER( z80pio_p_w );
89READ8_DEVICE_HANDLER( z80pio_p_r );
90
91
92/***************************************************************************
11093    STROBE STATE MANAGEMENT
11194***************************************************************************/
11295
11396void z80pio_astb_w(const device_config *device, int state);
11497void z80pio_bstb_w(const device_config *device, int state);
11598
99
116100/***************************************************************************
117101    READ/WRITE HANDLERS
118102***************************************************************************/
119
120/* A0 = B/A
121   A1 = C/D */
122103READ8_DEVICE_HANDLER(z80pio_r);
123104WRITE8_DEVICE_HANDLER(z80pio_w);
124105
125/* A0 = C/D
126   A1 = B/A */
127READ8_DEVICE_HANDLER(z80pio_alt_r);
128WRITE8_DEVICE_HANDLER(z80pio_alt_w);
129106
130/***************************************************************************
131    DEVICE INTERFACE
132***************************************************************************/
107/* ----- device interface ----- */
133108
134109#define Z80PIO DEVICE_GET_INFO_NAME(z80pio)
135110DEVICE_GET_INFO( z80pio );
136111
137#define Z8420 DEVICE_GET_INFO_NAME(z8420)
138DEVICE_GET_INFO( z8420 );
139
140#define LH0081 DEVICE_GET_INFO_NAME(lh0081)
141DEVICE_GET_INFO( lh0081 );
142
143#define MK3881 DEVICE_GET_INFO_NAME(mk3881)
144DEVICE_GET_INFO( mk3881 );
145
146112#endif
src/emu/machine/adc083x.c
r3957r3958
77
88#include <stdarg.h>
99#include "driver.h"
10#include "deprecat.h"
1110#include "machine/adc083x.h"
1211
1312#define VERBOSE_LEVEL ( 0 )
r3957r3958
2827struct adc083x_chip
2928{
3029   int type;
31   double (*input_callback)(int input);
30   double (*input_callback)(running_machine *machine, int input);
3231   INT32 CS;
3332   INT32 CLK;
3433   INT32 DI;
r3957r3958
5655
5756static struct adc083x_chip adc083x[ MAX_ADC083X_CHIPS ];
5857
59void adc083x_init( running_machine *machine, int chip, int type, double (*input_callback)(int input) )
58void adc083x_init( running_machine *machine, int chip, int type, double (*input_callback)(running_machine *machine, int input) )
6059{
6160   struct adc083x_chip *c;
6261
r3957r3958
122121   state_save_register_item( machine, "adc083x", NULL, chip, c->output );
123122}
124123
125void adc083x_cs_write( int chip, int cs )
124void adc083x_cs_write( running_machine *machine, int chip, int cs )
126125{
127   running_machine *machine = Machine;
128126   struct adc083x_chip *c;
129127
130128   if( chip >= MAX_ADC083X_CHIPS )
r3957r3958
169167   c->CS = cs;
170168}
171169
172static int adc083x_conversion( int chip )
170static int adc083x_conversion( running_machine *machine, int chip )
173171{
174172   struct adc083x_chip *c = &adc083x[ chip ];
175173   int result;
r3957r3958
177175   int negative_channel = ADC083X_AGND;
178176   double positive = 0;
179177   double negative = 0;
180   double gnd = c->input_callback( ADC083X_AGND );
181   double vref = c->input_callback( ADC083X_VREF );
178   double gnd = c->input_callback( machine, ADC083X_AGND );
179   double vref = c->input_callback( machine, ADC083X_VREF );
182180
183181   switch( c->type )
184182   {
r3957r3958
223221
224222   if( positive_channel != ADC083X_AGND )
225223   {
226      positive = c->input_callback( positive_channel ) - gnd;
224      positive = c->input_callback( machine, positive_channel ) - gnd;
227225   }
228226   if( negative_channel != ADC083X_AGND )
229227   {
230      negative = c->input_callback( negative_channel ) - gnd;
228      negative = c->input_callback( machine, negative_channel ) - gnd;
231229   }
232230
233231   result = (int)( ( ( positive - negative ) * 255 ) / vref );
r3957r3958
243241   return result;
244242}
245243
246void adc083x_clk_write( int chip, int clk )
244void adc083x_clk_write( running_machine *machine, int chip, int clk )
247245{
248   running_machine *machine = Machine;
249246   struct adc083x_chip *c;
250247
251248   if( chip >= MAX_ADC083X_CHIPS )
r3957r3958
343340         {
344341         case STATE_MUX_SETTLE:
345342            verboselog( machine, 1, "adc083x %d mux settle\n", chip );
346            c->output = adc083x_conversion( chip );
343            c->output = adc083x_conversion( machine, chip );
347344            c->state = STATE_OUTPUT_MSB_FIRST;
348345            c->bit = 7;
349346            if( c->type == ADC0834 || c->type == ADC0838 )
r3957r3958
388385   c->CLK = clk;
389386}
390387
391void adc083x_di_write( int chip, int di )
388void adc083x_di_write( running_machine *machine, int chip, int di )
392389{
393   running_machine *machine = Machine;
394390   struct adc083x_chip *c;
395391
396392   if( chip >= MAX_ADC083X_CHIPS )
r3957r3958
409405   c->DI = di;
410406}
411407
412void adc083x_se_write( int chip, int se )
408void adc083x_se_write( running_machine *machine, int chip, int se )
413409{
414   running_machine *machine = Machine;
415410   struct adc083x_chip *c;
416411
417412   if( chip >= MAX_ADC083X_CHIPS )
r3957r3958
430425   c->SE = se;
431426}
432427
433int adc083x_sars_read( int chip )
428int adc083x_sars_read( running_machine *machine, int chip )
434429{
435   running_machine *machine = Machine;
436430   struct adc083x_chip *c;
437431
438432   if( chip >= MAX_ADC083X_CHIPS )
r3957r3958
447441   return c->SARS;
448442}
449443
450int adc083x_do_read( int chip )
444int adc083x_do_read( running_machine *machine, int chip )
451445{
452   running_machine *machine = Machine;
453446   struct adc083x_chip *c;
454447
455448   if( chip >= MAX_ADC083X_CHIPS )
src/emu/machine/i2cmem.c
r3957r3958
2121*/
2222
2323#include "driver.h"
24#include "deprecat.h"
2524#include "machine/i2cmem.h"
2625
2726#define VERBOSE_LEVEL ( 0 )
r3957r3958
147146   return ( ( ( c->devsel << 7 ) & 0xff00 ) | ( c->byteaddr & 0xff ) ) & ( c->data_size - 1 );
148147}
149148
150void i2cmem_write( int chip, int line, int data )
149void i2cmem_write( running_machine *machine, int chip, int line, int data )
151150{
152   running_machine *machine = Machine;
153151   struct i2cmem_chip *c;
154152
155153   if( chip >= I2CMEM_MAXCHIP )
r3957r3958
382380   }
383381}
384382
385int i2cmem_read( int chip, int line )
383int i2cmem_read( running_machine *machine, int chip, int line )
386384{
387   running_machine *machine = Machine;
388385   struct i2cmem_chip *c;
389386
390387   if( chip >= I2CMEM_MAXCHIP )
src/emu/machine/adc083x.h
r3957r3958
2727#define ADC0834 ( 2 )
2828#define ADC0838 ( 3 )
2929
30void adc083x_init( running_machine *machine, int chip, int type, double (*input_callback)( int input ) );
31extern void adc083x_cs_write( int chip, int cs );
32extern void adc083x_clk_write( int chip, int clk );
33extern void adc083x_di_write( int chip, int di );
34extern void adc083x_se_write( int chip, int se );
35extern int adc083x_sars_read( int chip );
36extern int adc083x_do_read( int chip );
30void adc083x_init( running_machine *machine, int chip, int type, double (*input_callback)( running_machine *machine, int input ) );
31extern void adc083x_cs_write( running_machine *machine, int chip, int cs );
32extern void adc083x_clk_write( running_machine *machine, int chip, int clk );
33extern void adc083x_di_write( running_machine *machine, int chip, int di );
34extern void adc083x_se_write( running_machine *machine, int chip, int se );
35extern int adc083x_sars_read( running_machine *machine, int chip );
36extern int adc083x_do_read( running_machine *machine, int chip );
3737
3838#endif
src/emu/machine/i2cmem.h
r3957r3958
2020#define I2CMEM_SLAVE_ADDRESS_ALT ( 0xb0 )
2121
2222extern void i2cmem_init( running_machine *machine, int chip, int slave_address, int page_size, int data_size, unsigned char *data );
23extern void i2cmem_write( int chip, int line, int data );
24extern int i2cmem_read( int chip, int line );
23extern void i2cmem_write( running_machine *machine, int chip, int line, int data );
24extern int i2cmem_read( running_machine *machine, int chip, int line );
2525extern NVRAM_HANDLER( i2cmem_0 );
2626
2727#endif
src/emu/machine/ldvp931.c
r3957r3958
117117
118118
119119/***************************************************************************
120    INLINE FUNCTIONS
121***************************************************************************/
122
123/*-------------------------------------------------
124    find_vp931 - find our device; assumes there
125    is only one
126-------------------------------------------------*/
127
128INLINE laserdisc_state *find_vp931(running_machine *machine)
129{
130   return ldcore_get_safe_token(device_list_first(machine->config->devicelist, LASERDISC));
131}
132
133
134
135/***************************************************************************
136120    22VP931 ROM AND MACHINE INTERFACES
137121***************************************************************************/
138122
r3957r3958
230214   player->data_ready_cb = cbsave;
231215
232216   /* find our devices */
233   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device->tag, "vp931"));
234   player->tracktimer = devtag_get_device(ld->device->machine, TIMER, device_build_tag(tempstring, ld->device->tag, "tracktimer"));
217   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device, "vp931"));
218   player->tracktimer = devtag_get_device(ld->device->machine, TIMER, device_build_tag(tempstring, ld->device, "tracktimer"));
235219   timer_device_set_ptr(player->tracktimer, ld);
236220   astring_free(tempstring);
237221}
r3957r3958
459443
460444static WRITE8_HANDLER( output0_w )
461445{
462   laserdisc_state *ld = find_vp931(space->machine);
446   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
463447   ldplayer_data *player = ld->player;
464448
465449   /*
r3957r3958
500484
501485static WRITE8_HANDLER( output1_w )
502486{
503   laserdisc_state *ld = find_vp931(space->machine);
487   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
504488   ldplayer_data *player = ld->player;
505489   INT32 speed = 0;
506490
r3957r3958
592576
593577static READ8_HANDLER( datic_r )
594578{
595   laserdisc_state *ld = find_vp931(space->machine);
579   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
596580   return ld->player->daticval;
597581}
598582
r3957r3958
604588
605589static READ8_HANDLER( from_controller_r )
606590{
607   laserdisc_state *ld = find_vp931(space->machine);
591   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
608592   ldplayer_data *player = ld->player;
609593
610594   /* clear the pending flag and return the data */
r3957r3958
620604
621605static WRITE8_HANDLER( to_controller_w )
622606{
623   laserdisc_state *ld = find_vp931(space->machine);
607   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
624608   ldplayer_data *player = ld->player;
625609
626610   /* set the pending flag and stash the data */
r3957r3958
642626
643627static READ8_HANDLER( port1_r )
644628{
645   laserdisc_state *ld = find_vp931(space->machine);
629   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
646630   ldplayer_data *player = ld->player;
647631   UINT8 result = 0x00;
648632
r3957r3958
665649
666650static WRITE8_HANDLER( port1_w )
667651{
668   laserdisc_state *ld = find_vp931(space->machine);
652   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
669653   ldplayer_data *player = ld->player;
670654
671655   /*
r3957r3958
739723
740724static READ8_HANDLER( port2_r )
741725{
742   laserdisc_state *ld = find_vp931(space->machine);
726   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
743727   ldplayer_data *player = ld->player;
744728   UINT8 result = 0x00;
745729
r3957r3958
778762
779763static READ8_HANDLER( t0_r )
780764{
781   laserdisc_state *ld = find_vp931(space->machine);
765   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
782766   return ld->player->datastrobe;
783767}
784768
r3957r3958
791775
792776static READ8_HANDLER( t1_r )
793777{
794   laserdisc_state *ld = find_vp931(space->machine);
778   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
795779   return ld->player->trackstate;
796780}
src/emu/machine/msm6242.c
r3957r3958
183183      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
184184
185185      /* --- the following bits of info are returned as NULL-terminated strings --- */
186      case DEVINFO_STR_NAME:                     info->s = "OKI MSM6242";               break;
187      case DEVINFO_STR_FAMILY:                  info->s = "MSM6242 RTC";               break;
188      case DEVINFO_STR_VERSION:                  info->s = "1.00";                     break;
189      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
190      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
186      case DEVINFO_STR_NAME:                     strcpy(info->s, "OKI MSM6242");            break;
187      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MSM6242 RTC");            break;
188      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.00");               break;
189      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
190      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
191191   }
192192}
193193
src/emu/machine/msm6242.h
r3957r3958
1515
1616#define MSM6242      DEVICE_GET_INFO_NAME(msm6242)
1717
18#define MDRV_MSM6242_ADD(_tag) \
19   MDRV_DEVICE_ADD(_tag, MSM6242, 0)
1820
21#define MDRV_MSM6242_REMOVE(_tag) \
22   MDRV_DEVICE_REMOVE(_tag, MSM6242)
23
24
1925/* device interface */
2026DEVICE_GET_INFO( msm6242 );
2127
src/emu/machine/6850acia.c
r3957r3958
215215   acia6850_t *acia_p = get_token(device);
216216   acia6850_interface *intf = get_interface(device);
217217
218   acia_p->rx_clock = intf->rx_clock;
219   acia_p->tx_clock = intf->tx_clock;
218   acia_p->tx_clock = device->clock;
219   acia_p->rx_clock = (intf->rx_clock == 0) ? device->clock : intf->rx_clock;
220220   acia_p->tx_counter = 0;
221221   acia_p->rx_counter = 0;
222222   acia_p->rx_pin = intf->rx_pin;
r3957r3958
862862      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(acia6850);   break;
863863
864864      /* --- the following bits of info are returned as NULL-terminated strings --- */
865      case DEVINFO_STR_NAME:                     info->s = "6850 ACIA";                  break;
866      case DEVINFO_STR_FAMILY:                  info->s = "6850 ACIA";                  break;
867      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
868      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
865      case DEVINFO_STR_NAME:                     strcpy(info->s, "6850 ACIA");            break;
866      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "6850 ACIA");            break;
867      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
868      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
869869      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
870870   }
871871}
src/emu/machine/53c810.c
r3957r3958
11/* LSI Logic LSI53C810A PCI to SCSI I/O Processor */
22
33#include "driver.h"
4#include "deprecat.h"
54#include "53c810.h"
65
76#define DMA_MAX_ICOUNT   512      /* Maximum number of DMA Scripts opcodes to run */
r3957r3958
4645   void (* dma_callback)(UINT32, UINT32, int, int);
4746} lsi810;
4847
49static void (* dma_opcode[256])(void);
48typedef void (*opcode_handler)(running_machine *machine);
49#define OPCODE_HANDLER(name) void name(running_machine *machine)
50static opcode_handler dma_opcode[256];
5051
51
52INLINE UINT32 FETCH(void)
52INLINE UINT32 FETCH(running_machine *machine)
5353{
54   UINT32 r = intf->fetch(lsi810.dsp);
54   UINT32 r = intf->fetch(machine, lsi810.dsp);
5555   lsi810.dsp += 4;
5656   return r;
5757}
r3957r3958
6767}
6868#endif
6969
70static void dmaop_invalid(void)
70static OPCODE_HANDLER( dmaop_invalid )
7171{
7272   fatalerror("LSI53C810: Invalid SCRIPTS DMA opcode %08X at %08X", lsi810.dcmd, lsi810.dsp);
7373}
7474
75static void dmaop_move_memory(void)
75static OPCODE_HANDLER( dmaop_move_memory )
7676{
77   UINT32 src = FETCH();
78   UINT32 dst = FETCH();
77   UINT32 src = FETCH(machine);
78   UINT32 dst = FETCH(machine);
7979   int count;
8080
8181   count = lsi810.dcmd & 0xffffff;
8282   if(intf->dma_callback != NULL) {
83      intf->dma_callback(src, dst, count, 1);
83      intf->dma_callback(machine, src, dst, count, 1);
8484   }
8585}
8686
87static void dmaop_interrupt(void)
87static OPCODE_HANDLER( dmaop_interrupt )
8888{
8989   if(lsi810.dcmd & 0x100000) {
9090      fatalerror("LSI53C810: INTFLY opcode not implemented");
9191   }
92   lsi810.dsps = FETCH();
92   lsi810.dsps = FETCH(machine);
9393
9494   lsi810.istat |= 0x1;   /* DMA interrupt pending */
9595   lsi810.dstat |= 0x4;   /* SIR (SCRIPTS Interrupt Instruction Received) */
9696
9797   if(intf->irq_callback != NULL) {
98      intf->irq_callback(Machine, 1);
98      intf->irq_callback(machine, 1);
9999   }
100100   lsi810.dma_icount = 0;
101101   lsi810.halted = 1;
102102}
103103
104static void dmaop_block_move(void)
104static OPCODE_HANDLER( dmaop_block_move )
105105{
106106   UINT32 address;
107107   UINT32 count;
108108   INT32 dsps;
109109
110   address = FETCH();
110   address = FETCH(machine);
111111   count = lsi810.dcmd & 0x00ffffff;
112112
113113   // normal indirect
114114   if (lsi810.dcmd & 0x20000000)
115      address = intf->fetch(address);
115      address = intf->fetch(machine, address);
116116
117117   // table indirect
118118   if (lsi810.dcmd & 0x10000000)
r3957r3958
145145   }
146146}
147147
148static void dmaop_select(void)
148static OPCODE_HANDLER( dmaop_select )
149149{
150150   UINT32 operand;
151151
152   operand = FETCH();
152   operand = FETCH(machine);
153153
154154   if (lsi810.scntl0 & 0x01)
155155   {
r3957r3958
170170   }
171171}
172172
173static void dmaop_wait_disconnect(void)
173static OPCODE_HANDLER( dmaop_wait_disconnect )
174174{
175175   UINT32 operand;
176176
177   operand = FETCH();
177   operand = FETCH(machine);
178178
179179   if (lsi810.scntl0 & 0x01)
180180   {
r3957r3958
188188   }
189189}
190190
191static void dmaop_wait_reselect(void)
191static OPCODE_HANDLER( dmaop_wait_reselect )
192192{
193193   UINT32 operand;
194194
195   operand = FETCH();
195   operand = FETCH(machine);
196196
197197   if (lsi810.scntl0 & 0x01)
198198   {
r3957r3958
206206   }
207207}
208208
209static void dmaop_set(void)
209static OPCODE_HANDLER( dmaop_set )
210210{
211211   UINT32 operand;
212212
213   operand = FETCH();
213   operand = FETCH(machine);
214214
215215   /* initiator mode */
216216   if (lsi810.dcmd & 0x8)
r3957r3958
235235   }
236236}
237237
238static void dmaop_clear(void)
238static OPCODE_HANDLER( dmaop_clear )
239239{
240240   UINT32 operand;
241241
242   operand = FETCH();
242   operand = FETCH(machine);
243243
244244   /* initiator mode */
245245   if (lsi810.dcmd & 0x8)
r3957r3958
264264   }
265265}
266266
267static void dmaop_move_from_sfbr(void)
267static OPCODE_HANDLER( dmaop_move_from_sfbr )
268268{
269269   fatalerror("LSI53C810: dmaop_move_from_sfbr not implemented in target mode");
270270}
271271
272static void dmaop_move_to_sfbr(void)
272static OPCODE_HANDLER( dmaop_move_to_sfbr )
273273{
274274   fatalerror("LSI53C810: dmaop_move_to_sfbr not implemented");
275275}
276276
277static void dmaop_read_modify_write(void)
277static OPCODE_HANDLER( dmaop_read_modify_write )
278278{
279279   fatalerror("LSI53C810: dmaop_read_modify_write not implemented");
280280}
r3957r3958
339339   return passed;
340340}
341341
342static UINT32 scripts_get_jump_dest(void)
342static UINT32 scripts_get_jump_dest(running_machine *machine)
343343{
344344   INT32 dsps;
345345   UINT32 dest;
346346
347   dsps = FETCH();
347   dsps = FETCH(machine);
348348
349349   /* relative or absolute addressing? */
350350   if (lsi810.dcmd & 0x00800000)
r3957r3958
357357
358358      logerror("dsps = %x, dsp = %x\n", dsps, lsi810.dsp);
359359      dsps += lsi810.dsp;
360}
360   }
361361
362362   dest = (UINT32)dsps;
363363
r3957r3958
366366   return dest;
367367}
368368
369static void dmaop_jump(void)
369static OPCODE_HANDLER( dmaop_jump )
370370{
371371   if (scripts_compute_branch())
372372{
373      lsi810.dsp = scripts_get_jump_dest();
373      lsi810.dsp = scripts_get_jump_dest(machine);
374374   }
375375   else
376376   {
377      FETCH();   // skip operand to continue on
377      FETCH(machine);   // skip operand to continue on
378378   }
379379}
380380
381static void dmaop_call(void)
381static OPCODE_HANDLER( dmaop_call )
382382{
383383   if (scripts_compute_branch())
384384   {
r3957r3958
386386      lsi810.temp = lsi810.dsp;
387387
388388      // and go
389      lsi810.dsp = scripts_get_jump_dest();
389      lsi810.dsp = scripts_get_jump_dest(machine);
390390   }
391391   else
392392   {
393      FETCH();   // skip operand to continue on
393      FETCH(machine);   // skip operand to continue on
394394   }
395395}
396396
397static void dmaop_return(void)
397static OPCODE_HANDLER( dmaop_return )
398398{
399399   // is this correct?  return only happens if the condition is true?
400400   if (scripts_compute_branch())
r3957r3958
404404   }
405405   else
406406   {
407      FETCH();   // skip operand to continue on
407      FETCH(machine);   // skip operand to continue on
408408   }
409409}
410410
411static void dmaop_store(void)
411static OPCODE_HANDLER( dmaop_store )
412412{
413413   fatalerror("LSI53C810: dmaop_store not implemented");
414414}
415415
416static void dmaop_load(void)
416static OPCODE_HANDLER( dmaop_load )
417417{
418418   fatalerror("LSI53C810: dmaop_load not implemented");
419419}
420420
421421
422422
423static void dma_exec(void)
423static void dma_exec(running_machine *machine)
424424{
425425   lsi810.dma_icount = DMA_MAX_ICOUNT;
426426
r3957r3958
431431      if (DASM_OPCODES)
432432      {
433433         char buf[256];
434         lsi53c810_dasm(buf, lsi810.dsp);
434         lsi53c810_dasm(machine, buf, lsi810.dsp);
435435         logerror("0x%08X: %s\n", lsi810.dsp, buf);
436436      }
437437
438      lsi810.dcmd = FETCH();
438      lsi810.dcmd = FETCH(machine);
439439
440440      op = (lsi810.dcmd >> 24) & 0xff;
441      dma_opcode[op]();
441      dma_opcode[op](machine);
442442
443443      lsi810.dma_icount--;
444444   }
r3957r3958
593593         lsi810.dsp |= data << 24;
594594         lsi810.halted = 0;
595595         if((lsi810.dmode & 0x1) == 0 && !lsi810.halted) {
596            dma_exec();
596            dma_exec(space->machine);
597597         }
598598         break;
599599      case 0x34:      /* SCRATCH A */
r3957r3958
614614         if(lsi810.dcntl & 0x14 && !lsi810.halted)      /* single-step & start DMA */
615615         {
616616            int op;
617            lsi810.dcmd = FETCH();
617            lsi810.dcmd = FETCH(space->machine);
618618            op = (lsi810.dcmd >> 24) & 0xff;
619            dma_opcode[op]();
619            dma_opcode[op](space->machine);
620620
621621            lsi810.istat |= 0x3;   /* DMA interrupt pending */
622622            lsi810.dstat |= 0x8;   /* SSI (Single Step Interrupt) */
r3957r3958
626626         }
627627         else if(lsi810.dcntl & 0x04 && !lsi810.halted)   /* manual start DMA */
628628         {
629            dma_exec();
629            dma_exec(space->machine);
630630         }
631631         break;
632632      case 0x40:      /* SIEN0 */
r3957r3958
656656   }
657657}
658658
659static void add_opcode(UINT8 op, UINT8 mask, void (* handler)(void))
659static void add_opcode(UINT8 op, UINT8 mask, opcode_handler handler)
660660{
661661   int i;
662662   for(i=0; i < 256; i++) {
r3957r3958
666666   }
667667}
668668
669extern void lsi53c810_init(const struct LSI53C810interface *interface)
669void lsi53c810_init(running_machine *machine, const struct LSI53C810interface *interface)
670670{
671671   int i;
672672
r3957r3958
701701   // try to open the devices
702702   for (i = 0; i < interface->scsidevs->devs_present; i++)
703703   {
704      SCSIAllocInstance( interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
704      SCSIAllocInstance( machine, interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
705705   }
706706}
707707
708extern void lsi53c810_exit(const struct LSI53C810interface *interface)
708void lsi53c810_exit(const struct LSI53C810interface *interface)
709709{
710710   int i;
711711
r3957r3958
760760 *
761761 *************************************/
762762
763static UINT32 lsi53c810_dasm_fetch(UINT32 pc)
763static UINT32 lsi53c810_dasm_fetch(running_machine *machine, UINT32 pc)
764764{
765   return intf->fetch(pc);
765   return intf->fetch(machine, pc);
766766}
767767
768unsigned lsi53c810_dasm(char *buf, UINT32 pc)
768unsigned lsi53c810_dasm(running_machine *machine, char *buf, UINT32 pc)
769769{
770770   unsigned result = 0;
771771   const char *op_mnemonic = NULL;
772   UINT32 op = lsi53c810_dasm_fetch(pc);
772   UINT32 op = lsi53c810_dasm_fetch(machine, pc);
773773   UINT32 dest;
774774   int i;
775775
r3957r3958
782782   if ((op & 0xF8000000) == 0x40000000)
783783   {
784784      /* SELECT */
785      dest = lsi53c810_dasm_fetch(pc + 4);
785      dest = lsi53c810_dasm_fetch(machine, pc + 4);
786786
787787      buf += sprintf(buf, "SELECT%s %d, 0x%08X",
788788         (op & 0x01000000) ? " ATN" : "",
r3957r3958
841841         case 0x98000000: op_mnemonic = "INT"; break;
842842      }
843843
844      dest = lsi53c810_dasm_fetch(pc + 4);
844      dest = lsi53c810_dasm_fetch(machine, pc + 4);
845845
846846      if (op & 0x00800000)
847847      {
r3957r3958
887887   else if ((op & 0xE0000000) == 0x00000000)
888888   {
889889      /* MOVE FROM */
890      dest = lsi53c810_dasm_fetch(pc + 4);
890      dest = lsi53c810_dasm_fetch(machine, pc + 4);
891891
892892      buf += sprintf(buf, "MOVE FROM 0x%08X, WHEN %s",
893893         dest, phases[(op >> 24) & 0x07]);
r3957r3958
897897   else if ((op & 0xE0000000) == 0x20000000)
898898   {
899899      /* MOVE PTR */
900      dest = lsi53c810_dasm_fetch(pc + 4);
900      dest = lsi53c810_dasm_fetch(machine, pc + 4);
901901
902902      buf += sprintf(buf, "MOVE 0x%08X, PTR 0x%08X, WHEN %s",
903903         (op & 0x00FFFFFF), dest, phases[(op >> 24) & 0x07]);
src/emu/machine/6850acia.h
r3957r3958
2525#define ACIA6850_STATUS_PE      0x40
2626#define ACIA6850_STATUS_IRQ      0x80
2727
28#define MDRV_ACIA6850_ADD(_tag, _config) \
29   MDRV_DEVICE_ADD(_tag, ACIA6850, 0) \
30   MDRV_DEVICE_CONFIG(_config)
2831
32#define MDRV_ACIA6850_REMOVE(_tag) \
33   MDRV_DEVICE_REMOVE(_tag, ACIA6850)
2934
35
36
3037/***************************************************************************
3138    TYPE DEFINITIONS
3239***************************************************************************/
src/emu/machine/53c810.h
r3957r3958
77{
88   const SCSIConfigTable *scsidevs;         /* SCSI devices */
99   void (*irq_callback)(running_machine *machine, int); /* IRQ callback */
10   void (*dma_callback)(UINT32, UINT32, int, int);   /* DMA callback */
11   UINT32 (*fetch)(UINT32 dsp);
10   void (*dma_callback)(running_machine *machine, UINT32, UINT32, int, int);   /* DMA callback */
11   UINT32 (*fetch)(running_machine *machine, UINT32 dsp);
1212};
1313
14extern void lsi53c810_init(const struct LSI53C810interface *interface);
14extern void lsi53c810_init(running_machine *machine, const struct LSI53C810interface *interface);
1515extern void lsi53c810_exit(const struct LSI53C810interface *interface);
1616
1717extern void lsi53c810_read_data(int bytes, UINT8 *pData);
r3957r3958
2222READ8_HANDLER( lsi53c810_reg_r );
2323WRITE8_HANDLER( lsi53c810_reg_w );
2424
25unsigned lsi53c810_dasm(char *buf, UINT32 pc);
25unsigned lsi53c810_dasm(running_machine *machine, char *buf, UINT32 pc);
2626
2727#endif
src/emu/machine/pcshare.h
r3957r3958
44#define PCCOMMON_KEYBOARD_PC   0
55#define PCCOMMON_KEYBOARD_AT   1
66
7void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int));
7void init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(running_machine *, int));
88
99void pc_keyboard(void);
1010UINT8 pc_keyb_read(void);
src/emu/machine/wd33c93.c
r3957r3958
1212 */
1313
1414#include "driver.h"
15#include "deprecat.h"
1615#include "state.h"
1716#include "wd33c93.h"
1817
r3957r3958
170169#define SRCID_ER               0x80
171170
172171/* command handler definition */
173typedef void (*cmd_handler)(void);
172typedef void (*cmd_handler)(running_machine *machine);
173#define CMD_HANDLER(name) void name(running_machine *machine)
174174
175175#define TEMP_INPUT_LEN   65536
176176#define FIFO_SIZE      12
r3957r3958
292292}
293293
294294/* command handlers */
295static void wd33c93_invalid_cmd( void )
295static CMD_HANDLER( wd33c93_invalid_cmd )
296296{
297   logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", cpuexec_describe_context(Machine), scsi_data.regs[WD_COMMAND] );
297   logerror( "%s:Unknown/Unimplemented SCSI controller command: %02x\n", cpuexec_describe_context(machine), scsi_data.regs[WD_COMMAND] );
298298
299299   /* complete the command */
300300   wd33c93_complete_cmd( CSR_INVALID );
301301}
302302
303static void wd33c93_reset_cmd( void )
303static CMD_HANDLER( wd33c93_reset_cmd )
304304{
305305   int      advanced = 0;
306306
r3957r3958
317317   wd33c93_complete_cmd(advanced ? CSR_RESET_AF : CSR_RESET);
318318}
319319
320static void wd33c93_abort_cmd( void )
320static CMD_HANDLER( wd33c93_abort_cmd )
321321{
322322   /* complete the command */
323323   wd33c93_complete_cmd(CSR_ABORT);
324324}
325325
326static void wd33c93_disconnect_cmd( void )
326static CMD_HANDLER( wd33c93_disconnect_cmd )
327327{
328328   /* complete the command */
329329   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
330330}
331331
332static void wd33c93_select_cmd( void )
332static CMD_HANDLER( wd33c93_select_cmd )
333333{
334334   UINT8   unit = wd33c93_getunit();
335335   UINT8   newstatus;
r3957r3958
353353      }
354354
355355      /* queue up a service request out in the future */
356      timer_set( Machine, ATTOTIME_IN_USEC(50), NULL, 0, wd33c93_service_request );
356      timer_set( machine, ATTOTIME_IN_USEC(50), NULL, 0, wd33c93_service_request );
357357   }
358358   else
359359   {
r3957r3958
365365   wd33c93_complete_cmd(newstatus);
366366}
367367
368static void wd33c93_selectxfer_cmd( void )
368static CMD_HANDLER( wd33c93_selectxfer_cmd )
369369{
370370   UINT8   unit = wd33c93_getunit();
371371   UINT8   newstatus;
r3957r3958
425425         scsi_data.busphase = PHS_MESS_IN;
426426
427427         /* queue up a service request out in the future */
428         timer_set( Machine, ATTOTIME_IN_MSEC(50), NULL, 0, wd33c93_service_request );
428         timer_set( machine, ATTOTIME_IN_MSEC(50), NULL, 0, wd33c93_service_request );
429429      }
430430   }
431431   else
r3957r3958
440440   wd33c93_complete_cmd(newstatus);
441441}
442442
443static void wd33c93_negate_ack( void )
443static CMD_HANDLER( wd33c93_negate_ack )
444444{
445445   logerror( "WD33C93: ACK Negated\n" );
446446
r3957r3958
448448   scsi_data.regs[WD_AUXILIARY_STATUS] &= ~(ASR_CIP | ASR_BSY);
449449}
450450
451static void wd33c93_xferinfo_cmd( void )
451static CMD_HANDLER( wd33c93_xferinfo_cmd )
452452{
453453   /* make the buffer available right away */
454454   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_DBR;
455455   scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
456456
457457   /* the command will be completed once the data is transferred */
458   timer_set( Machine, ATTOTIME_IN_MSEC(1), NULL, 0, wd33c93_deassert_cip );
458   timer_set( machine, ATTOTIME_IN_MSEC(1), NULL, 0, wd33c93_deassert_cip );
459459}
460460
461461/* Command handlers */
r3957r3958
498498};
499499
500500/* Handle pending commands */
501static void wd33c93_command( void )
501static void wd33c93_command( running_machine *machine )
502502{
503503   /* get the command */
504504   UINT8 cmd = scsi_data.regs[WD_COMMAND];
r3957r3958
506506   /* check if its within valid bounds */
507507   if ( (cmd & 0x7F) > WD_CMD_TRANSFER_PAD )
508508   {
509      wd33c93_invalid_cmd();
509      wd33c93_invalid_cmd(machine);
510510      return;
511511   }
512512
513513   /* call the command handler */
514   (*wd33c93_cmds[cmd & 0x7F])();
514   (*wd33c93_cmds[cmd & 0x7F])(machine);
515515}
516516
517517WRITE8_HANDLER(wd33c93_w)
r3957r3958
541541            scsi_data.regs[WD_AUXILIARY_STATUS] |= ASR_CIP;
542542
543543            /* process the command */
544            wd33c93_command();
544            wd33c93_command(space->machine);
545545         }
546546         else if ( scsi_data.sasr == WD_CDB_1 )
547547         {
r3957r3958
792792   // try to open the devices
793793   for (i = 0; i < interface->scsidevs->devs_present; i++)
794794   {
795      SCSIAllocInstance( interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
795      SCSIAllocInstance( machine, interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
796796   }
797797
798798   /* allocate a timer for commands */
src/emu/machine/pic8259.c
r3957r3958
450450      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(pic8259);   break;
451451
452452      /* --- the following bits of info are returned as NULL-terminated strings --- */
453      case DEVINFO_STR_NAME:                  info->s = "Intel PIC8259";               break;
454      case DEVINFO_STR_FAMILY:               info->s = "PIC8259";                  break;
455      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
456      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
457      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams";   break;
453      case DEVINFO_STR_NAME:                  strcpy(info->s, "Intel PIC8259");         break;
454      case DEVINFO_STR_FAMILY:               strcpy(info->s, "PIC8259");               break;
455      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
456      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
457      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MAME and MESS Teams");   break;
458458   }
459459}
460460
src/emu/machine/laserdsc.h
r3957r3958
9393***************************************************************************/
9494
9595#define MDRV_LASERDISC_ADD(_tag, _type, _screen, _sound) \
96   MDRV_DEVICE_ADD(_tag, LASERDISC) \
96   MDRV_DEVICE_ADD(_tag, LASERDISC, 0) \
9797   MDRV_DEVICE_CONFIG_DATA32(laserdisc_config, type, LASERDISC_TYPE_##_type) \
9898   MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, screen, _screen) \
9999   MDRV_DEVICE_CONFIG_DATAPTR(laserdisc_config, sound, _sound) \
src/emu/machine/pic8259.h
r3957r3958
2828***************************************************************************/
2929
3030#define MDRV_PIC8259_ADD(_tag, _intrf) \
31   MDRV_DEVICE_ADD(_tag, PIC8259) \
31   MDRV_DEVICE_ADD(_tag, PIC8259, 0) \
3232   MDRV_DEVICE_CONFIG(_intrf)
3333
3434
src/emu/machine/ldcore.c
r3957r3958
146146static void read_track_data(laserdisc_state *ld);
147147static void process_track_data(const device_config *device);
148148static CUSTOM_START( custom_start );
149static void custom_stream_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
149static STREAM_UPDATE( custom_stream_callback );
150150static void configuration_load(running_machine *machine, int config_type, xml_data_node *parentnode);
151151static void configuration_save(running_machine *machine, int config_type, xml_data_node *parentnode);
152152
r3957r3958
957957    for laserdiscs
958958-------------------------------------------------*/
959959
960static void custom_stream_callback(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
960static STREAM_UPDATE( custom_stream_callback )
961961{
962962   sound_token *token = param;
963963   laserdisc_state *ld = token->ld;
r3957r3958
16341634      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(laserdisc);         break;
16351635
16361636      /* --- the following bits of info are returned as NULL-terminated strings --- */
1637      case DEVINFO_STR_NAME:               info->s = (intf != NULL) ? intf->name : "Unknown Laserdisc Player";   break;
1638      case DEVINFO_STR_FAMILY:            info->s = "Laserdisc Player";                  break;
1639      case DEVINFO_STR_VERSION:            info->s = "1.0";                           break;
1640      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                           break;
1641      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1637      case DEVINFO_STR_NAME:               strcpy(info->s, (intf != NULL) ? intf->name : "Unknown Laserdisc Player");   break;
1638      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Laserdisc Player");            break;
1639      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                        break;
1640      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                     break;
1641      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
16421642   }
16431643}
src/emu/machine/x2212.c
r3957r3958
178178      case DEVINFO_FCT_NVRAM:               info->nvram = DEVICE_NVRAM_NAME(x2212); break;
179179
180180      /* --- the following bits of info are returned as NULL-terminated strings --- */
181      case DEVINFO_STR_NAME:               info->s = "X2212"; break;
182      case DEVINFO_STR_FAMILY:            info->s = "EEPROM"; break;
183      case DEVINFO_STR_VERSION:            info->s = "1.0"; break;
184      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__; break;
185      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
181      case DEVINFO_STR_NAME:               strcpy(info->s, "X2212"); break;
182      case DEVINFO_STR_FAMILY:            strcpy(info->s, "EEPROM"); break;
183      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0"); break;
184      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__); break;
185      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
186186   }
187187}
src/emu/machine/x2212.h
r3957r3958
1717#define X2212 DEVICE_GET_INFO_NAME(x2212)
1818DEVICE_GET_INFO(x2212);
1919
20#define MDRV_X2212_ADD(_tag) \
21   MDRV_DEVICE_ADD(_tag, X2212, 0)
22
23#define MDRV_X2212_REMOVE(_tag) \
24   MDRV_DEVICE_REMOVE(_tag, X2212)
25
26
2027extern void x2212_write( const device_config *device, int offset, int data );
2128extern int x2212_read( const device_config *device, int offset );
2229extern void x2212_store( const device_config *device, int store );
src/emu/machine/at28c16.c
r3957r3958
124124   /* validate some basic stuff */
125125   assert(device != NULL);
126126//  assert(device->static_config != NULL);
127   assert(device->inline_config == NULL);
127//  assert(device->inline_config == NULL);
128128   assert(device->machine != NULL);
129129   assert(device->machine->config != NULL);
130130
r3957r3958
134134   c->oe_12v = 0;
135135   c->last_write = -1;
136136   c->write_timer = timer_alloc(device->machine,  write_finished, c );
137   c->default_data = device->region;
137138
138   config = device->static_config;
139   if( config != NULL && config->data != NULL )
140   {
141      c->default_data = memory_region( device->machine, config->data );
142   }
143
144   if( config != NULL && config->id != NULL )
145   {
139   config = device->inline_config;
140   if (config->id != NULL)
146141      c->default_id = memory_region( device->machine, config->id );
147   }
148142
149143   /* create the name for save states */
150144   state_save_register_device_item_pointer( device, 0, c->data, SIZE_DATA );
r3957r3958
225219   {
226220      /* --- the following bits of info are returned as 64-bit signed integers --- */
227221      case DEVINFO_INT_TOKEN_BYTES:         info->i = sizeof(at28c16_state); break;
228      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = 0; break; // sizeof(at28c16_config)
222      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = sizeof(at28c16_config); break;
229223      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_PERIPHERAL; break;
230224
231225      /* --- the following bits of info are returned as pointers to data or functions --- */
r3957r3958
236230      case DEVINFO_FCT_NVRAM:               info->nvram = DEVICE_NVRAM_NAME(at28c16); break;
237231
238232      /* --- the following bits of info are returned as NULL-terminated strings --- */
239      case DEVINFO_STR_NAME:               info->s = "AT28C16"; break;
240      case DEVINFO_STR_FAMILY:            info->s = "EEPROM"; break;
241      case DEVINFO_STR_VERSION:            info->s = "1.0"; break;
242      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__; break;
243      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
233      case DEVINFO_STR_NAME:               strcpy(info->s, "AT28C16"); break;
234      case DEVINFO_STR_FAMILY:            strcpy(info->s, "EEPROM"); break;
235      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0"); break;
236      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__); break;
237      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
244238   }
245239}
src/emu/machine/at28c16.h
r3957r3958
1111typedef struct _at28c16_config at28c16_config;
1212struct _at28c16_config
1313{
14   const char *data;
1514   const char *id;
1615};
1716
1817#define AT28C16 DEVICE_GET_INFO_NAME(at28c16)
1918DEVICE_GET_INFO(at28c16);
2019
20#define MDRV_AT28C16_ADD(_tag, _id) \
21   MDRV_DEVICE_ADD(_tag, AT28C16, 0) \
22   MDRV_DEVICE_CONFIG_DATAPTR(at28c16_config, id, _id)
23
24#define MDRV_AT28C16_REMOVE(_tag) \
25   MDRV_DEVICE_REMOVE(_tag, AT28C16)
26
27
2128extern void at28c16_a9_12v( const device_config *device, int a9_12v );
2229extern void at28c16_oe_12v( const device_config *device, int a9_12v );
2330
src/emu/machine/scsi.c
r3957r3958
11#include "scsi.h"
22
3void SCSIAllocInstance( const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion )
3void SCSIAllocInstance( running_machine *machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion )
44{
55   SCSIAllocInstanceParams params;
66   params.instance = NULL;
77   params.diskregion = diskregion;
8   params.machine = machine;
89   scsiClass->dispatch( SCSIOP_ALLOC_INSTANCE, (void *)scsiClass, 0, &params );
910   *instance = params.instance;
1011}
r3957r3958
102103   return scsiClass->baseClass->dispatch( operation, file, intparm, ptrparm );
103104}
104105
105SCSIInstance *SCSIMalloc( const SCSIClass *scsiClass )
106SCSIInstance *SCSIMalloc( running_machine *machine, const SCSIClass *scsiClass )
106107{
107108   SCSIInstance *scsiInstance = (SCSIInstance *) malloc_or_die( SCSISizeof( scsiClass ) );
108109   scsiInstance->scsiClass = scsiClass;
110   scsiInstance->machine = machine;
109111   return scsiInstance;
110112}
111113
src/emu/machine/scsi.h
r3957r3958
2222typedef struct
2323{
2424   const SCSIClass *scsiClass;
25   running_machine *machine;
2526} SCSIInstance;
2627
2728typedef struct
2829{
2930   SCSIInstance *instance;
3031   const char *diskregion;
32   running_machine *machine;
3133} SCSIAllocInstanceParams;
3234
3335// commands accepted by a SCSI device's dispatch handler
r3957r3958
8385#define SCSI_PHASE_MESSAGE_OUT ( 6 )
8486#define SCSI_PHASE_MESSAGE_IN ( 7 )
8587
86extern void SCSIAllocInstance( const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion );
88extern void SCSIAllocInstance( running_machine *machine, const SCSIClass *scsiClass, SCSIInstance **instance, const char *diskregion );
8789extern void SCSIDeleteInstance( SCSIInstance *instance );
8890extern void SCSISetDevice( SCSIInstance *instance, void *device );
8991extern void SCSIGetDevice( SCSIInstance *instance, void **device );
r3957r3958
9698extern void SCSISetPhase( SCSIInstance *instance, int phase );
9799extern void SCSIGetPhase( SCSIInstance *instance, int *phase );
98100
99extern SCSIInstance *SCSIMalloc( const SCSIClass *scsiClass );
101extern SCSIInstance *SCSIMalloc( running_machine *machine, const SCSIClass *scsiClass );
100102extern int SCSIBase( const SCSIClass *scsiClass, int operation, void *file, INT64 intparm, UINT8 *ptrparm );
101103extern void *SCSIThis( const SCSIClass *scsiClass, SCSIInstance *instance );
102104extern int SCSISizeof( const SCSIClass *scsiClass );
src/emu/machine/8042kbdc.c
r3957r3958
430430
431431
432432
433static TIMER_CALLBACK(at_8042_receive_timer)
434{
435   at_8042_receive(machine, param);
436}
437
438
439
440433WRITE8_HANDLER(kbdc8042_8_w)
441434{
442435   switch (offset) {
r3957r3958
516509         at_8042_receive(space->machine, PS2_MOUSE_ON ? 0x00 : 0xff);
517510         break;
518511      case 0xaa:   /* selftest */
519         if (space->machine->config->cpu[0].type == CPU_I486)
520            timer_set(space->machine, ATTOTIME_IN_MSEC(10), NULL, 0x55, at_8042_receive_timer); /* HACK */
521         else
522            at_8042_receive(space->machine, 0x55);
512         at_8042_receive(space->machine, 0x55);
523513         break;
524514      case 0xab:   /* test keyboard */
525515         at_8042_receive(space->machine, KEYBOARD_ON ? 0x00 : 0xff);
src/emu/machine/latch8.c
r3957r3958
260260      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(latch8);break;
261261
262262      /* --- the following bits of info are returned as NULL-terminated strings --- */
263      case DEVINFO_STR_NAME:                     info->s = "8 bit latch";            break;
264      case DEVINFO_STR_FAMILY:                  info->s = "Latches";               break;
265      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
266      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
267      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
263      case DEVINFO_STR_NAME:                     strcpy(info->s, "8 bit latch");         break;
264      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Latches");            break;
265      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
266      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
267      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
268268   }
269269}
src/emu/machine/8237dma.c
r3957r3958
174174      }
175175
176176      /* set the halt line */
177      if (dma8237->intf && dma8237->intf->cpunum >= 0)
177      if (dma8237->intf && dma8237->intf->cputag != NULL)
178178      {
179         cpu_set_input_line(device->machine->cpu[dma8237->intf->cpunum], INPUT_LINE_HALT,
179         cputag_set_input_line(device->machine, dma8237->intf->cputag, INPUT_LINE_HALT,
180180            pending_transfer ? ASSERT_LINE : CLEAR_LINE);
181181      }
182182
r3957r3958
440440      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(dma8237);   break;
441441
442442      /* --- the following bits of info are returned as NULL-terminated strings --- */
443      case DEVINFO_STR_NAME:                  info->s = "Intel DMA8237";               break;
444      case DEVINFO_STR_FAMILY:               info->s = "DMA8237";                  break;
445      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
446      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
447      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams";   break;
443      case DEVINFO_STR_NAME:                  strcpy(info->s, "Intel DMA8237");         break;
444      case DEVINFO_STR_FAMILY:               strcpy(info->s, "DMA8237");               break;
445      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
446      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
447      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MAME and MESS Teams");   break;
448448   }
449449}
450450
src/emu/machine/cdp1852.c
r3957r3958
9393{
9494   cdp1852_t *cdp1852 = get_safe_token(device);
9595
96   if (cdp1852->intf->mode == CDP1852_MODE_INPUT && cdp1852->intf->clock == 0)
96   if (cdp1852->intf->mode == CDP1852_MODE_INPUT && device->clock == 0)
9797   {
9898      // input data into register
9999      cdp1852->data = cdp1852->intf->data_r(device);
r3957r3958
135135   }
136136   else
137137   {
138      assert(cdp1852->intf->clock > 0);
138      assert(device->clock > 0);
139139      assert(cdp1852->intf->data_w != NULL);
140140   }
141141
142142   /* create the timers */
143   if (cdp1852->intf->clock > 0)
143   if (device->clock > 0)
144144   {
145145      cdp1852->scan_timer = timer_alloc(device->machine, cdp1852_scan_tick, (void *)device);
146      timer_adjust_periodic(cdp1852->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cdp1852->intf->clock));
146      timer_adjust_periodic(cdp1852->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock));
147147   }
148148
149149   /* register for state saving */
r3957r3958
202202      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1852);   break;
203203
204204      /* --- the following bits of info are returned as NULL-terminated strings --- */
205      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1852";               break;
206      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
207      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
208      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
209      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
205      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1852");            break;
206      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");            break;
207      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
208      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
209      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
210210   }
211211}
src/emu/machine/latch8.h
r3957r3958
4949
5050/* add device */
5151#define MDRV_LATCH8_ADD(_tag) \
52   MDRV_DEVICE_ADD(_tag, LATCH8)
52   MDRV_DEVICE_ADD(_tag, LATCH8, 0)
5353
5454/* Bit mask specifying bits to be masked *out* */
5555#define MDRV_LATCH8_MASKOUT(_maskout) \
src/emu/machine/8237dma.h
r3957r3958
2424struct dma8237_interface
2525{
2626   /* CPU to halt when DMA is active */
27   int cpunum;
27   const char *cputag;
2828
2929   /* speed of DMA accesses (per byte) */
3030   double bus_speed;
r3957r3958
4747***************************************************************************/
4848
4949#define MDRV_DMA8237_ADD(_tag, _intrf) \
50   MDRV_DEVICE_ADD(_tag, DMA8237) \
50   MDRV_DEVICE_ADD(_tag, DMA8237, 0) \
5151   MDRV_DEVICE_CONFIG(_intrf)
5252
5353
src/emu/machine/cdp1852.h
r3957r3958
3838
3939#define CDP1852      DEVICE_GET_INFO_NAME(cdp1852)
4040
41#define MDRV_CDP1852_ADD(_tag, _clock, _config) \
42   MDRV_DEVICE_ADD(_tag, CDP1852, _clock) \
43   MDRV_DEVICE_CONFIG(_config)
44
45#define MDRV_CDP1852_REMOVE(_tag) \
46   MDRV_DEVICE_REMOVE(_tag, CDP1852)
47
48
4149typedef enum _cdp1852_mode cdp1852_mode;
4250enum _cdp1852_mode {
4351   CDP1852_MODE_INPUT = 0,
r3957r3958
4856typedef struct _cdp1852_interface cdp1852_interface;
4957struct _cdp1852_interface
5058{
51   int clock;               /* the clock (pin 1) of the chip */
52
5359   int mode;               /* operation mode */
5460
5561   /* this gets called for every external data read */
src/emu/machine/z80sio.c
r3957r3958
178178{
179179   sio_channel   chan[2];         /* 2 channels */
180180   UINT8      int_state[8];      /* interrupt states */
181   UINT32      clock;            /* clock value */
182181
183182   void (*irq_cb)(const device_config *device, int state);
184183   write8_device_func dtr_changed_cb;
r3957r3958
786785   const z80sio_interface *intf = device->static_config;
787786   astring *tempstring = astring_alloc();
788787   z80sio *sio = get_safe_token(device);
789   const device_config *cpu = NULL;
790788   void *ptr = (void *)device;
791789
792   if (intf->cpu != NULL)
793   {
794      cpu = cputag_get_cpu(device->machine, device_inherit_tag(tempstring, device->tag, intf->cpu));
795      if (cpu == NULL)
796         fatalerror("Z80SIO:Unable to find CPU %s\n", device_inherit_tag(tempstring, device->tag, intf->cpu));
797   }
798   if (cpu != NULL)
799      sio->clock = cpu_get_clock(cpu);
800   else
801      sio->clock = intf->baseclock;
802
803790   sio->chan[0].receive_timer = timer_alloc(device->machine, serial_callback, ptr);
804791   sio->chan[1].receive_timer = timer_alloc(device->machine, serial_callback, ptr);
805792
r3957r3958
853840      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80sio_irq_reti;      break;
854841
855842      /* --- the following bits of info are returned as NULL-terminated strings --- */
856      case DEVINFO_STR_NAME:                     info->s = "Zilog Z80 SIO";            break;
857      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                  break;
858      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
859      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
860      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
843      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 SIO");      break;
844      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");               break;
845      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
846      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
847      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
861848   }
862849}
863850
src/emu/machine/z80sio.h
r3957r3958
1818typedef struct _z80sio_interface z80sio_interface;
1919struct _z80sio_interface
2020{
21   const char *cpu;                  /* CPU whose clock we use for our base */
22   int baseclock;
2321   void (*irq_cb)(const device_config *device, int state);
2422   write8_device_func dtr_changed_cb;
2523   write8_device_func rts_changed_cb;
r3957r3958
3432    DEVICE CONFIGURATION MACROS
3533***************************************************************************/
3634
37#define MDRV_Z80SIO_ADD(_tag, _intrf) \
38   MDRV_DEVICE_ADD(_tag, Z80SIO) \
35#define MDRV_Z80SIO_ADD(_tag, _clock, _intrf) \
36   MDRV_DEVICE_ADD(_tag, Z80SIO, _clock) \
3937   MDRV_DEVICE_CONFIG(_intrf)
4038
4139#define MDRV_Z80SIO_REMOVE(_tag) \
src/emu/machine/microtch.c
r3957r3958
2727   int         last_touch_state;
2828   int         last_x;
2929   int         last_y;
30   void      (*tx_callback)(UINT8 data);
31   int         (*touch_callback)(int *touch_x, int *touch_y);
30   microtouch_tx_func   tx_callback;
31   microtouch_touch_func   touch_callback;
3232} microtouch;
3333
3434
r3957r3958
6464{
6565   if ( microtouch.tx_buffer_ptr < microtouch.tx_buffer_num )
6666   {
67      microtouch.tx_callback( microtouch.tx_buffer[microtouch.tx_buffer_ptr++] );
67      microtouch.tx_callback( machine, microtouch.tx_buffer[microtouch.tx_buffer_ptr++] );
6868      if ( microtouch.tx_buffer_ptr == microtouch.tx_buffer_num )
6969      {
7070         microtouch.tx_buffer_ptr = microtouch.tx_buffer_num = 0;
r3957r3958
8787      int ty = input_port_read(machine, "TOUCH_Y");
8888
8989      if ( microtouch.touch_callback == NULL ||
90          microtouch.touch_callback( &tx, &ty ) != 0 )
90          microtouch.touch_callback( machine, &tx, &ty ) != 0 )
9191      {
9292         ty = 0x4000 - ty;
9393
r3957r3958
107107   }
108108};
109109
110void microtouch_init(running_machine *machine, void (*tx_cb)(UINT8 data),
111                     int (*touch_cb)(int *touch_x, int *touch_y))
110void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb)
112111{
113112   memset(&microtouch, 0, sizeof(microtouch));
114113
src/emu/machine/z80ctc.c
r3957r3958
9090struct _z80ctc
9191{
9292   UINT8            vector;            /* interrupt vector */
93   UINT32            clock;            /* system clock */
9493   attotime         period16;         /* 16/system clock */
9594   attotime         period256;         /* 256/system clock */
9695   void (*intr)(const device_config *device, int which);   /* interrupt callback */
r3957r3958
465464   const z80ctc_interface *intf = device->static_config;
466465   astring *tempstring = astring_alloc();
467466   z80ctc *ctc = get_safe_token(device);
468   const device_config *cpu = NULL;
469467   int ch;
470468
471   if (intf->cpu != NULL)
472   {
473      cpu = cputag_get_cpu(device->machine, device_inherit_tag(tempstring, device->tag, intf->cpu));
474      if (cpu == NULL)
475         fatalerror("Z80CTC:Unable to find CPU %s\n", device_inherit_tag(tempstring, device->tag, intf->cpu));
476   }
477   if (cpu != NULL)
478      ctc->clock = cpu_get_clock(cpu);
479   else
480      ctc->clock = intf->baseclock;
481   ctc->period16 = attotime_mul(ATTOTIME_IN_HZ(ctc->clock), 16);
482   ctc->period256 = attotime_mul(ATTOTIME_IN_HZ(ctc->clock), 256);
469   ctc->period16 = attotime_mul(ATTOTIME_IN_HZ(device->clock), 16);
470   ctc->period256 = attotime_mul(ATTOTIME_IN_HZ(device->clock), 256);
483471   for (ch = 0; ch < 4; ch++)
484472   {
485473      ctc_channel *channel = &ctc->channel[ch];
r3957r3958
557545      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80ctc_irq_reti;      break;
558546
559547      /* --- the following bits of info are returned as NULL-terminated strings --- */
560      case DEVINFO_STR_NAME:                     info->s = "Zilog Z80 CTC";            break;
561      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                  break;
562      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
563      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
564      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
548      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 CTC");      break;
549      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");               break;
550      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
551      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
552      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
565553   }
566554}
567555
src/emu/machine/pci.c
r3957r3958
274274      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(pci_bus);break;
275275
276276      /* --- the following bits of info are returned as NULL-terminated strings --- */
277      case DEVINFO_STR_NAME:               info->s = "PCI Bus";               break;
278      case DEVINFO_STR_FAMILY:            info->s = "Peripherial Bus";         break;
279      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
280      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
281      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
277      case DEVINFO_STR_NAME:               strcpy(info->s, "PCI Bus");            break;
278      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Peripherial Bus");      break;
279      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
280      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
281      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
282282   }
283283}
src/emu/machine/mb87078.c
r3957r3958
7979}
8080
8181
82static void gain_recalc(int which)
82static void gain_recalc(running_machine *machine, int which)
8383{
8484   struct MB87078 *c = chip + which;
8585   int i;
r3957r3958
9090      c->gain[i] = calc_gain_index(c->latch[i], c->latch[4+i]);
9191      if (old_index != c->gain[i])
9292      {
93         (*c->intf->gain_changed_cb)(i, MB87078_gain_percent[c->gain[i]] );
93         (*c->intf->gain_changed_cb)(machine, i, MB87078_gain_percent[c->gain[i]] );
9494      }
9595   }
9696}
9797
9898
99void MB87078_start(int which, const struct MB87078interface *intf)
99void MB87078_start(running_machine *machine, int which, const struct MB87078interface *intf)
100100{
101101   if (which >= MAX_MB87078) return;
102102
103103   chip[which].intf = intf;
104104
105105   /* reset chip */
106   MB87078_reset_comp_w(which,0);
107   MB87078_reset_comp_w(which,1);
106   MB87078_reset_comp_w(machine,which,0);
107   MB87078_reset_comp_w(machine,which,1);
108108}
109109
110110
r3957r3958
115115}
116116
117117
118void MB87078_reset_comp_w(int which, int level)
118void MB87078_reset_comp_w(running_machine *machine, int which, int level)
119119{
120120   struct MB87078 *c = chip + which;
121121
r3957r3958
133133      c->latch[6] = 0x2 | 0x4;
134134      c->latch[7] = 0x3 | 0x4;
135135   }
136   gain_recalc(which);
136   gain_recalc(machine, which);
137137}
138138
139139
140void MB87078_data_w(int which, int data, int dsel)
140void MB87078_data_w(running_machine *machine, int which, int data, int dsel)
141141{
142142   struct MB87078 *c = chip + which;
143143
r3957r3958
152152      c->channel_latch = data & 3;
153153      c->latch[4+c->channel_latch] = data & 0x1f; //always zero bit 5
154154   }
155   gain_recalc(which);
155   gain_recalc(machine, which);
156156}
157157
158158
src/emu/machine/microtch.h
r3957r3958
33
44INPUT_PORTS_EXTERN(microtouch);
55
6void microtouch_init(running_machine *machine, void (*tx_cb)(UINT8 data), int (*touch_cb)(int *touch_x, int *touch_y));
6typedef void (*microtouch_tx_func)(running_machine *machine, UINT8 data);
7typedef int (*microtouch_touch_func)(running_machine *machine, int *touch_x, int *touch_y);
8
9void microtouch_init(running_machine *machine, microtouch_tx_func tx_cb, microtouch_touch_func touch_cb);
710void microtouch_rx(int count, UINT8* data);
811
912#endif //_MICROTOUCH_H
src/emu/machine/pit8253.c
r3957r3958
11421142      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(pit8253);   break;
11431143
11441144      /* --- the following bits of info are returned as NULL-terminated strings --- */
1145      case DEVINFO_STR_NAME:                  info->s = "Intel PIT8253";               break;
1146      case DEVINFO_STR_FAMILY:               info->s = "PIT8253";                  break;
1147      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
1148      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
1149      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MAME and MESS Teams"; break;
1145      case DEVINFO_STR_NAME:                  strcpy(info->s, "Intel PIT8253");         break;
1146      case DEVINFO_STR_FAMILY:               strcpy(info->s, "PIT8253");               break;
1147      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
1148      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
1149      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MAME and MESS Teams"); break;
11501150   }
11511151}
11521152
r3957r3958
11541154DEVICE_GET_INFO( pit8254 ) {
11551155   switch ( state ) {
11561156      /* --- the following bits of info are returned as 64-bit signed integers --- */
1157      case DEVINFO_STR_NAME:                  info->s = "Intel PIT8254";               break;
1157      case DEVINFO_STR_NAME:                  strcpy(info->s, "Intel PIT8254");         break;
11581158
11591159      /* --- the following bits of info are returned as pointers to data or functions --- */
11601160      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(pit8254);   break;
src/emu/machine/z80ctc.h
r3957r3958
2929typedef struct _z80ctc_interface z80ctc_interface;
3030struct _z80ctc_interface
3131{
32   const char *cpu;                  /* CPU whose clock we use for our base */
33   int baseclock;                     /* timer clock */
3432   int notimer;                     /* timer disablers */
3533   void (*intr)(const device_config *device, int which); /* callback when change interrupt status */
3634   write8_device_func zc0;               /* ZC/TO0 callback */
r3957r3958
4442    DEVICE CONFIGURATION MACROS
4543***************************************************************************/
4644
47#define MDRV_Z80CTC_ADD(_tag, _intrf) \
48   MDRV_DEVICE_ADD(_tag, Z80CTC) \
45#define MDRV_Z80CTC_ADD(_tag, _clock, _intrf) \
46   MDRV_DEVICE_ADD(_tag, Z80CTC, _clock) \
4947   MDRV_DEVICE_CONFIG(_intrf)
5048
5149#define MDRV_Z80CTC_REMOVE(_tag) \
src/emu/machine/pci.h
r3957r3958
4040***************************************************************************/
4141
4242#define MDRV_PCI_BUS_ADD(_tag, _busnum) \
43   MDRV_DEVICE_ADD(_tag, PCI_BUS) \
43   MDRV_DEVICE_ADD(_tag, PCI_BUS, 0) \
4444   MDRV_DEVICE_CONFIG_DATA32(pci_bus_config, busnum, _busnum)
4545
4646#define MDRV_PCI_BUS_DEVICE(_devnum, _devtype, _devtag, _configread, _configwrite) \
src/emu/machine/mb87078.h
r3957r3958
7474
7575/* The interface structure */
7676struct MB87078interface {
77   void (*gain_changed_cb)(int channel, int percent /*, float decibels*/);
77   void (*gain_changed_cb)(running_machine *machine, int channel, int percent /*, float decibels*/);
7878};
7979
8080
8181void MB87078_stop(void);
82void MB87078_start(int which, const struct MB87078interface *intf);
82void MB87078_start(running_machine *machine, int which, const struct MB87078interface *intf);
8383
84void MB87078_data_w(int which, int data, int dsel);
85void MB87078_reset_comp_w(int which, int level);
84void MB87078_data_w(running_machine *machine, int which, int data, int dsel);
85void MB87078_reset_comp_w(running_machine *machine, int which, int level);
8686
8787
8888/* MB87078_gain_decibel_r will return 'channel' gain on chip 'which'.
src/emu/machine/pit8253.h
r3957r3958
3434***************************************************************************/
3535
3636#define MDRV_PIT8253_ADD(_tag, _intrf) \
37   MDRV_DEVICE_ADD(_tag, PIT8253) \
37   MDRV_DEVICE_ADD(_tag, PIT8253, 0) \
3838   MDRV_DEVICE_CONFIG(_intrf)
3939
4040
4141#define MDRV_PIT8254_ADD(_tag, _intrf) \
42   MDRV_DEVICE_ADD(_tag, PIT8254) \
42   MDRV_DEVICE_ADD(_tag, PIT8254, 0) \
4343   MDRV_DEVICE_CONFIG(_intrf)
4444
4545
src/emu/machine/ldv1000.c
r3957r3958
1919#include "ldcore.h"
2020#include "machine/8255ppi.h"
2121#include "machine/z80ctc.h"
22#include "cpu/z80/z80.h"
2223#include "cpu/z80/z80daisy.h"
2324
2425
r3957r3958
113114
114115
115116/***************************************************************************
116    INLINE FUNCTIONS
117***************************************************************************/
118
119/*-------------------------------------------------
120    find_ldv1000 - find our device; assumes there
121    is only one
122-------------------------------------------------*/
123
124INLINE laserdisc_state *find_ldv1000(running_machine *machine)
125{
126   return ldcore_get_safe_token(device_list_first(machine->config->devicelist, LASERDISC));
127}
128
129
130
131/***************************************************************************
132117    LD-V1000 ROM AND MACHINE INTERFACES
133118***************************************************************************/
134119
r3957r3958
165150
166151static const z80ctc_interface ctcintf =
167152{
168   "ldv1000",
169153   0,
170   0,
171154   ctc_interrupt
172155};
173156
r3957r3958
185168   MDRV_CPU_PROGRAM_MAP(ldv1000_map,0)
186169   MDRV_CPU_IO_MAP(ldv1000_portmap,0)
187170
188   MDRV_Z80CTC_ADD("ldvctc", ctcintf)
171   MDRV_Z80CTC_ADD("ldvctc", XTAL_5MHz/2 /* same as "ldv1000" */, ctcintf)
189172   MDRV_PPI8255_ADD("ldvppi0", ppi0intf)
190173   MDRV_PPI8255_ADD("ldvppi1", ppi1intf)
191174   MDRV_TIMER_ADD("multitimer", multijump_timer)
r3957r3958
247230   memset(player, 0, sizeof(*player));
248231
249232   /* find our devices */
250   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device->tag, "ldv1000"));
251   player->ctc = devtag_get_device(ld->device->machine, Z80CTC, device_build_tag(tempstring, ld->device->tag, "ldvctc"));
252   player->multitimer = devtag_get_device(ld->device->machine, TIMER, device_build_tag(tempstring, ld->device->tag, "multitimer"));
233   player->cpu = cputag_get_cpu(ld->device->machine, device_build_tag(tempstring, ld->device, "ldv1000"));
234   player->ctc = devtag_get_device(ld->device->machine, Z80CTC, device_build_tag(tempstring, ld->device, "ldvctc"));
235   player->multitimer = devtag_get_device(ld->device->machine, TIMER, device_build_tag(tempstring, ld->device, "multitimer"));
253236   timer_device_set_ptr(player->multitimer, ld);
254237   astring_free(tempstring);
255238}
r3957r3958
436419
437420static void ctc_interrupt(const device_config *device, int state)
438421{
439   laserdisc_state *ld = find_ldv1000(device->machine);
422   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
440423   cpu_set_input_line(ld->player->cpu, 0, state ? ASSERT_LINE : CLEAR_LINE);
441424}
442425
r3957r3958
454437        Display is 6-bit
455438        Decoder is 4-bit
456439    */
457   laserdisc_state *ld = find_ldv1000(space->machine);
440   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
458441   ldplayer_data *player = ld->player;
459442
460443   /* writes to offset 0 select the target for reads/writes of actual data */
r3957r3958
481464
482465static READ8_HANDLER( decoder_display_port_r )
483466{
484   laserdisc_state *ld = find_ldv1000(space->machine);
467   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
485468   ldplayer_data *player = ld->player;
486469   UINT8 result = 0;
487470
r3957r3958
506489
507490static READ8_HANDLER( controller_r )
508491{
509   laserdisc_state *ld = find_ldv1000(space->machine);
492   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
510493
511494   /* note that this is a cheesy implementation; the real thing relies on exquisite timing */
512495   UINT8 result = ld->player->command ^ 0xff;
r3957r3958
521504
522505static WRITE8_HANDLER( controller_w )
523506{
524   laserdisc_state *ld = find_ldv1000(space->machine);
507   laserdisc_state *ld = ldcore_get_safe_token(space->cpu->owner);
525508   if (LOG_STATUS_CHANGES && data != ld->player->status)
526509      printf("%04X:CONTROLLER.W=%02X\n", cpu_get_pc(space->cpu), data);
527510   ld->player->status = data;
r3957r3958
535518
536519static WRITE8_DEVICE_HANDLER( ppi0_porta_w )
537520{
538   laserdisc_state *ld = find_ldv1000(device->machine);
521   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
539522   ld->player->counter_start = data;
540523   if (LOG_PORT_IO)
541524      printf("%s:PORTA.0=%02X\n", cpuexec_describe_context(device->machine), data);
r3957r3958
549532
550533static READ8_DEVICE_HANDLER( ppi0_portb_r )
551534{
552   laserdisc_state *ld = find_ldv1000(device->machine);
535   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
553536   return ld->player->counter;
554537}
555538
r3957r3958
567550        $40 = TRKG LOOP (N24-1)
568551        $80 = DUMP (N20-1) -- code reads the state and waits for it to change
569552    */
570   laserdisc_state *ld = find_ldv1000(device->machine);
553   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
571554   ldplayer_data *player = ld->player;
572555   UINT8 result = 0x00;
573556
r3957r3958
593576        $04 = SCAN MODE
594577        $08 = n/c
595578    */
596   laserdisc_state *ld = find_ldv1000(device->machine);
579   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
597580   ldplayer_data *player = ld->player;
598581   UINT8 prev = player->portc0;
599582
r3957r3958
635618        $40 = /INT LOCK
636619        $80 = 8 INCH CHK
637620    */
638   laserdisc_state *ld = find_ldv1000(device->machine);
621   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
639622   ldplayer_data *player = ld->player;
640623   slider_position sliderpos = ldcore_get_slider_position(ld);
641624   UINT8 focus_on = !(player->portb1 & 0x01);
r3957r3958
688671        $40 = /LASER ON
689672        $80 = /SYNC ST0
690673    */
691   laserdisc_state *ld = find_ldv1000(device->machine);
674   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
692675   ldplayer_data *player = ld->player;
693676   UINT8 prev = player->portb1;
694677   int direction;
r3957r3958
745728        $40 = SIZE 8/12
746729        $80 = /LED CAV
747730    */
748   laserdisc_state *ld = find_ldv1000(device->machine);
731   laserdisc_state *ld = ldcore_get_safe_token(device->owner);
749732   ldplayer_data *player = ld->player;
750733   UINT8 prev = player->portc1;
751734
src/emu/machine/rtc65271.c
r3957r3958
3232
3333static struct
3434{
35   running_machine *machine;
36
3537   /* 64 8-bit registers (10 clock registers, 4 control/status registers, and
3638    50 bytes of user RAM) */
3739   UINT8 regs[64];
r3957r3958
4951   int SQW_internal_state;
5052
5153   /* callback called when interrupt pin state changes (may be NULL) */
52   void (*interrupt_callback)(int state);
54   void (*interrupt_callback)(running_machine *machine, int state);
5355} rtc;
5456
5557enum
r3957r3958
310312    interrupt_callback: callback called when interrupt pin state changes (may
311313        be NULL)
312314*/
313void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(int state))
315void rtc65271_init(running_machine *machine, UINT8 *xram, void (*interrupt_callback)(running_machine *machine, int state))
314316{
315317   memset(&rtc, 0, sizeof(rtc));
316318
319   rtc.machine = machine;
317320   rtc.xram = xram;
318321
319322   rtc.update_timer = timer_alloc(machine, rtc_begin_update_callback, NULL);
r3957r3958
456459   {
457460      rtc.regs[reg_C] |= reg_C_IRQF;
458461      if (rtc.interrupt_callback)
459         rtc.interrupt_callback(1);
462         rtc.interrupt_callback(rtc.machine, 1);
460463   }
461464   else
462465   {
463466      rtc.regs[reg_C] &= ~reg_C_IRQF;
464467      if (rtc.interrupt_callback)
465         rtc.interrupt_callback(0);
468         rtc.interrupt_callback(rtc.machine, 0);
466469   }
467470}
468471
src/emu/devintrf.h
r3957r3958
8181      DEVINFO_FCT_START,                        /* R/O: device_start_func */
8282      DEVINFO_FCT_STOP,                        /* R/O: device_stop_func */
8383      DEVINFO_FCT_RESET,                        /* R/O: device_reset_func */
84      DEVINFO_FCT_EXECUTE,                     /* R/O: device_execute_func */
8485      DEVINFO_FCT_VALIDITY_CHECK,                  /* R/O: device_validity_check_func */
8586      DEVINFO_FCT_NVRAM,                        /* R/O: device_nvram_func */
8687
r3957r3958
128129#define DEVICE_RESET(name)         void DEVICE_RESET_NAME(name)(const device_config *device)
129130#define DEVICE_RESET_CALL(name)      DEVICE_RESET_NAME(name)(device)
130131
132#define DEVICE_EXECUTE_NAME(name)   device_execute_##name
133#define DEVICE_EXECUTE(name)      INT32 DEVICE_EXECUTE_NAME(name)(const device_config *device, INT32 clocks)
134#define DEVICE_EXECUTE_CALL(name)   DEVICE_EXECUTE_NAME(name)(device, clocks)
135
131136#define DEVICE_NVRAM_NAME(name)      device_NVRAM_##name
132137#define DEVICE_NVRAM(name)         void DEVICE_NVRAM_NAME(name)(const device_config *device, mame_file *file, int read_or_write)
133138#define DEVICE_NVRAM_CALL(name)      DEVICE_NVRAM_NAME(name)(device, file, read_or_write)
r3957r3958
137142#define DEVICE_VALIDITY_CHECK_CALL(name)   DEVICE_VALIDITY_CHECK(name)(driver, device)
138143
139144
145/* shorthand for accessing devices by machine/type/tag */
146#define devtag_get_device(mach,type,tag)               device_list_find_by_tag((mach)->config->devicelist, type, tag)
140147
148#define devtag_reset(mach,type,tag)                     device_reset(devtag_get_device(mach, type, tag))
149
150#define devtag_get_info_int(mach,type,tag,state)         device_get_info_int(devtag_get_device(mach, type, tag), state)
151#define devtag_get_info_ptr(mach,type,tag,state)         device_get_info_ptr(devtag_get_device(mach, type, tag), state)
152#define devtag_get_info_fct(mach,type,tag,state)         device_get_info_fct(devtag_get_device(mach, type, tag), state)
153#define devtag_get_info_string(mach,type,tag,state)         device_get_info_string(devtag_get_device(mach, type, tag), state)
154
155#define devtag_set_info_int(mach,type,tag,state,data)      device_set_info_int(devtag_get_device(mach, type, tag), state, data)
156#define devtag_set_info_ptr(mach,type,tag,state,data)      device_set_info_ptr(devtag_get_device(mach, type, tag), state, data)
157#define devtag_set_info_fct(mach,type,tag,state,data)      device_set_info_fct(devtag_get_device(mach, type, tag), state, data)
158
159
160/* shorthand for getting standard data about device types */
161#define devtype_get_name(type)                        devtype_get_info_string(type, DEVINFO_STR_NAME)
162#define devtype_get_family(type)                      devtype_get_info_string(type, DEVINFO_STR_FAMILY)
163#define devtype_get_version(type)                      devtype_get_info_string(type, DEVINFO_STR_VERSION)
164#define devtype_get_source_file(type)                   devtype_get_info_string(type, DEVINFO_STR_SOURCE_FILE)
165#define devtype_get_credits(type)                      devtype_get_info_string(type, DEVINFO_STR_CREDITS)
166
167
168/* shorthand for getting standard data about devices */
169#define device_get_name(dev)                        device_get_info_string(dev, DEVINFO_STR_NAME)
170#define device_get_family(dev)                         device_get_info_string(dev, DEVINFO_STR_FAMILY)
171#define device_get_version(dev)                      device_get_info_string(dev, DEVINFO_STR_VERSION)
172#define device_get_source_file(dev)                     device_get_info_string(dev, DEVINFO_STR_SOURCE_FILE)
173#define device_get_credits(dev)                      device_get_info_string(dev, DEVINFO_STR_CREDITS)
174
175
176/* shorthand for getting standard data about devices by machine/type/tag */
177#define devtag_get_name(mach,type,tag)                  devtag_get_info_string(mach, type, tag, DEVINFO_STR_NAME)
178#define devtag_get_family(mach,type,tag)                devtag_get_info_string(mach, type, tag, DEVINFO_STR_FAMILY)
179#define devtag_get_version(mach,type,tag)                devtag_get_info_string(mach, type, tag, DEVINFO_STR_VERSION)
180#define devtag_get_source_file(mach,type,tag)            devtag_get_info_string(mach, type, tag, DEVINFO_STR_SOURCE_FILE)
181#define devtag_get_credits(mach,type,tag)                devtag_get_info_string(mach, type, tag, DEVINFO_STR_CREDITS)
182
183
184
141185/***************************************************************************
142186    TYPE DEFINITIONS
143187***************************************************************************/
r3957r3958
152196typedef void (*device_set_info_func)(const device_config *device, UINT32 state, const deviceinfo *info);
153197typedef device_start_err (*device_start_func)(const device_config *device);
154198typedef void (*device_stop_func)(const device_config *device);
199typedef INT32 (*device_execute_func)(const device_config *device, INT32 clocks);
155200typedef void (*device_reset_func)(const device_config *device);
156201typedef void (*device_nvram_func)(const device_config *device, mame_file *file, int read_or_write);
157202typedef int (*device_validity_check_func)(const game_driver *driver, const device_config *device);
r3957r3958
167212   INT64               i;                  /* generic integers */
168213   void *               p;                  /* generic pointers */
169214   genf *              f;                  /* generic function pointers */
170   const char *         s;                  /* generic strings */
215   char *               s;                  /* generic strings */
171216
172217   device_set_info_func    set_info;            /* DEVINFO_FCT_SET_INFO */
173218   device_start_func      start;               /* DEVINFO_FCT_START */
174219   device_stop_func      stop;               /* DEVINFO_FCT_STOP */
175220   device_reset_func      reset;               /* DEVINFO_FCT_RESET */
221   device_execute_func    execute;            /* DEVINFO_FCT_EXECUTE */
176222   device_validity_check_func validity_check;      /* DEVINFO_FCT_VALIDITY_CHECK */
177223   device_nvram_func      nvram;               /* DEVINFO_FCT_NVRAM */
178224   const rom_entry *      romregion;            /* DEVINFO_PTR_ROM_REGION */
r3957r3958
183229/* the configuration for a general device */
184230struct _device_config
185231{
186   device_config *         next;               /* next device */
232   /* device relationships (always valid) */
233   device_config *         next;               /* next device (of any type/class) */
234   device_config *         owner;               /* device that owns us, or NULL if nobody */
235   device_config *         typenext;            /* next device of the same type */
236   device_config *         classnext;            /* next device of the same class */
237
238   /* device properties (always valid) */
187239   device_type            type;               /* device type */
188240   device_class         class;               /* device class */
189241   device_set_info_func    set_info;            /* quick pointer to set_info callback */
190   device_start_func      start;               /* quick pointer to start callback */
191   device_stop_func      stop;               /* quick pointer to stop callback */
192   device_reset_func      reset;               /* quick pointer to reset callback */
193   device_nvram_func      nvram;               /* quick pointer to nvram callback */
242
243   /* device configuration (always valid) */
244   UINT32               clock;               /* device clock */
194245   const void *         static_config;         /* static device configuration */
195246   void *               inline_config;         /* inline device configuration */
196247
248   /* these fields are only valid once the device is attached to a machine */
249   running_machine *      machine;            /* machine if device is live */
250
197251   /* these fields are only valid if the device is live */
198252   UINT8               started;            /* TRUE if the start function has succeeded */
199253   void *               token;               /* token if device is live */
200   void *               classtoken;            /* class token if device is live */
201   running_machine *      machine;            /* machine if device is live */
254   UINT32               tokenbytes;            /* size of the token data allocated */
202255   UINT8 *               region;               /* pointer to region with the device's tag, or NULL */
203256   UINT32               regionbytes;         /* size of the region, in bytes */
257   device_execute_func    execute;            /* quick pointer to execute callback */
204258
259   /* tag (always valid; at end because it is variable-length) */
205260   char               tag[1];               /* tag for this instance */
206261};
207262
r3957r3958
215270/* ----- device configuration ----- */
216271
217272/* add a new device to the end of a device list */
218device_config *device_list_add(device_config **listheadptr, device_type type, const char *tag);
273device_config *device_list_add(device_config **listheadptr, const device_config *owner, device_type type, const char *tag, UINT32 clock);
219274
220275/* remove a device from a device list */
221276void device_list_remove(device_config **listheadptr, device_type type, const char *tag);
222277
223278/* build a tag that combines the device's name and the given tag */
224const char *device_build_tag(astring *dest, const char *devicetag, const char *tag);
279const char *device_build_tag(astring *dest, const device_config *device, const char *tag);
225280
226281/* build a tag with the same device prefix as the source tag*/
227282const char *device_inherit_tag(astring *dest, const char *sourcetag, const char *tag);
r3957r3958
274329
275330/* ----- live device management ----- */
276331
332/* "attach" a running_machine to its list of devices */
333void device_list_attach_machine(running_machine *machine);
334
277335/* start the configured list of devices for a machine */
278336void device_list_start(running_machine *machine);
279337
280338/* reset a device based on an allocated device_config */
281339void device_reset(const device_config *device);
282void devtag_reset(running_machine *machine, device_type type, const char *tag);
283340
341/* change the clock on a device */
342void device_set_clock(const device_config *device, UINT32 clock);
284343
285344
345
286346/* ----- device information getters ----- */
287347
288/* return the device associated with a tag */
289const device_config *devtag_get_device(running_machine *machine, device_type type, const char *tag);
290
291/* return the token associated with an allocated device */
292void *devtag_get_token(running_machine *machine, device_type type, const char *tag);
293
294/* return a pointer to the static configuration for a device based on type and tag */
295const void *devtag_get_static_config(running_machine *machine, device_type type, const char *tag);
296
297/* return a pointer to the inline configuration for a device based on type and tag */
298const void *devtag_get_inline_config(running_machine *machine, device_type type, const char *tag);
299
300348/* return an integer state value from an allocated device */
301349INT64 device_get_info_int(const device_config *device, UINT32 state);
302INT64 devtag_get_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state);
303350
304351/* return a pointer state value from an allocated device */
305352void *device_get_info_ptr(const device_config *device, UINT32 state);
306void *devtag_get_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state);
307353
308354/* return a function pointer state value from an allocated device */
309355genf *device_get_info_fct(const device_config *device, UINT32 state);
310genf *devtag_get_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state);
311356
312357/* return a string value from an allocated device */
313358const char *device_get_info_string(const device_config *device, UINT32 state);
314const char *devtag_get_info_string(running_machine *machine, device_type type, const char *tag, UINT32 state);
315359
316360
317361
r3957r3958
320364/* return an integer value from a device type (does not need to be allocated) */
321365INT64 devtype_get_info_int(device_type type, UINT32 state);
322366
367/* return a function pointer from a device type (does not need to be allocated) */
368genf *devtype_get_info_fct(device_type type, UINT32 state);
369
323370/* return a string value from a device type (does not need to be allocated) */
324371const char *devtype_get_info_string(device_type type, UINT32 state);
325372
r3957r3958
329376
330377/* set an integer state value for an allocated device */
331378void device_set_info_int(const device_config *device, UINT32 state, INT64 data);
332void devtag_set_info_int(running_machine *machine, device_type type, const char *tag, UINT32 state, INT64 data);
333379
334380/* set a pointer state value for an allocated device */
335381void device_set_info_ptr(const device_config *device, UINT32 state, void *data);
336void devtag_set_info_ptr(running_machine *machine, device_type type, const char *tag, UINT32 state, void *data);
337382
338383/* set a function pointer state value for an allocated device */
339384void device_set_info_fct(const device_config *device, UINT32 state, genf *data);
340void devtag_set_info_fct(running_machine *machine, device_type type, const char *tag, UINT32 state, genf *data);
341385
342386
343
344/***************************************************************************
345    INLINE FUNCTIONS
346***************************************************************************/
347
348/* return common strings based on device instances */
349INLINE const char *device_get_name(const device_config *device)         { return device_get_info_string(device, DEVINFO_STR_NAME); }
350INLINE const char *device_get_family(const device_config *device)       { return device_get_info_string(device, DEVINFO_STR_FAMILY); }
351INLINE const char *device_get_version(const device_config *device)       { return device_get_info_string(device, DEVINFO_STR_VERSION); }
352INLINE const char *device_get_source_file(const device_config *device)   { return device_get_info_string(device, DEVINFO_STR_SOURCE_FILE); }
353INLINE const char *device_get_credits(const device_config *device)       { return device_get_info_string(device, DEVINFO_STR_CREDITS); }
354
355/* return common strings based on device types */
356INLINE const char *devtype_get_name(device_type devtype)      { return devtype_get_info_string(devtype, DEVINFO_STR_NAME); }
357INLINE const char *devtype_get_family(device_type devtype)       { return devtype_get_info_string(devtype, DEVINFO_STR_FAMILY); }
358INLINE const char *devtype_get_version(device_type devtype)    { return devtype_get_info_string(devtype, DEVINFO_STR_VERSION); }
359INLINE const char *devtype_get_source_file(device_type devtype) { return devtype_get_info_string(devtype, DEVINFO_STR_SOURCE_FILE); }
360INLINE const char *devtype_get_credits(device_type devtype)    { return devtype_get_info_string(devtype, DEVINFO_STR_CREDITS); }
361
362
363387#endif   /* __DEVINTRF_H__ */
src/emu/cpuintrf.c
r3957r3958
1010***************************************************************************/
1111
1212#include "driver.h"
13#include "deprecat.h"
1413
1514/* mingw-gcc defines this */
1615#undef i386
r3957r3958
3635
3736
3837/***************************************************************************
39    PROTOTYPES FOR ALL CPU ENTRY POINTS
40***************************************************************************/
41
42CPU_GET_INFO( dummy );
43CPU_GET_INFO( z80 );
44CPU_GET_INFO( z180 );
45CPU_GET_INFO( i8080 );
46CPU_GET_INFO( i8085 );
47CPU_GET_INFO( m6502 );
48CPU_GET_INFO( m65c02 );
49CPU_GET_INFO( m65sc02 );
50CPU_GET_INFO( m65ce02 );
51CPU_GET_INFO( m6509 );
52CPU_GET_INFO( m6510 );
53CPU_GET_INFO( m6510t );
54CPU_GET_INFO( m7501 );
55CPU_GET_INFO( m8502 );
56CPU_GET_INFO( n2a03 );
57CPU_GET_INFO( deco16 );
58CPU_GET_INFO( m4510 );
59CPU_GET_INFO( h6280 );
60CPU_GET_INFO( i8086 );
61CPU_GET_INFO( i8088 );
62CPU_GET_INFO( i80186 );
63CPU_GET_INFO( i80188 );
64CPU_GET_INFO( i80286 );
65CPU_GET_INFO( v20 );
66CPU_GET_INFO( v25 );
67CPU_GET_INFO( v30 );
68CPU_GET_INFO( v33 );
69CPU_GET_INFO( v35 );
70CPU_GET_INFO( v60 );
71CPU_GET_INFO( v70 );
72CPU_GET_INFO( i8035 );
73CPU_GET_INFO( i8048 );
74CPU_GET_INFO( i8648 );
75CPU_GET_INFO( i8748 );
76CPU_GET_INFO( mb8884 );
77CPU_GET_INFO( i8039 );
78CPU_GET_INFO( i8049 );
79CPU_GET_INFO( i8749 );
80CPU_GET_INFO( n7751 );
81CPU_GET_INFO( m58715 );
82CPU_GET_INFO( i8041 );
83CPU_GET_INFO( i8741 );
84CPU_GET_INFO( i8042 );
85CPU_GET_INFO( i8242 );
86CPU_GET_INFO( i8742 );
87CPU_GET_INFO( i8031 );
88CPU_GET_INFO( i8032 );
89CPU_GET_INFO( i8051 );
90CPU_GET_INFO( i8052 );
91CPU_GET_INFO( i8751 );
92CPU_GET_INFO( i8752 );
93CPU_GET_INFO( i80c31 );
94CPU_GET_INFO( i80c32 );
95CPU_GET_INFO( i80c51 );
96CPU_GET_INFO( i80c52 );
97CPU_GET_INFO( i87c51 );
98CPU_GET_INFO( i87c52 );
99CPU_GET_INFO( at89c4051 );
100CPU_GET_INFO( ds5002fp );
101CPU_GET_INFO( m6800 );
102CPU_GET_INFO( m6801 );
103CPU_GET_INFO( m6802 );
104CPU_GET_INFO( m6803 );
105CPU_GET_INFO( m6808 );
106CPU_GET_INFO( hd63701 );
107CPU_GET_INFO( nsc8105 );
108CPU_GET_INFO( m6805 );
109CPU_GET_INFO( m68705 );
110CPU_GET_INFO( hd63705 );
111CPU_GET_INFO( hd6309 );
112CPU_GET_INFO( m6809 );
113CPU_GET_INFO( m6809e );
114CPU_GET_INFO( konami );
115CPU_GET_INFO( m68000 );
116CPU_GET_INFO( m68008 );
117CPU_GET_INFO( m68010 );
118CPU_GET_INFO( m68ec020 );
119CPU_GET_INFO( m68020 );
120CPU_GET_INFO( m68040 );
121CPU_GET_INFO( t11 );
122CPU_GET_INFO( s2650 );
123CPU_GET_INFO( tms34010 );
124CPU_GET_INFO( tms34020 );
125CPU_GET_INFO( ti990_10 );
126CPU_GET_INFO( tms9900 );
127CPU_GET_INFO( tms9980a );
128CPU_GET_INFO( tms9995 );
129CPU_GET_INFO( z8000 );
130CPU_GET_INFO( tms32010 );
131CPU_GET_INFO( tms32025 );
132CPU_GET_INFO( tms32026 );
133CPU_GET_INFO( tms32031 );
134CPU_GET_INFO( tms32032 );
135CPU_GET_INFO( tms32051 );
136CPU_GET_INFO( ccpu );
137CPU_GET_INFO( adsp2100 );
138CPU_GET_INFO( adsp2101 );
139CPU_GET_INFO( adsp2104 );
140CPU_GET_INFO( adsp2105 );
141CPU_GET_INFO( adsp2115 );
142CPU_GET_INFO( adsp2181 );
143CPU_GET_INFO( psxcpu );
144CPU_GET_INFO( asap );
145CPU_GET_INFO( upd7810 );
146CPU_GET_INFO( upd7807 );
147CPU_GET_INFO( upd7801 );
148CPU_GET_INFO( upd78c05 );
149CPU_GET_INFO( upd78c06 );
150CPU_GET_INFO( jaguargpu );
151CPU_GET_INFO( jaguardsp );
152CPU_GET_INFO( cquestsnd );
153CPU_GET_INFO( cquestrot );
154CPU_GET_INFO( cquestlin );
155CPU_GET_INFO( r3000be );
156CPU_GET_INFO( r3000le );
157CPU_GET_INFO( r3041be );
158CPU_GET_INFO( r3041le );
159CPU_GET_INFO( r4600be );
160CPU_GET_INFO( r4600le );
161CPU_GET_INFO( r4650be );
162CPU_GET_INFO( r4650le );
163CPU_GET_INFO( r4700be );
164CPU_GET_INFO( r4700le );
165CPU_GET_INFO( r5000be );
166CPU_GET_INFO( r5000le );
167CPU_GET_INFO( qed5271be );
168CPU_GET_INFO( qed5271le );
169CPU_GET_INFO( rm7000be );
170CPU_GET_INFO( rm7000le );
171CPU_GET_INFO( arm );
172CPU_GET_INFO( arm7 );
173CPU_GET_INFO( sh1 );
174CPU_GET_INFO( sh2 );
175CPU_GET_INFO( sh4 );
176CPU_GET_INFO( dsp32c );
177CPU_GET_INFO( pic16C54 );
178CPU_GET_INFO( pic16C55 );
179CPU_GET_INFO( pic16C56 );
180CPU_GET_INFO( pic16C57 );
181CPU_GET_INFO( pic16C58 );
182CPU_GET_INFO( g65816 );
183CPU_GET_INFO( spc700 );
184CPU_GET_INFO( e116t );
185CPU_GET_INFO( e116xt );
186CPU_GET_INFO( e116xs );
187CPU_GET_INFO( e116xsr );
188CPU_GET_INFO( e132n );
189CPU_GET_INFO( e132t );
190CPU_GET_INFO( e132xn );
191CPU_GET_INFO( e132xt );
192CPU_GET_INFO( e132xs );
193CPU_GET_INFO( e132xsr );
194CPU_GET_INFO( gms30c2116 );
195CPU_GET_INFO( gms30c2132 );
196CPU_GET_INFO( gms30c2216 );
197CPU_GET_INFO( gms30c2232 );
198CPU_GET_INFO( i386 );
199CPU_GET_INFO( i486 );
200CPU_GET_INFO( pentium );
201CPU_GET_INFO( mediagx );
202CPU_GET_INFO( i960 );
203CPU_GET_INFO( h8_3002 );
204CPU_GET_INFO( h8_3007 );
205CPU_GET_INFO( h8_3044 );
206CPU_GET_INFO( h8_3334 );
207CPU_GET_INFO( v810 );
208CPU_GET_INFO( m37702 );
209CPU_GET_INFO( m37710 );
210CPU_GET_INFO( ppc403ga );
211CPU_GET_INFO( ppc403gcx );
212CPU_GET_INFO( ppc601 );
213CPU_GET_INFO( ppc602 );
214CPU_GET_INFO( ppc603 );
215CPU_GET_INFO( ppc603e );
216CPU_GET_INFO( ppc603r );
217CPU_GET_INFO( ppc604 );
218CPU_GET_INFO( mpc8240 );
219CPU_GET_INFO( SE3208 );
220CPU_GET_INFO( mc68hc11 );
221CPU_GET_INFO( adsp21062 );
222CPU_GET_INFO( dsp56k );
223CPU_GET_INFO( rsp );
224CPU_GET_INFO( alpha8201 );
225CPU_GET_INFO( alpha8301 );
226CPU_GET_INFO( cdp1802 );
227CPU_GET_INFO( cop401 );
228CPU_GET_INFO( cop410 );
229CPU_GET_INFO( cop411 );
230CPU_GET_INFO( cop402 );
231CPU_GET_INFO( cop420 );
232CPU_GET_INFO( cop421 );
233CPU_GET_INFO( cop422 );
234CPU_GET_INFO( cop404 );
235CPU_GET_INFO( cop424 );
236CPU_GET_INFO( cop425 );
237CPU_GET_INFO( cop426 );
238CPU_GET_INFO( cop444 );
239CPU_GET_INFO( cop445 );
240CPU_GET_INFO( tmp90840 );
241CPU_GET_INFO( tmp90841 );
242CPU_GET_INFO( tmp91640 );
243CPU_GET_INFO( tmp91641 );
244CPU_GET_INFO( apexc );
245CPU_GET_INFO( cp1610 );
246CPU_GET_INFO( f8 );
247CPU_GET_INFO( lh5801 );
248CPU_GET_INFO( pdp1 );
249CPU_GET_INFO( saturn );
250CPU_GET_INFO( sc61860 );
251CPU_GET_INFO( tx0_64kw );
252CPU_GET_INFO( tx0_8kw );
253CPU_GET_INFO( lr35902 );
254CPU_GET_INFO( tms7000 );
255CPU_GET_INFO( tms7000_exl );
256CPU_GET_INFO( sm8500 );
257CPU_GET_INFO( v30mz );
258CPU_GET_INFO( mb8841 );
259CPU_GET_INFO( mb8842 );
260CPU_GET_INFO( mb8843 );
261CPU_GET_INFO( mb8844 );
262CPU_GET_INFO( mb86233 );
263CPU_GET_INFO( ssp1601 );
264CPU_GET_INFO( minx );
265CPU_GET_INFO( cxd8661r );
266
267
268
269/***************************************************************************
270    MASTER CPU LIST
271***************************************************************************/
272
273static const struct
274{
275   int               cputype;
276   cpu_get_info_func    get_info;
277} cpuintrf_map[] =
278{
279   { CPU_DUMMY, CPU_GET_INFO_NAME(dummy) },
280#if (HAS_Z80)
281   { CPU_Z80, CPU_GET_INFO_NAME(z80) },
282#endif
283#if (HAS_Z180)
284   { CPU_Z180, CPU_GET_INFO_NAME(z180) },
285#endif
286#if (HAS_8080)
287   { CPU_8080, CPU_GET_INFO_NAME(i8080) },
288#endif
289#if (HAS_8085A)
290   { CPU_8085A, CPU_GET_INFO_NAME(i8085) },
291#endif
292#if (HAS_M6502)
293   { CPU_M6502, CPU_GET_INFO_NAME(m6502) },
294#endif
295#if (HAS_M65C02)
296   { CPU_M65C02, CPU_GET_INFO_NAME(m65c02) },
297#endif
298#if (HAS_M65SC02)
299   { CPU_M65SC02, CPU_GET_INFO_NAME(m65sc02) },
300#endif
301#if (HAS_M65CE02)
302   { CPU_M65CE02, CPU_GET_INFO_NAME(m65ce02) },
303#endif
304#if (HAS_M6509)
305   { CPU_M6509, CPU_GET_INFO_NAME(m6509) },
306#endif
307#if (HAS_M6510)
308   { CPU_M6510, CPU_GET_INFO_NAME(m6510) },
309#endif
310#if (HAS_M6510T)
311   { CPU_M6510T, CPU_GET_INFO_NAME(m6510t) },
312#endif
313#if (HAS_M7501)
314   { CPU_M7501, CPU_GET_INFO_NAME(m7501) },
315#endif
316#if (HAS_M8502)
317   { CPU_M8502, CPU_GET_INFO_NAME(m8502) },
318#endif
319#if (HAS_N2A03)
320   { CPU_N2A03, CPU_GET_INFO_NAME(n2a03) },
321#endif
322#if (HAS_DECO16)
323   { CPU_DECO16, CPU_GET_INFO_NAME(deco16) },
324#endif
325#if (HAS_M4510)
326   { CPU_M4510, CPU_GET_INFO_NAME(m4510) },
327#endif
328#if (HAS_H6280)
329   { CPU_H6280, CPU_GET_INFO_NAME(h6280) },
330#endif
331#if (HAS_I8086)
332   { CPU_I8086, CPU_GET_INFO_NAME(i8086) },
333#endif
334#if (HAS_I8088)
335   { CPU_I8088, CPU_GET_INFO_NAME(i8088) },
336#endif
337#if (HAS_I80186)
338   { CPU_I80186, CPU_GET_INFO_NAME(i80186) },
339#endif
340#if (HAS_I80188)
341   { CPU_I80188, CPU_GET_INFO_NAME(i80188) },
342#endif
343#if (HAS_I80286)
344   { CPU_I80286, CPU_GET_INFO_NAME(i80286) },
345#endif
346#if (HAS_V20)
347   { CPU_V20, CPU_GET_INFO_NAME(v20) },
348#endif
349#if (HAS_V25)
350   { CPU_V25, CPU_GET_INFO_NAME(v25) },
351#endif
352#if (HAS_V30)
353   { CPU_V30, CPU_GET_INFO_NAME(v30) },
354#endif
355#if (HAS_V33)
356   { CPU_V33, CPU_GET_INFO_NAME(v33) },
357#endif
358#if (HAS_V35)
359   { CPU_V35, CPU_GET_INFO_NAME(v35) },
360#endif
361#if (HAS_V60)
362   { CPU_V60, CPU_GET_INFO_NAME(v60) },
363#endif
364#if (HAS_V70)
365   { CPU_V70, CPU_GET_INFO_NAME(v70) },
366#endif
367#if (HAS_I8035)
368   { CPU_I8035, CPU_GET_INFO_NAME(i8035) },
369#endif
370#if (HAS_I8041)
371   { CPU_I8041, CPU_GET_INFO_NAME(i8041) },
372#endif
373#if (HAS_I8048)
374   { CPU_I8048, CPU_GET_INFO_NAME(i8048) },
375#endif
376#if (HAS_I8648)
377   { CPU_I8648, CPU_GET_INFO_NAME(i8648) },
378#endif
379#if (HAS_I8748)
380   { CPU_I8748, CPU_GET_INFO_NAME(i8748) },
381#endif
382#if (HAS_MB8884)
383   { CPU_MB8884, CPU_GET_INFO_NAME(mb8884) },
384#endif
385#if (HAS_N7751)
386   { CPU_N7751, CPU_GET_INFO_NAME(n7751) },
387#endif
388#if (HAS_I8039)
389   { CPU_I8039, CPU_GET_INFO_NAME(i8039) },
390#endif
391#if (HAS_I8049)
392   { CPU_I8049, CPU_GET_INFO_NAME(i8049) },
393#endif
394#if (HAS_I8749)
395   { CPU_I8749, CPU_GET_INFO_NAME(i8749) },
396#endif
397#if (HAS_M58715)
398   { CPU_M58715, CPU_GET_INFO_NAME(m58715) },
399#endif
400#if (HAS_I8041)
401   { CPU_I8041, CPU_GET_INFO_NAME(i8041) },
402#endif
403#if (HAS_I8741)
404   { CPU_I8741, CPU_GET_INFO_NAME(i8741) },
405#endif
406#if (HAS_I8042)
407   { CPU_I8042, CPU_GET_INFO_NAME(i8042) },
408#endif
409#if (HAS_I8242)
410   { CPU_I8242, CPU_GET_INFO_NAME(i8242) },
411#endif
412#if (HAS_I8742)
413   { CPU_I8742, CPU_GET_INFO_NAME(i8742) },
414#endif
415#if (HAS_I8031)
416   { CPU_I8031, CPU_GET_INFO_NAME(i8031) },
417#endif
418#if (HAS_I8032)
419   { CPU_I8032, CPU_GET_INFO_NAME(i8032) },
420#endif
421#if (HAS_I8051)
422   { CPU_I8051, CPU_GET_INFO_NAME(i8051) },
423#endif
424#if (HAS_I8052)
425   { CPU_I8052, CPU_GET_INFO_NAME(i8052) },
426#endif
427#if (HAS_I8751)
428   { CPU_I8751, CPU_GET_INFO_NAME(i8751) },
429#endif
430#if (HAS_I8752)
431   { CPU_I8752, CPU_GET_INFO_NAME(i8752) },
432#endif
433#if (HAS_I80C31)
434   { CPU_I80C31, CPU_GET_INFO_NAME(i80c31) },
435#endif
436#if (HAS_I80C32)
437   { CPU_I80C32, CPU_GET_INFO_NAME(i80c32) },
438#endif
439#if (HAS_I80C51)
440   { CPU_I80C51, CPU_GET_INFO_NAME(i80c51) },
441#endif
442#if (HAS_I80C52)
443   { CPU_I80C52, CPU_GET_INFO_NAME(i80c52) },
444#endif
445#if (HAS_I87C51)
446   { CPU_I87C51, CPU_GET_INFO_NAME(i87c51) },
447#endif
448#if (HAS_I87C52)
449   { CPU_I87C52, CPU_GET_INFO_NAME(i87c52) },
450#endif
451#if (HAS_AT89C4051)
452   { CPU_AT89C4051, CPU_GET_INFO_NAME(at89c4051) },
453#endif
454#if (HAS_DS5002FP)
455   { CPU_DS5002FP, CPU_GET_INFO_NAME(ds5002fp) },
456#endif
457#if (HAS_M6800)
458   { CPU_M6800, CPU_GET_INFO_NAME(m6800) },
459#endif
460#if (HAS_M6801)
461   { CPU_M6801, CPU_GET_INFO_NAME(m6801) },
462#endif
463#if (HAS_M6802)
464   { CPU_M6802, CPU_GET_INFO_NAME(m6802) },
465#endif
466#if (HAS_M6803)
467   { CPU_M6803, CPU_GET_INFO_NAME(m6803) },
468#endif
469#if (HAS_M6808)
470   { CPU_M6808, CPU_GET_INFO_NAME(m6808) },
471#endif
472#if (HAS_HD63701)
473   { CPU_HD63701, CPU_GET_INFO_NAME(hd63701) },
474#endif
475#if (HAS_NSC8105)
476   { CPU_NSC8105, CPU_GET_INFO_NAME(nsc8105) },
477#endif
478#if (HAS_M6805)
479   { CPU_M6805, CPU_GET_INFO_NAME(m6805) },
480#endif
481#if (HAS_M68705)
482   { CPU_M68705, CPU_GET_INFO_NAME(m68705) },
483#endif
484#if (HAS_HD63705)
485   { CPU_HD63705, CPU_GET_INFO_NAME(hd63705) },
486#endif
487#if (HAS_HD6309)
488   { CPU_HD6309, CPU_GET_INFO_NAME(hd6309) },
489#endif
490#if (HAS_M6809)
491   { CPU_M6809, CPU_GET_INFO_NAME(m6809) },
492#endif
493#if (HAS_M6809E)
494   { CPU_M6809E, CPU_GET_INFO_NAME(m6809e) },
495#endif
496#if (HAS_KONAMI)
497   { CPU_KONAMI, CPU_GET_INFO_NAME(konami) },
498#endif
499#if (HAS_M680X0)
500   { CPU_M68000, CPU_GET_INFO_NAME(m68000) },
501   { CPU_M68008, CPU_GET_INFO_NAME(m68008) },
502   { CPU_M68010, CPU_GET_INFO_NAME(m68010) },
503   { CPU_M68EC020, CPU_GET_INFO_NAME(m68ec020) },
504   { CPU_M68020, CPU_GET_INFO_NAME(m68020) },
505   { CPU_M68040, CPU_GET_INFO_NAME(m68040) },
506#endif
507#if (HAS_T11)
508   { CPU_T11, CPU_GET_INFO_NAME(t11) },
509#endif
510#if (HAS_S2650)
511   { CPU_S2650, CPU_GET_INFO_NAME(s2650) },
512#endif
513#if (HAS_TMS340X0)
514   { CPU_TMS34010, CPU_GET_INFO_NAME(tms34010) },
515   { CPU_TMS34020, CPU_GET_INFO_NAME(tms34020) },
516#endif
517#if (HAS_TI990_10)
518   { CPU_TI990_10, CPU_GET_INFO_NAME(ti990_10) },
519#endif
520#if (HAS_TMS9900)
521   { CPU_TMS9900, CPU_GET_INFO_NAME(tms9900) },
522#endif
523#if (HAS_TMS9980)
524   { CPU_TMS9980, CPU_GET_INFO_NAME(tms9980a) },
525#endif
526#if (HAS_TMS9995)
527   { CPU_TMS9995, CPU_GET_INFO_NAME(tms9995) },
528#endif
529#if (HAS_Z8000)
530   { CPU_Z8000, CPU_GET_INFO_NAME(z8000) },
531#endif
532#if (HAS_TMS32010)
533   { CPU_TMS32010, CPU_GET_INFO_NAME(tms32010) },
534#endif
535#if (HAS_TMS32025)
536   { CPU_TMS32025, CPU_GET_INFO_NAME(tms32025) },
537#endif
538#if (HAS_TMS32026)
539   { CPU_TMS32026, CPU_GET_INFO_NAME(tms32026) },
540#endif
541#if (HAS_TMS32031)
542   { CPU_TMS32031, CPU_GET_INFO_NAME(tms32031) },
543#endif
544#if (HAS_TMS32032)
545   { CPU_TMS32032, CPU_GET_INFO_NAME(tms32032) },
546#endif
547#if (HAS_TMS32051)
548   { CPU_TMS32051, CPU_GET_INFO_NAME(tms32051) },
549#endif
550#if (HAS_CCPU)
551   { CPU_CCPU, CPU_GET_INFO_NAME(ccpu) },
552#endif
553#if (HAS_ADSP2100)
554   { CPU_ADSP2100, CPU_GET_INFO_NAME(adsp2100) },
555#endif
556#if (HAS_ADSP2101)
557   { CPU_ADSP2101, CPU_GET_INFO_NAME(adsp2101) },
558#endif
559#if (HAS_ADSP2104)
560   { CPU_ADSP2104, CPU_GET_INFO_NAME(adsp2104) },
561#endif
562#if (HAS_ADSP2105)
563   { CPU_ADSP2105, CPU_GET_INFO_NAME(adsp2105) },
564#endif
565#if (HAS_ADSP2115)
566   { CPU_ADSP2115, CPU_GET_INFO_NAME(adsp2115) },
567#endif
568#if (HAS_ADSP2181)
569   { CPU_ADSP2181, CPU_GET_INFO_NAME(adsp2181) },
570#endif
571#if (HAS_PSXCPU)
572   { CPU_PSXCPU, CPU_GET_INFO_NAME(psxcpu) },
573#endif
574#if (HAS_ASAP)
575   { CPU_ASAP, CPU_GET_INFO_NAME(asap) },
576#endif
577#if (HAS_UPD7810)
578   { CPU_UPD7810, CPU_GET_INFO_NAME(upd7810) },
579#endif
580#if (HAS_UPD7807)
581   { CPU_UPD7807, CPU_GET_INFO_NAME(upd7807) },
582#endif
583#if (HAS_UPD7801)
584   { CPU_UPD7801, CPU_GET_INFO_NAME(upd7801) },
585   { CPU_UPD78C05, CPU_GET_INFO_NAME(upd78c05) },
586   { CPU_UPD78C06, CPU_GET_INFO_NAME(upd78c06) },
587#endif
588#if (HAS_JAGUAR)
589   { CPU_JAGUARGPU, CPU_GET_INFO_NAME(jaguargpu) },
590   { CPU_JAGUARDSP, CPU_GET_INFO_NAME(jaguardsp) },
591#endif
592#if (HAS_CUBEQCPU)
593   { CPU_CQUESTSND, CPU_GET_INFO_NAME(cquestsnd) },
594   { CPU_CQUESTROT, CPU_GET_INFO_NAME(cquestrot) },
595   { CPU_CQUESTLIN, CPU_GET_INFO_NAME(cquestlin) },
596#endif
597#if (HAS_R3000)
598   { CPU_R3000BE, CPU_GET_INFO_NAME(r3000be) },
599   { CPU_R3000LE, CPU_GET_INFO_NAME(r3000le) },
600#endif
601#if (HAS_R3041)
602   { CPU_R3041BE, CPU_GET_INFO_NAME(r3041be) },
603   { CPU_R3041LE, CPU_GET_INFO_NAME(r3041le) },
604#endif
605#if (HAS_R4600)
606   { CPU_R4600BE, CPU_GET_INFO_NAME(r4600be) },
607   { CPU_R4600LE, CPU_GET_INFO_NAME(r4600le) },
608#endif
609#if (HAS_R4650)
610   { CPU_R4650BE, CPU_GET_INFO_NAME(r4650be) },
611   { CPU_R4650LE, CPU_GET_INFO_NAME(r4650le) },
612#endif
613#if (HAS_R4700)
614   { CPU_R4700BE, CPU_GET_INFO_NAME(r4700be) },
615   { CPU_R4700LE, CPU_GET_INFO_NAME(r4700le) },
616#endif
617#if (HAS_R5000)
618   { CPU_R5000BE, CPU_GET_INFO_NAME(r5000be) },
619   { CPU_R5000LE, CPU_GET_INFO_NAME(r5000le) },
620#endif
621#if (HAS_QED5271)
622   { CPU_QED5271BE, CPU_GET_INFO_NAME(qed5271be) },
623   { CPU_QED5271LE, CPU_GET_INFO_NAME(qed5271le) },
624#endif
625#if (HAS_RM7000)
626   { CPU_RM7000BE, CPU_GET_INFO_NAME(rm7000be) },
627   { CPU_RM7000LE, CPU_GET_INFO_NAME(rm7000le) },
628#endif
629#if (HAS_ARM)
630   { CPU_ARM, CPU_GET_INFO_NAME(arm) },
631#endif
632#if (HAS_ARM7)
633   { CPU_ARM7, CPU_GET_INFO_NAME(arm7) },
634#endif
635#if (HAS_SH1)
636   { CPU_SH1, CPU_GET_INFO_NAME(sh1) },
637#endif
638#if (HAS_SH2)
639   { CPU_SH2, CPU_GET_INFO_NAME(sh2) },
640#endif
641#if (HAS_SH4)
642   { CPU_SH4, CPU_GET_INFO_NAME(sh4) },
643#endif
644#if (HAS_DSP32C)
645   { CPU_DSP32C, CPU_GET_INFO_NAME(dsp32c) },
646#endif
647#if (HAS_PIC16C54)
648   { CPU_PIC16C54, CPU_GET_INFO_NAME(pic16C54) },
649#endif
650#if (HAS_PIC16C55)
651   { CPU_PIC16C55, CPU_GET_INFO_NAME(pic16C55) },
652#endif
653#if (HAS_PIC16C56)
654   { CPU_PIC16C56, CPU_GET_INFO_NAME(pic16C56) },
655#endif
656#if (HAS_PIC16C57)
657   { CPU_PIC16C57, CPU_GET_INFO_NAME(pic16C57) },
658#endif
659#if (HAS_PIC16C58)
660   { CPU_PIC16C58, CPU_GET_INFO_NAME(pic16C58) },
661#endif
662#if (HAS_G65816)
663   { CPU_G65816, CPU_GET_INFO_NAME(g65816) },
664#endif
665#if (HAS_SPC700)
666   { CPU_SPC700, CPU_GET_INFO_NAME(spc700) },
667#endif
668#if (HAS_E116T)
669   { CPU_E116T, CPU_GET_INFO_NAME(e116t) },
670#endif
671#if (HAS_E116XT)
672   { CPU_E116XT, CPU_GET_INFO_NAME(e116xt) },
673#endif
674#if (HAS_E116XS)
675   { CPU_E116XS, CPU_GET_INFO_NAME(e116xs) },
676#endif
677#if (HAS_E116XSR)
678   { CPU_E116XSR, CPU_GET_INFO_NAME(e116xsr) },
679#endif
680#if (HAS_E132N)
681   { CPU_E132N, CPU_GET_INFO_NAME(e132n) },
682#endif
683#if (HAS_E132T)
684   { CPU_E132T, CPU_GET_INFO_NAME(e132t) },
685#endif
686#if (HAS_E132XN)
687   { CPU_E132XN, CPU_GET_INFO_NAME(e132xn) },
688#endif
689#if (HAS_E132XT)
690   { CPU_E132XT, CPU_GET_INFO_NAME(e132xt) },
691#endif
692#if (HAS_E132XS)
693   { CPU_E132XS, CPU_GET_INFO_NAME(e132xs) },
694#endif
695#if (HAS_E132XSR)
696   { CPU_E132XSR, CPU_GET_INFO_NAME(e132xsr) },
697#endif
698#if (HAS_GMS30C2116)
699   { CPU_GMS30C2116, CPU_GET_INFO_NAME(gms30c2116) },
700#endif
701#if (HAS_GMS30C2132)
702   { CPU_GMS30C2132, CPU_GET_INFO_NAME(gms30c2132) },
703#endif
704#if (HAS_GMS30C2216)
705   { CPU_GMS30C2216, CPU_GET_INFO_NAME(gms30c2216) },
706#endif
707#if (HAS_GMS30C2232)
708   { CPU_GMS30C2232, CPU_GET_INFO_NAME(gms30c2232) },
709#endif
710#if (HAS_I386)
711   { CPU_I386, CPU_GET_INFO_NAME(i386) },
712#endif
713#if (HAS_I486)
714   { CPU_I486, CPU_GET_INFO_NAME(i486) },
715#endif
716#if (HAS_PENTIUM)
717   { CPU_PENTIUM, CPU_GET_INFO_NAME(pentium) },
718#endif
719#if (HAS_MEDIAGX)
720   { CPU_MEDIAGX, CPU_GET_INFO_NAME(mediagx) },
721#endif
722#if (HAS_I960)
723   { CPU_I960, CPU_GET_INFO_NAME(i960) },
724#endif
725#if (HAS_H83334)
726   { CPU_H83334, CPU_GET_INFO_NAME(h8_3334) },
727#endif
728#if (HAS_H83002)
729   { CPU_H83002, CPU_GET_INFO_NAME(h8_3002) },
730   { CPU_H83007, CPU_GET_INFO_NAME(h8_3007) },
731   { CPU_H83044, CPU_GET_INFO_NAME(h8_3044) },
732#endif
733#if (HAS_V810)
734   { CPU_V810, CPU_GET_INFO_NAME(v810) },
735#endif
736#if (HAS_M37702)
737   { CPU_M37702, CPU_GET_INFO_NAME(m37702) },
738#endif
739#if (HAS_M37710)
740   { CPU_M37710, CPU_GET_INFO_NAME(m37710) },
741#endif
742#if (HAS_PPC403GA)
743   { CPU_PPC403GA, CPU_GET_INFO_NAME(ppc403ga) },
744#endif
745#if (HAS_PPC403GCX)
746   { CPU_PPC403GCX, CPU_GET_INFO_NAME(ppc403gcx) },
747#endif
748#if (HAS_PPC601)
749   { CPU_PPC601, CPU_GET_INFO_NAME(ppc601) },
750#endif
751#if (HAS_PPC602)
752   { CPU_PPC602, CPU_GET_INFO_NAME(ppc602) },
753#endif
754#if (HAS_PPC603)
755   { CPU_PPC603, CPU_GET_INFO_NAME(ppc603) },
756#endif
757#if (HAS_PPC603E)
758   { CPU_PPC603E, CPU_GET_INFO_NAME(ppc603e) },
759#endif
760#if (HAS_PPC603R)
761   { CPU_PPC603R, CPU_GET_INFO_NAME(ppc603r) },
762#endif
763#if (HAS_PPC604)
764   { CPU_PPC604, CPU_GET_INFO_NAME(ppc604) },
765#endif
766#if (HAS_MPC8240)
767   { CPU_MPC8240, CPU_GET_INFO_NAME(mpc8240) },
768#endif
769#if (HAS_SE3208)
770   { CPU_SE3208, CPU_GET_INFO_NAME(SE3208) },
771#endif
772#if (HAS_MC68HC11)
773   { CPU_MC68HC11, CPU_GET_INFO_NAME(mc68hc11) },
774#endif
775#if (HAS_ADSP21062)
776   { CPU_ADSP21062, CPU_GET_INFO_NAME(adsp21062) },
777#endif
778#if (HAS_DSP56156)
779   { CPU_DSP56156, CPU_GET_INFO_NAME(dsp56k) },
780#endif
781#if (HAS_RSP)
782   { CPU_RSP, CPU_GET_INFO_NAME(rsp) },
783#endif
784#if (HAS_ALPHA8201)
785   { CPU_ALPHA8201, CPU_GET_INFO_NAME(alpha8201) },
786#endif
787#if (HAS_ALPHA8301)
788   { CPU_ALPHA8301, CPU_GET_INFO_NAME(alpha8301) },
789#endif
790#if (HAS_CDP1802)
791   { CPU_CDP1802, CPU_GET_INFO_NAME(cdp1802) },
792#endif
793#if (HAS_COP401)
794   { CPU_COP401, CPU_GET_INFO_NAME(cop401) },
795#endif
796#if (HAS_COP410)
797   { CPU_COP410, CPU_GET_INFO_NAME(cop410) },
798#endif
799#if (HAS_COP411)
800   { CPU_COP411, CPU_GET_INFO_NAME(cop411) },
801#endif
802#if (HAS_COP402)
803   { CPU_COP402, CPU_GET_INFO_NAME(cop402) },
804#endif
805#if (HAS_COP420)
806   { CPU_COP420, CPU_GET_INFO_NAME(cop420) },
807#endif
808#if (HAS_COP421)
809   { CPU_COP421, CPU_GET_INFO_NAME(cop421) },
810#endif
811#if (HAS_COP422)
812   { CPU_COP422, CPU_GET_INFO_NAME(cop422) },
813#endif
814#if (HAS_COP404)
815   { CPU_COP404, CPU_GET_INFO_NAME(cop404) },
816#endif
817#if (HAS_COP424)
818   { CPU_COP424, CPU_GET_INFO_NAME(cop424) },
819#endif
820#if (HAS_COP425)
821   { CPU_COP425, CPU_GET_INFO_NAME(cop425) },
822#endif
823#if (HAS_COP426)
824   { CPU_COP426, CPU_GET_INFO_NAME(cop426) },
825#endif
826#if (HAS_COP444)
827   { CPU_COP444, CPU_GET_INFO_NAME(cop444) },
828#endif
829#if (HAS_COP445)
830   { CPU_COP445, CPU_GET_INFO_NAME(cop445) },
831#endif
832#if (HAS_TLCS90)
833   { CPU_TMP90840, CPU_GET_INFO_NAME(tmp90840) },
834   { CPU_TMP90841, CPU_GET_INFO_NAME(tmp90841) },
835   { CPU_TMP91640, CPU_GET_INFO_NAME(tmp91640) },
836   { CPU_TMP91641, CPU_GET_INFO_NAME(tmp91641) },
837#endif
838#if (HAS_APEXC)
839   { CPU_APEXC, CPU_GET_INFO_NAME(apexc) },
840#endif
841#if (HAS_CP1610)
842   { CPU_CP1610, CPU_GET_INFO_NAME(cp1610) },
843#endif
844#if (HAS_F8)
845   { CPU_F8, CPU_GET_INFO_NAME(f8) },
846#endif
847#if (HAS_LH5801)
848   { CPU_LH5801, CPU_GET_INFO_NAME(lh5801) },
849#endif
850#if (HAS_PDP1)
851   { CPU_PDP1, CPU_GET_INFO_NAME(pdp1) },
852#endif
853#if (HAS_SATURN)
854   { CPU_SATURN, CPU_GET_INFO_NAME(saturn) },
855#endif
856#if (HAS_SC61860)
857   { CPU_SC61860, CPU_GET_INFO_NAME(sc61860) },
858#endif
859#if (HAS_TX0_64KW)
860   { CPU_TX0_64KW, CPU_GET_INFO_NAME(tx0_64kw) },
861#endif
862#if (HAS_TX0_8KW)
863   { CPU_TX0_8KW, CPU_GET_INFO_NAME(tx0_8kw) },
864#endif
865#if (HAS_LR35902)
866   { CPU_LR35902, CPU_GET_INFO_NAME(lr35902) },
867#endif
868#if (HAS_TMS7000)
869   { CPU_TMS7000, CPU_GET_INFO_NAME(tms7000) },
870#endif
871#if (HAS_TMS7000_EXL)
872   { CPU_TMS7000_EXL, CPU_GET_INFO_NAME(tms7000_exl) },
873#endif
874#if (HAS_SM8500)
875   { CPU_SM8500, CPU_GET_INFO_NAME(sm8500) },
876#endif
877#if (HAS_V30MZ)
878   { CPU_V30MZ, CPU_GET_INFO_NAME(v30mz) },
879#endif
880#if (HAS_MB8841)
881   { CPU_MB8841, CPU_GET_INFO_NAME(mb8841) },
882#endif
883#if (HAS_MB8842)
884   { CPU_MB8842, CPU_GET_INFO_NAME(mb8842) },
885#endif
886#if (HAS_MB8843)
887   { CPU_MB8843, CPU_GET_INFO_NAME(mb8843) },
888#endif
889#if (HAS_MB8844)
890   { CPU_MB8844, CPU_GET_INFO_NAME(mb8844) },
891#endif
892#if (HAS_MB86233)
893   { CPU_MB86233, CPU_GET_INFO_NAME(mb86233) },
894#endif
895#if (HAS_SSP1601)
896   { CPU_SSP1601, CPU_GET_INFO_NAME(ssp1601) },
897#endif
898#if (HAS_MINX)
899   { CPU_MINX, CPU_GET_INFO_NAME(minx) },
900#endif
901#if (HAS_CXD8661R)
902   { CPU_CXD8661R, CPU_GET_INFO_NAME(cxd8661r) },
903#endif
904};
905
906
907
908/***************************************************************************
909    GLOBAL VARIABLES
910***************************************************************************/
911
912static cpu_class_header cpu_type_header[CPU_COUNT];
913
914static char temp_string_pool[TEMP_STRING_POOL_ENTRIES][MAX_STRING_LENGTH];
915static int temp_string_pool_index;
916
917
918
919/***************************************************************************
920    INLINE FUNCTIONS
921***************************************************************************/
922
923/*-------------------------------------------------
924    get_temp_string_buffer - return a pointer to
925    a temporary string buffer
926-------------------------------------------------*/
927
928INLINE char *get_temp_string_buffer(void)
929{
930   char *string = &temp_string_pool[temp_string_pool_index++ % TEMP_STRING_POOL_ENTRIES][0];
931   string[0] = 0;
932   return string;
933}
934
935
936/*-------------------------------------------------
937    get_safe_classheader - makes sure that the
938    passed in device is, in fact, a CPU, and
939    return the class token
940-------------------------------------------------*/
941
942INLINE cpu_class_header *get_safe_classheader(const device_config *device)
943{
944   assert(device != NULL);
945   assert(device->classtoken != NULL);
946   assert(device->class == DEVICE_CLASS_CPU_CHIP);
947
948   return (cpu_class_header *)device->classtoken;
949}
950
951
952
953/***************************************************************************
954    GLOBAL MANAGEMENT
955***************************************************************************/
956
957/*-------------------------------------------------
958    cpuintrf_init - initialize global structures
959-------------------------------------------------*/
960
961void cpuintrf_init(running_machine *machine)
962{
963   int mapindex;
964
965   /* reset the cpuintrf array */
966   memset(cpu_type_header, 0, sizeof(cpu_type_header));
967
968   /* build the cpuintrf array */
969   for (mapindex = 0; mapindex < ARRAY_LENGTH(cpuintrf_map); mapindex++)
970   {
971      cpu_type cputype = cpuintrf_map[mapindex].cputype;
972      cpu_class_header *header = &cpu_type_header[cputype];
973      cpuinfo info;
974      int spacenum;
975
976      /* start with the get_info routine */
977      header->cputype = cputype;
978      header->get_info = cpuintrf_map[mapindex].get_info;
979
980      /* bootstrap the rest of the function pointers */
981      info.setinfo = NULL;
982      (*header->get_info)(NULL, CPUINFO_PTR_SET_INFO, &info);
983      header->set_info = info.setinfo;
984
985      info.init = NULL;
986      (*header->get_info)(NULL, CPUINFO_PTR_INIT, &info);
987      header->init = info.init;
988
989      info.reset = NULL;
990      (*header->get_info)(NULL, CPUINFO_PTR_RESET, &info);
991      header->reset = info.reset;
992
993      info.exit = NULL;
994      (*header->get_info)(NULL, CPUINFO_PTR_EXIT, &info);
995      header->exit = info.exit;
996
997      info.execute = NULL;
998      (*header->get_info)(NULL, CPUINFO_PTR_EXECUTE, &info);
999      header->execute = info.execute;
1000
1001      info.burn = NULL;
1002      (*header->get_info)(NULL, CPUINFO_PTR_BURN, &info);
1003      header->burn = info.burn;
1004
1005      info.disassemble = NULL;
1006      (*header->get_info)(NULL, CPUINFO_PTR_DISASSEMBLE, &info);
1007      header->disassemble = info.disassemble;
1008
1009      info.translate = NULL;
1010      (*header->get_info)(NULL, CPUINFO_PTR_TRANSLATE, &info);
1011      header->translate = info.translate;
1012
1013      /* get other miscellaneous stuff */
1014      for (spacenum = 0; spacenum < ARRAY_LENGTH(header->address_shift); spacenum++)
1015         header->address_shift[spacenum] = cputype_get_addrbus_shift(cputype, spacenum);
1016      header->clock_divider = cputype_get_clock_divider(cputype);
1017      header->clock_multiplier = cputype_get_clock_multiplier(cputype);
1018   }
1019
1020   /* fill in any empty entries with the dummy CPU */
1021   for (mapindex = 0; mapindex < CPU_COUNT; mapindex++)
1022      if (cpu_type_header[mapindex].get_info == NULL)
1023         cpu_type_header[mapindex] = cpu_type_header[CPU_DUMMY];
1024}
1025
1026
1027
1028/***************************************************************************
1029    LIVE CONTEXT CONTROL
1030***************************************************************************/
1031
1032/*-------------------------------------------------
1033    cpu_get_index_slow - find a CPU in the machine
1034    by searching
1035-------------------------------------------------*/
1036
1037int cpu_get_index_slow(const device_config *cpu)
1038{
1039   int cpunum;
1040
1041   for (cpunum = 0; cpunum < ARRAY_LENGTH(Machine->cpu); cpunum++)
1042      if (Machine->cpu[cpunum] == cpu)
1043         return cpunum;
1044   return -1;
1045}
1046
1047
1048
1049/***************************************************************************
105038    LIVE CPU ACCESSORS
105139***************************************************************************/
105240
105341/*-------------------------------------------------
1054    cpu_init - initialize a live CPU
1055-------------------------------------------------*/
1056
1057void cpu_init(const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
1058{
1059   cpu_class_header *classheader = get_safe_classheader(device);
1060
1061   classheader->index = index;
1062   classheader->space[ADDRESS_SPACE_PROGRAM] = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
1063   classheader->space[ADDRESS_SPACE_DATA] = memory_find_address_space(device, ADDRESS_SPACE_DATA);
1064   classheader->space[ADDRESS_SPACE_IO] = memory_find_address_space(device, ADDRESS_SPACE_IO);
1065
1066   (*classheader->init)(device, index, clock, irqcallback);
1067}
1068
1069
1070/*-------------------------------------------------
1071    cpu_exit - free a live CPU
1072-------------------------------------------------*/
1073
1074void cpu_exit(const device_config *device)
1075{
1076   cpu_class_header *classheader = get_safe_classheader(device);
1077
1078   if (classheader->exit != NULL)
1079      (*classheader->exit)(device);
1080}
1081
1082
1083/*-------------------------------------------------
1084    cpu_get_info_* - return information about a
1085    live CPU
1086-------------------------------------------------*/
1087
1088INT64 cpu_get_info_int(const device_config *device, UINT32 state)
1089{
1090   cpu_class_header *classheader = get_safe_classheader(device);
1091   cpuinfo info;
1092
1093   info.i = 0;
1094   (*classheader->get_info)(device, state, &info);
1095   return info.i;
1096}
1097
1098void *cpu_get_info_ptr(const device_config *device, UINT32 state)
1099{
1100   cpu_class_header *classheader = get_safe_classheader(device);
1101   cpuinfo info;
1102
1103   info.p = NULL;
1104   (*classheader->get_info)(device, state, &info);
1105   return info.p;
1106}
1107
1108genf *cpu_get_info_fct(const device_config *device, UINT32 state)
1109{
1110   cpu_class_header *classheader = get_safe_classheader(device);
1111   cpuinfo info;
1112
1113   info.f = NULL;
1114   (*classheader->get_info)(device, state, &info);
1115   return info.f;
1116}
1117
1118const char *cpu_get_info_string(const device_config *device, UINT32 state)
1119{
1120   cpu_class_header *classheader = get_safe_classheader(device);
1121   cpuinfo info;
1122
1123   info.s = get_temp_string_buffer();
1124   (*classheader->get_info)(device, state, &info);
1125   return info.s;
1126}
1127
1128
1129/*-------------------------------------------------
1130    cpu_set_info_* - set information about a
1131    live CPU
1132-------------------------------------------------*/
1133
1134void cpu_set_info_int(const device_config *device, UINT32 state, INT64 data)
1135{
1136   cpu_class_header *classheader = get_safe_classheader(device);
1137   cpuinfo info;
1138
1139   info.i = data;
1140   (*classheader->set_info)(device, state, &info);
1141}
1142
1143void cpu_set_info_ptr(const device_config *device, UINT32 state, void *data)
1144{
1145   cpu_class_header *classheader = get_safe_classheader(device);
1146   cpuinfo info;
1147
1148   info.p = data;
1149   (*classheader->set_info)(device, state, &info);
1150}
1151
1152void cpu_set_info_fct(const device_config *device, UINT32 state, genf *data)
1153{
1154   cpu_class_header *classheader = get_safe_classheader(device);
1155   cpuinfo info;
1156
1157   info.f = data;
1158   (*classheader->set_info)(device, state, &info);
1159}
1160
1161
1162
1163/*-------------------------------------------------
1164    cpu_reset - signal a reset for a given CPU
1165-------------------------------------------------*/
1166
1167void cpu_reset(const device_config *device)
1168{
1169   cpu_class_header *classheader = get_safe_classheader(device);
1170
1171   (*classheader->reset)(device);
1172}
1173
1174
1175/*-------------------------------------------------
117642    cpu_get_physical_pc_byte - return the PC,
117743    corrected to a byte offset and translated to
117844    physical space, on a given CPU
r3957r3958
118349   const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
118450   offs_t pc;
118551
1186   pc = memory_address_to_byte(space, cpu_get_info_int(device, CPUINFO_INT_PC));
52   pc = memory_address_to_byte(space, device_get_info_int(device, CPUINFO_INT_PC));
118753   memory_address_physical(space, TRANSLATE_FETCH, &pc);
118854   return pc;
118955}
r3957r3958
119662
119763offs_t cpu_dasm(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
119864{
1199   cpu_class_header *classheader = get_safe_classheader(device);
65   cpu_class_header *classheader = cpu_get_class_header(device);
120066   offs_t result = 0;
120167
120268   /* check for disassembler override */
r3957r3958
1255121
1256122void cpu_set_dasm_override(const device_config *device, cpu_disassemble_func dasm_override)
1257123{
1258   cpu_class_header *classheader = get_safe_classheader(device);
124   cpu_class_header *classheader = cpu_get_class_header(device);
1259125   classheader->dasm_override = dasm_override;
1260126}
1261127
1262128
1263129
1264130/***************************************************************************
1265    CPU TYPE ACCESSORS
1266***************************************************************************/
1267
1268/*-------------------------------------------------
1269    cputype_get_header_template - return a header
1270    template for a given CPU type
1271-------------------------------------------------*/
1272
1273const cpu_class_header *cputype_get_header_template(cpu_type cputype)
1274{
1275   assert(cputype >= 0 && cputype < CPU_COUNT);
1276   return &cpu_type_header[cputype];
1277}
1278
1279
1280/*-------------------------------------------------
1281    cputype_get_info_* - return information about a
1282    given CPU type
1283-------------------------------------------------*/
1284
1285INT64 cputype_get_info_int(cpu_type cputype, UINT32 state)
1286{
1287   cpu_class_header *classheader = &cpu_type_header[cputype];
1288   cpuinfo info;
1289
1290   assert(cputype >= 0 && cputype < CPU_COUNT);
1291   info.i = 0;
1292   (*classheader->get_info)(NULL, state, &info);
1293   return info.i;
1294}
1295
1296void *cputype_get_info_ptr(cpu_type cputype, UINT32 state)
1297{
1298   cpu_class_header *classheader = &cpu_type_header[cputype];
1299   cpuinfo info;
1300
1301   assert(cputype >= 0 && cputype < CPU_COUNT);
1302   info.p = NULL;
1303   (*classheader->get_info)(NULL, state, &info);
1304   return info.p;
1305}
1306
1307genf *cputype_get_info_fct(cpu_type cputype, UINT32 state)
1308{
1309   cpu_class_header *classheader = &cpu_type_header[cputype];
1310   cpuinfo info;
1311
1312   assert(cputype >= 0 && cputype < CPU_COUNT);
1313   info.f = NULL;
1314   (*classheader->get_info)(NULL, state, &info);
1315   return info.f;
1316}
1317
1318const char *cputype_get_info_string(cpu_type cputype, UINT32 state)
1319{
1320   cpu_class_header *classheader = &cpu_type_header[cputype];
1321   cpuinfo info;
1322
1323   assert(cputype >= 0 && cputype < CPU_COUNT);
1324   info.s = get_temp_string_buffer();
1325   (*classheader->get_info)(NULL, state, &info);
1326   return info.s;
1327}
1328
1329
1330
1331/***************************************************************************
1332131    DUMMY CPU DEFINITION
1333132***************************************************************************/
1334133
1335struct dummy_context
134typedef struct _dummy_context dummy_context;
135struct _dummy_context
1336136{
1337   UINT32      dummy;
137   int      icount;
1338138};
1339139
1340static struct dummy_context dummy_state;
1341static int dummy_icount;
1342
1343140static CPU_INIT( dummy ) { }
1344141static CPU_RESET( dummy ) { }
1345142static CPU_EXIT( dummy ) { }
r3957r3958
1357154
1358155CPU_GET_INFO( dummy )
1359156{
157   dummy_context *cpustate = (device != NULL) ? device->token : NULL;
1360158   switch (state)
1361159   {
1362160      /* --- the following bits of info are returned as 64-bit signed integers --- */
1363      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(dummy_state);          break;
161      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(dummy_context);       break;
1364162      case CPUINFO_INT_INPUT_LINES:               info->i = 1;                     break;
1365163      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
1366164      case CPUINFO_INT_ENDIANNESS:               info->i = ENDIANNESS_LITTLE;               break;
r3957r3958
1388186      case CPUINFO_INT_SP:                     info->i = 0;                     break;
1389187
1390188      /* --- the following bits of info are returned as pointers to data or functions --- */
1391      case CPUINFO_PTR_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dummy); break;
1392      case CPUINFO_PTR_INIT:                     info->init = CPU_INIT_NAME(dummy);      break;
1393      case CPUINFO_PTR_RESET:                     info->reset = CPU_RESET_NAME(dummy);   break;
1394      case CPUINFO_PTR_EXIT:                     info->exit = CPU_EXIT_NAME(dummy);      break;
1395      case CPUINFO_PTR_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dummy);break;
1396      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
1397      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dummy); break;
1398      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &dummy_icount;         break;
189      case CPUINFO_FCT_SET_INFO:                  info->setinfo = CPU_SET_INFO_NAME(dummy); break;
190      case CPUINFO_FCT_INIT:                     info->init = CPU_INIT_NAME(dummy);      break;
191      case CPUINFO_FCT_RESET:                     info->reset = CPU_RESET_NAME(dummy);   break;
192      case CPUINFO_FCT_EXIT:                     info->exit = CPU_EXIT_NAME(dummy);      break;
193      case CPUINFO_FCT_EXECUTE:                  info->execute = CPU_EXECUTE_NAME(dummy);break;
194      case CPUINFO_FCT_BURN:                     info->burn = NULL;                  break;
195      case CPUINFO_FCT_DISASSEMBLE:               info->disassemble = CPU_DISASSEMBLE_NAME(dummy); break;
196      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &cpustate->icount;      break;
1399197
1400198      /* --- the following bits of info are returned as NULL-terminated strings --- */
1401199      case CPUINFO_STR_NAME:                     strcpy(info->s, "");               break;
src/emu/cpuexec.c
r3957r3958
5959typedef struct _cpu_class_data cpu_class_data;
6060struct _cpu_class_data
6161{
62   /* this item must remain first */
63   cpu_class_header header;            /* header containing public data */
64
6562   /* cycle counting and executing */
63   int            profiler;            /* profiler tag */
6664   int *         icount;               /* pointer to the icount */
6765   int          cycles_running;         /* number of cycles we are executing */
6866   int            cycles_stolen;         /* number of cycles we artificially stole */
r3957r3958
9088   UINT32         cycles_per_second;      /* cycles per second, adjusted for multipliers */
9189   attoseconds_t   attoseconds_per_cycle;   /* attoseconds per adjusted clock cycle */
9290
91   /* internal state reflection */
92   const cpu_state_table *state;         /* pointer to the base table */
93   const cpu_state_entry *regstate[MAX_REGS];/* pointer to the state entry for each register */
94
9395   /* these below are hacks to support multiple interrupts per frame */
9496   INT32          iloops;             /* number of interrupts remaining this frame */
9597   emu_timer *      partial_frame_timer;   /* the timer that triggers partial frame interrupts */
r3957r3958
111113    FUNCTION PROTOTYPES
112114***************************************************************************/
113115
114static void cpuexec_exit(running_machine *machine);
115static void cpuexec_reset(running_machine *machine);
116
117static void cpu_timers_init(running_machine *machine);
118116static void update_clock_information(const device_config *device);
119117static void compute_perfect_interleave(running_machine *machine);
120118static void on_vblank(const device_config *device, void *param, int vblank_state);
r3957r3958
124122static TIMER_CALLBACK( empty_event_queue );
125123static IRQ_CALLBACK( standard_irq_callback );
126124static void register_save_states(const device_config *device);
125static UINT64 get_register_value(const device_config *device, void *baseptr, const cpu_state_entry *entry);
126static void set_register_value(const device_config *device, void *baseptr, const cpu_state_entry *entry, UINT64 value);
127static void get_register_string_value(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *dest);
128#ifdef UNUSED_FUNCTION
129static int get_register_string_max_width(const device_config *device, void *baseptr, const cpu_state_entry *entry);
130#endif
127131
128132
129
130133/***************************************************************************
131134    INLINE FUNCTIONS
132135***************************************************************************/
133136
134137/*-------------------------------------------------
135    get_safe_classtoken - makes sure that the
136    passed in device is, in fact, a CPU, and
137    return the class token
138    get_class_data - return a pointer to the
139    class data
138140-------------------------------------------------*/
139141
140INLINE cpu_class_data *get_safe_classtoken(const device_config *device)
142INLINE cpu_class_data *get_class_data(const device_config *device)
141143{
142144   assert(device != NULL);
143   assert(device->classtoken != NULL);
144145   assert(device->class == DEVICE_CLASS_CPU_CHIP);
146   assert(device->token != NULL);
147   return (cpu_class_data *)cpu_get_class_header(device) - 1;
148}
145149
146   return (cpu_class_data *)device->classtoken;
150
151/*-------------------------------------------------
152    get_minimum_quantum - return the minimum
153    quantum required for a given CPU device
154-------------------------------------------------*/
155
156INLINE attoseconds_t get_minimum_quantum(const device_config *device)
157{
158   attoseconds_t basetick = 0;
159
160   /* fetch the base clock from the classdata if present */
161   if (device->token != NULL)
162      basetick = get_class_data(device)->attoseconds_per_cycle;
163
164   /* otherwise compute it from the raw data */
165   if (basetick == 0)
166   {
167      UINT32 baseclock = (UINT64)device->clock * cpu_get_clock_multiplier(device) / cpu_get_clock_divider(device);
168      basetick = HZ_TO_ATTOSECONDS(baseclock);
169   }
170
171   /* apply the minimum cycle count */
172   return basetick * cpu_get_min_cycles(device);
147173}
148174
149175
r3957r3958
154180
155181INLINE void suspend_until_trigger(const device_config *device, int trigger, int eatcycles)
156182{
157   cpu_class_data *classdata = get_safe_classtoken(device);
183   cpu_class_data *classdata = get_class_data(device);
158184
159185   /* suspend the CPU immediately if it's not already */
160186   cpu_suspend(device, SUSPEND_REASON_TRIGGER, eatcycles);
r3957r3958
170196***************************************************************************/
171197
172198/*-------------------------------------------------
173    cpuexec_create_cpu_device - temporary
174    function to allocate a fake CPU device for
175    each CPU
176-------------------------------------------------*/
177
178static DEVICE_GET_INFO( cpuclass )
179{
180   cpu_class_data *classdata = device->classtoken;
181   (*classdata->header.get_info)(device, state, (cpuinfo *)info);
182}
183
184const device_config *cpuexec_create_cpu_device(const cpu_config *config)
185{
186   device_config *device;
187
188   /* create a fake device for the CPU -- this will be done automatically in the future */
189   device = malloc_or_die(sizeof(*device) + strlen(config->tag));
190   memset(device, 0, sizeof(*device));
191   strcpy(device->tag, config->tag);
192   device->type = DEVICE_GET_INFO_NAME(cpuclass);
193   device->class = DEVICE_CLASS_CPU_CHIP;
194   device->inline_config = (void *)config;
195   device->static_config = config->reset_param;
196
197   return device;
198}
199
200
201/*-------------------------------------------------
202199    cpuexec_init - initialize internal states of
203200    all CPUs
204201-------------------------------------------------*/
205202
206203void cpuexec_init(running_machine *machine)
207204{
208   int cpunum;
205   attotime min_quantum;
209206
210207   /* allocate global state */
211208   machine->cpuexec_data = auto_malloc(sizeof(*machine->cpuexec_data));
212209   memset(machine->cpuexec_data, 0, sizeof(*machine->cpuexec_data));
213210
214   /* loop over all our CPUs */
215   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->config->cpu); cpunum++)
216      if (machine->cpu[cpunum] != NULL)
217      {
218         device_config *device = (device_config *)machine->cpu[cpunum];
219         const cpu_config *config = device->inline_config;
220         cpu_type cputype = config->type;
221         cpu_class_data *classdata;
222         int num_regs;
223         int line;
211   /* set the core scheduling quantum */
212   min_quantum = machine->config->minimum_quantum;
213   if (attotime_compare(min_quantum, attotime_zero) == 0)
214      min_quantum = ATTOTIME_IN_HZ(60);
215   if (machine->config->perfect_cpu_quantum != NULL)
216   {
217      const device_config *cpu = cputag_get_cpu(machine, machine->config->perfect_cpu_quantum);
218      attotime cpu_quantum;
224219
225         /* allocate memory for our class state */
226         classdata = auto_malloc(sizeof(*classdata));
227         memset(classdata, 0, sizeof(*classdata));
228
229         /* fill in the header */
230         classdata->header = *cputype_get_header_template(cputype);
231
232         /* make the device run */
233         device->started = FALSE;
234         device->machine = machine;
235         device->region = memory_region(machine, device->tag);
236         device->regionbytes = memory_region_length(machine, device->tag);
237         device->token = auto_malloc(cputype_get_context_size(cputype));
238         memset(device->token, 0, cputype_get_context_size(cputype));
239         device->classtoken = classdata;
240
241         /* fill in the input states and IRQ callback information */
242         for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
243         {
244            cpu_input_data *inputline = &classdata->input[line];
245            /* vector and curvector are initialized later */
246            inputline->curstate = CLEAR_LINE;
247            inputline->qindex = 0;
248         }
249
250         /* fill in the suspend states */
251         classdata->suspend = SUSPEND_REASON_RESET;
252         classdata->inttrigger = cpunum + TRIGGER_INT;
253
254         /* fill in the clock and timing information */
255         classdata->clock = (UINT64)config->clock * classdata->header.clock_multiplier / classdata->header.clock_divider;
256         classdata->clockscale = 1.0;
257
258         /* allocate timers if we need them */
259         if (config->vblank_interrupts_per_frame > 1)
260            classdata->partial_frame_timer = timer_alloc(machine, trigger_partial_frame_interrupt, device);
261         if (config->timed_interrupt_period != 0)
262            classdata->timedint_timer = timer_alloc(machine, trigger_periodic_interrupt, device);
263
264         /* initialize this CPU */
265         num_regs = state_save_get_reg_count(machine);
266         cpu_init(device, cpunum, classdata->clock, standard_irq_callback);
267         num_regs = state_save_get_reg_count(machine) - num_regs;
268
269         /* fetch post-initialization data */
270         classdata->icount = cpu_get_icount_ptr(device);
271         for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
272         {
273            cpu_input_data *inputline = &classdata->input[line];
274            inputline->vector = cpu_get_default_irq_vector(device);
275            inputline->curvector = inputline->vector;
276         }
277         update_clock_information(device);
278
279         /* if no state registered for saving, we can't save */
280         if (num_regs == 0)
281         {
282            logerror("CPU #%d (%s) did not register any state to save!\n", cpunum, cputype_get_name(cputype));
283            if (machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
284               fatalerror("CPU #%d (%s) did not register any state to save!", cpunum, cputype_get_name(cputype));
285         }
286
287         /* register some internal states as well */
288         register_save_states(device);
289      }
290
291   add_reset_callback(machine, cpuexec_reset);
292   add_exit_callback(machine, cpuexec_exit);
220      if (cpu == NULL)
221         fatalerror("CPU '%s' specified for perfect interleave is not present!", machine->config->perfect_cpu_quantum);
222      cpu_quantum = attotime_make(0, get_minimum_quantum(cpu));
223      min_quantum = attotime_min(cpu_quantum, min_quantum);
224   }
225   assert(min_quantum.seconds == 0);
226   timer_add_scheduling_quantum(machine, min_quantum.attoseconds, attotime_never);
293227}
294228
295229
296230/*-------------------------------------------------
297    cpuexec_reset - reset CPU states on a soft
298    reset
299-------------------------------------------------*/
300
301static void cpuexec_reset(running_machine *machine)
302{
303   int cpunum;
304
305   /* initialize the various timers */
306   cpu_timers_init(machine);
307
308   /* first pass over CPUs */
309   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
310      if (machine->cpu[cpunum] != NULL)
311      {
312         const device_config *device = machine->cpu[cpunum];
313         const cpu_config *config = device->inline_config;
314         cpu_class_data *classdata = device->classtoken;
315         int line;
316
317         /* enable all CPUs (except for disabled CPUs) */
318         if (!(config->flags & CPU_DISABLE))
319            cpu_resume(device, SUSPEND_ANY_REASON);
320         else
321            cpu_suspend(device, SUSPEND_REASON_DISABLE, 1);
322
323         /* reset the total number of cycles */
324         classdata->totalcycles = 0;
325
326         /* then reset the CPU directly */
327         cpu_reset(device);
328
329         /* reset the interrupt vectors and queues */
330         for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
331         {
332            cpu_input_data *inputline = &classdata->input[line];
333            inputline->vector = cpu_get_default_irq_vector(device);
334            inputline->qindex = 0;
335         }
336      }
337}
338
339
340/*-------------------------------------------------
341    cpuexec_exit - cleanup all CPUs on exit
342-------------------------------------------------*/
343
344static void cpuexec_exit(running_machine *machine)
345{
346   int cpunum;
347
348   /* shut down the CPU cores */
349   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
350      if (machine->cpu[cpunum] != NULL)
351         cpu_exit(machine->cpu[cpunum]);
352}
353
354
355/*-------------------------------------------------
356231    cpuexec_timeslice - execute all CPUs for a
357232    single timeslice
358233-------------------------------------------------*/
r3957r3958
363238   cpuexec_private *global = machine->cpuexec_data;
364239   attotime target = timer_next_fire_time(machine);
365240   attotime base = timer_get_time(machine);
366   int cpunum, ran;
241   const device_config *cpu;
242   int ran;
367243
368244   LOG(("------------------\n"));
369245   LOG(("cpu_timeslice: target = %s\n", attotime_string(target, 9)));
370246
371247   /* apply pending suspension changes */
372   for (cpunum = 0; machine->cpu[cpunum] != NULL; cpunum++)
248   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
373249   {
374      cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
250      cpu_class_data *classdata = get_class_data(cpu);
375251      classdata->suspend = classdata->nextsuspend;
376252      classdata->nextsuspend &= ~SUSPEND_REASON_TIMESLICE;
377253      classdata->eatcycles = classdata->nexteatcycles;
378254   }
379255
380256   /* loop over non-suspended CPUs */
381   for (cpunum = 0; machine->cpu[cpunum] != NULL; cpunum++)
257   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
382258   {
383      const device_config *cpu = machine->cpu[cpunum];
384      cpu_class_data *classdata = cpu->classtoken;
259      cpu_class_data *classdata = get_class_data(cpu);
385260      if (classdata->suspend == 0)
386261      {
387262         attotime delta = attotime_sub(target, classdata->localtime);
r3957r3958
389264         {
390265            /* compute how long to run */
391266            classdata->cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
392            LOG(("  cpu %d: %d cycles\n", cpunum, classdata->cycles_running));
267            LOG(("  cpu '%s': %d cycles\n", cpu->tag, classdata->cycles_running));
393268
394            profiler_mark(PROFILER_CPU1 + cpunum);
269            profiler_mark(classdata->profiler);
395270
396271            /* note that this global variable cycles_stolen can be modified */
397            /* via the call to the cpunum_execute */
272            /* via the call to cpu_execute */
398273            classdata->cycles_stolen = 0;
399274            global->executingcpu = cpu;
400275            if (!call_debugger)
r3957r3958
431306   global->executingcpu = NULL;
432307
433308   /* update the local times of all CPUs */
434   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++)
309   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
435310   {
436      cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
311      cpu_class_data *classdata = get_class_data(cpu);
437312
438313      /* if we're suspended and counting, process */
439314      if (classdata->suspend != 0 && classdata->eatcycles && attotime_compare(classdata->localtime, target) < 0)
r3957r3958
442317
443318         /* compute how long to run */
444319         classdata->cycles_running = div_64x32(delta.attoseconds >> classdata->divshift, classdata->divisor);
445         LOG(("  cpu %d: %d cycles (suspended)\n", cpunum, classdata->cycles_running));
320         LOG(("  cpu '%s': %d cycles (suspended)\n", cpu->tag, classdata->cycles_running));
446321
447322         classdata->totalcycles += classdata->cycles_running;
448323         classdata->localtime = attotime_add_attoseconds(classdata->localtime, classdata->cycles_running * classdata->attoseconds_per_cycle);
r3957r3958
459334}
460335
461336
462
463/***************************************************************************
464    GLOBAL HELPERS
465***************************************************************************/
466
467337/*-------------------------------------------------
468    cputag_get_cpu - return a pointer to the given
469    CPU by tag
338    cpuexec_boost_interleave - temporarily boosts
339    the interleave factor
470340-------------------------------------------------*/
471341
472const device_config *cputag_get_cpu(running_machine *machine, const char *tag)
342void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration)
473343{
474   int cpunum;
344   /* ignore timeslices > 1 second */
345   if (timeslice_time.seconds > 0)
346      return;
347   timer_add_scheduling_quantum(machine, timeslice_time.attoseconds, boost_duration);
348}
475349
476   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
477      if (machine->cpu[cpunum] != NULL && strcmp(tag, machine->cpu[cpunum]->tag) == 0)
478         return machine->cpu[cpunum];
479350
480   return NULL;
481}
482351
352/***************************************************************************
353    GLOBAL HELPERS
354***************************************************************************/
483355
484356/*-------------------------------------------------
485    cpuexec_boost_interleave - temporarily boosts
486    the interleave factor
357    cpuexec_abort_timeslice - abort execution
358    for the current timeslice
487359-------------------------------------------------*/
488360
489void cpuexec_boost_interleave(running_machine *machine, attotime timeslice_time, attotime boost_duration)
361void cpuexec_abort_timeslice(running_machine *machine)
490362{
491   /* ignore timeslices > 1 second */
492   if (timeslice_time.seconds > 0)
493      return;
494   timer_add_scheduling_quantum(machine, timeslice_time.attoseconds, boost_duration);
363   const device_config *executingcpu = machine->cpuexec_data->executingcpu;
364   if (executingcpu != NULL)
365      cpu_abort_timeslice(executingcpu);
495366}
496367
497368
r3957r3958
518389
519390
520391/***************************************************************************
392    VIDEO SCREEN DEVICE INTERFACE
393***************************************************************************/
394
395/*-------------------------------------------------
396    device_start_cpu - device start callback
397-------------------------------------------------*/
398
399static DEVICE_START( cpu )
400{
401   int index = cpu_get_index(device);
402   cpu_class_header *header;
403   cpu_class_data *classdata;
404   const cpu_config *config;
405   cpu_init_func init;
406   int spacenum, line;
407   int num_regs;
408
409   /* validate some basic stuff */
410   assert(device != NULL);
411   assert(device->inline_config != NULL);
412   assert(device->machine != NULL);
413   assert(device->machine->config != NULL);
414
415   /* get pointers to our data */
416   config = device->inline_config;
417   header = cpu_get_class_header(device);
418   classdata = get_class_data(device);
419
420   /* add ourself to the global array */
421   if (index < ARRAY_LENGTH(device->machine->cpu))
422      device->machine->cpu[index] = device;
423
424   /* build the header */
425   header->debug = NULL;
426   for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
427      header->space[spacenum] = memory_find_address_space(device, spacenum);
428
429   header->set_info = (cpu_set_info_func)device_get_info_fct(device, CPUINFO_FCT_SET_INFO);
430   header->execute = (cpu_execute_func)device_get_info_fct(device, CPUINFO_FCT_EXECUTE);
431   header->burn = (cpu_burn_func)device_get_info_fct(device, CPUINFO_FCT_BURN);
432   header->translate = (cpu_translate_func)device_get_info_fct(device, CPUINFO_FCT_TRANSLATE);
433   header->disassemble = (cpu_disassemble_func)device_get_info_fct(device, CPUINFO_FCT_DISASSEMBLE);
434   header->dasm_override = NULL;
435
436   /* fill in the input states and IRQ callback information */
437   for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
438   {
439      cpu_input_data *inputline = &classdata->input[line];
440      /* vector and curvector are initialized later */
441      inputline->curstate = CLEAR_LINE;
442      inputline->qindex = 0;
443   }
444
445   /* fill in the suspend states */
446   classdata->profiler = index + PROFILER_CPU1;
447   classdata->suspend = SUSPEND_REASON_RESET;
448   classdata->inttrigger = index + TRIGGER_INT;
449
450   /* fill in the clock and timing information */
451   classdata->clock = (UINT64)device->clock * cpu_get_clock_multiplier(device) / cpu_get_clock_divider(device);
452   classdata->clockscale = 1.0;
453
454   /* allocate timers if we need them */
455   if (config->vblank_interrupts_per_frame > 1)
456      classdata->partial_frame_timer = timer_alloc(device->machine, trigger_partial_frame_interrupt, (void *)device);
457   if (config->timed_interrupt_period != 0)
458      classdata->timedint_timer = timer_alloc(device->machine, trigger_periodic_interrupt, (void *)device);
459
460   /* initialize this CPU */
461   num_regs = state_save_get_reg_count(device->machine);
462   init = (cpu_init_func)device_get_info_fct(device, CPUINFO_FCT_INIT);
463   (*init)(device, standard_irq_callback);
464   num_regs = state_save_get_reg_count(device->machine) - num_regs;
465
466   /* fetch post-initialization data */
467   classdata->icount = cpu_get_icount_ptr(device);
468   for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
469   {
470      cpu_input_data *inputline = &classdata->input[line];
471      inputline->vector = cpu_get_default_irq_vector(device);
472      inputline->curvector = inputline->vector;
473   }
474   update_clock_information(device);
475
476   /* fetch information about the CPU states */
477   classdata->state = cpu_get_state_table(device);
478   if (classdata->state != NULL)
479   {
480      int stateindex;
481
482      /* loop over all states specified, and work with any that apply */
483      for (stateindex = 0; stateindex < classdata->state->entrycount; stateindex++)
484      {
485         const cpu_state_entry *entry = &classdata->state->entrylist[stateindex];
486         if (entry->validmask == 0 || (entry->validmask & classdata->state->subtypemask) != 0)
487         {
488            assert(entry->index < MAX_REGS);
489            assert(classdata->regstate[entry->index] == NULL);
490            classdata->regstate[entry->index] = entry;
491         }
492      }
493   }
494
495   /* if no state registered for saving, we can't save */
496   if (num_regs == 0)
497   {
498      logerror("CPU '%s' did not register any state to save!\n", cpu_get_name(device));
499      if (device->machine->gamedrv->flags & GAME_SUPPORTS_SAVE)
500         fatalerror("CPU '%s' did not register any state to save!", cpu_get_name(device));
501   }
502
503   /* register some internal states as well */
504   register_save_states(device);
505
506   return DEVICE_START_OK;
507}
508
509
510/*-------------------------------------------------
511    device_reset_cpu - device reset callback
512-------------------------------------------------*/
513
514static DEVICE_RESET( cpu )
515{
516   cpu_class_data *classdata = get_class_data(device);
517   const cpu_config *config = device->inline_config;
518   cpu_reset_func reset;
519   int line;
520
521   /* enable all CPUs (except for disabled CPUs) */
522   if (!(config->flags & CPU_DISABLE))
523      cpu_resume(device, SUSPEND_ANY_REASON);
524   else
525      cpu_suspend(device, SUSPEND_REASON_DISABLE, 1);
526
527   /* reset the total number of cycles */
528   classdata->totalcycles = 0;
529
530   /* then reset the CPU directly */
531   reset = (cpu_reset_func)device_get_info_fct(device, CPUINFO_FCT_RESET);
532   if (reset != NULL)
533      (*reset)(device);
534
535   /* reset the interrupt vectors and queues */
536   for (line = 0; line < ARRAY_LENGTH(classdata->input); line++)
537   {
538      cpu_input_data *inputline = &classdata->input[line];
539      inputline->vector = cpu_get_default_irq_vector(device);
540      inputline->qindex = 0;
541   }
542
543   /* reconfingure VBLANK interrupts */
544   if (config->vblank_interrupts_per_frame > 0 || config->vblank_interrupt_screen != NULL)
545   {
546      const device_config *screen;
547
548      /* get the screen that will trigger the VBLANK */
549
550      /* new style - use screen tag directly */
551      if (config->vblank_interrupt_screen != NULL)
552         screen = devtag_get_device(device->machine, VIDEO_SCREEN, config->vblank_interrupt_screen);
553
554      /* old style 'hack' setup - use screen #0 */
555      else
556         screen = video_screen_first(device->machine->config);
557
558      assert(screen != NULL);
559      video_screen_register_vblank_callback(screen, on_vblank, NULL);
560   }
561
562   /* reconfigure periodic interrupts */
563   if (config->timed_interrupt_period != 0)
564   {
565      attotime timedint_period = UINT64_ATTOTIME_TO_ATTOTIME(config->timed_interrupt_period);
566      assert(classdata->timedint_timer != NULL);
567      timer_adjust_periodic(classdata->timedint_timer, timedint_period, 0, timedint_period);
568   }
569}
570
571
572/*-------------------------------------------------
573    device_stop_cpu - device stop callback
574-------------------------------------------------*/
575
576static DEVICE_STOP( cpu )
577{
578   cpu_exit_func exit;
579
580   /* call the CPU's exit function if present */
581   exit = (cpu_exit_func)device_get_info_fct(device, CPUINFO_FCT_EXIT);
582   if (exit != NULL)
583      (*exit)(device);
584}
585
586
587/*-------------------------------------------------
588    cpu_set_info - device set info callback
589-------------------------------------------------*/
590
591static DEVICE_SET_INFO( cpu )
592{
593   cpu_class_header *header = cpu_get_class_header(device);
594   cpu_set_info_func set_info;
595   cpuinfo cinfo;
596
597   /* if we are live and have a header, save ourself a call */
598   if (header != NULL)
599      set_info = header->set_info;
600   else
601      set_info = (cpu_set_info_func)device_get_info_fct(device, CPUINFO_FCT_SET_INFO);
602
603   switch (state)
604   {
605      /* no parameters to set */
606
607      default:
608         /* if we have a state pointer, we can handle some stuff for free */
609         if (device->token != NULL)
610         {
611            const cpu_class_data *classdata = get_class_data(device);
612            if (classdata->state != NULL)
613            {
614               if (state >= CPUINFO_INT_REGISTER && state <= CPUINFO_INT_REGISTER_LAST)
615               {
616                  set_register_value(device, classdata->state->baseptr, classdata->regstate[state - CPUINFO_INT_REGISTER], info->i);
617                  return;
618               }
619            }
620         }
621
622         /* integer data */
623         if (state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST)
624         {
625            cinfo.i = info->i;
626            (*set_info)(device, state, &cinfo);
627         }
628
629         /* pointer data */
630         else if ((state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST) ||
631                (state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST) ||
632                (state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST))
633         {
634            cinfo.p = info->p;
635            (*set_info)(device, state, &cinfo);
636         }
637         break;
638   }
639}
640
641
642/*-------------------------------------------------
643    cpu_get_info - device get info
644    callback
645-------------------------------------------------*/
646
647DEVICE_GET_INFO( cpu )
648{
649   const cpu_config *config = (device != NULL) ? device->inline_config : NULL;
650   cpuinfo cinfo = { 0 };
651
652   switch (state)
653   {
654      /* --- the following bits of info are returned as 64-bit signed integers --- */
655      case DEVINFO_INT_TOKEN_BYTES:
656         cinfo.i = 0;
657         (*config->type)(device, CPUINFO_INT_CONTEXT_SIZE, &cinfo);
658         info->i = cinfo.i + sizeof(cpu_class_data) + sizeof(cpu_class_header);
659         break;
660
661      case DEVINFO_INT_INLINE_CONFIG_BYTES:   info->i = sizeof(cpu_config);            break;
662      case DEVINFO_INT_CLASS:               info->i = DEVICE_CLASS_CPU_CHIP;         break;
663
664      /* --- the following bits of info are returned as pointers to data or functions --- */
665      case DEVINFO_FCT_SET_INFO:            info->set_info = DEVICE_SET_INFO_NAME(cpu); break;
666      case DEVINFO_FCT_START:               info->start = DEVICE_START_NAME(cpu);       break;
667      case DEVINFO_FCT_STOP:               info->stop = DEVICE_STOP_NAME(cpu);       break;
668      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(cpu);       break;
669
670      default:
671         /* if we have a state pointer, we can handle some stuff for free */
672         if (device->token != NULL)
673         {
674            const cpu_class_data *classdata = get_class_data(device);
675            if (classdata->state != NULL)
676            {
677               if (state >= CPUINFO_INT_REGISTER && state <= CPUINFO_INT_REGISTER_LAST)
678               {
679                  info->i = get_register_value(device, classdata->state->baseptr, classdata->regstate[state - CPUINFO_INT_REGISTER]);
680                  return;
681               }
682               else if (state >= CPUINFO_STR_REGISTER && state <= CPUINFO_STR_REGISTER_LAST)
683               {
684                  cinfo.s = info->s;
685                  get_register_string_value(device, classdata->state->baseptr, classdata->regstate[state - CPUINFO_STR_REGISTER], cinfo.s);
686                  info->s = cinfo.s;
687                  return;
688               }
689            }
690         }
691
692         /* integer data */
693         if (state >= DEVINFO_INT_FIRST && state <= DEVINFO_INT_LAST)
694         {
695            cinfo.i = info->i;
696            (*config->type)(device, state, &cinfo);
697            info->i = cinfo.i;
698         }
699
700         /* pointer data */
701         else if ((state >= DEVINFO_PTR_FIRST && state <= DEVINFO_PTR_LAST) ||
702                (state >= DEVINFO_FCT_FIRST && state <= DEVINFO_FCT_LAST) ||
703                (state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST))
704         {
705            cinfo.p = info->p;
706            (*config->type)(device, state, &cinfo);
707            info->p = cinfo.p;
708         }
709         break;
710   }
711}
712
713
714
715/***************************************************************************
521716    CPU SCHEDULING
522717***************************************************************************/
523718
r3957r3958
528723
529724void cpu_suspend(const device_config *device, int reason, int eatcycles)
530725{
531   cpu_class_data *classdata = get_safe_classtoken(device);
726   cpu_class_data *classdata = get_class_data(device);
532727
533728   /* set the suspend reason and eat cycles flag */
534729   classdata->nextsuspend |= reason;
r3957r3958
546741
547742void cpu_resume(const device_config *device, int reason)
548743{
549   cpu_class_data *classdata = get_safe_classtoken(device);
744   cpu_class_data *classdata = get_class_data(device);
550745
551746   /* clear the suspend reason and eat cycles flag */
552747   classdata->nextsuspend &= ~reason;
r3957r3958
575770
576771int cpu_is_suspended(const device_config *device, int reason)
577772{
578   cpu_class_data *classdata = get_safe_classtoken(device);
773   cpu_class_data *classdata = get_class_data(device);
579774
580775   /* return true if the given reason is indicated */
581776   return ((classdata->nextsuspend & reason) != 0);
r3957r3958
594789
595790int cpu_get_clock(const device_config *device)
596791{
597   cpu_class_data *classdata = get_safe_classtoken(device);
792   cpu_class_data *classdata;
598793
794   /* if we haven't been started yet, compute it manually */
795   if (device->token == NULL)
796      return (UINT64)device->clock * cpu_get_clock_multiplier(device) / cpu_get_clock_divider(device);
797
599798   /* return the current clock value */
799   classdata = get_class_data(device);
600800   return classdata->clock;
601801}
602802
r3957r3958
608808
609809void cpu_set_clock(const device_config *device, int clock)
610810{
611   cpu_class_data *classdata = get_safe_classtoken(device);
811   cpu_class_data *classdata = get_class_data(device);
612812
613813   /* set the clock and update the information */
614814   classdata->clock = clock;
r3957r3958
623823
624824double cpu_get_clockscale(const device_config *device)
625825{
626   cpu_class_data *classdata = get_safe_classtoken(device);
826   cpu_class_data *classdata = get_class_data(device);
627827
628828   /* return the current clock scale factor */
629829   return classdata->clockscale;
r3957r3958
637837
638838void cpu_set_clockscale(const device_config *device, double clockscale)
639839{
640   cpu_class_data *classdata = get_safe_classtoken(device);
840   cpu_class_data *classdata = get_class_data(device);
641841
642842   /* set the scale factor and update the information */
643843   classdata->clockscale = clockscale;
r3957r3958
652852
653853attotime cpu_clocks_to_attotime(const device_config *device, UINT64 clocks)
654854{
655   cpu_class_data *classdata = get_safe_classtoken(device);
855   cpu_class_data *classdata = get_class_data(device);
656856   if (clocks < classdata->cycles_per_second)
657857      return attotime_make(0, clocks * classdata->attoseconds_per_cycle);
658858   else
r3957r3958
671871
672872UINT64 cpu_attotime_to_clocks(const device_config *device, attotime duration)
673873{
674   cpu_class_data *classdata = get_safe_classtoken(device);
874   cpu_class_data *classdata = get_class_data(device);
675875   return mulu_32x32(duration.seconds, classdata->cycles_per_second) + (UINT64)duration.attoseconds * (UINT64)classdata->attoseconds_per_cycle;
676876}
677877
r3957r3958
688888
689889attotime cpu_get_local_time(const device_config *device)
690890{
691   cpu_class_data *classdata = get_safe_classtoken(device);
891   cpu_class_data *classdata = get_class_data(device);
692892   attotime result;
693893
694894   /* if we're active, add in the time from the current slice */
r3957r3958
725925
726926UINT64 cpu_get_total_cycles(const device_config *device)
727927{
728   cpu_class_data *classdata = get_safe_classtoken(device);
928   cpu_class_data *classdata = get_class_data(device);
729929
730930   if (device == device->machine->cpuexec_data->executingcpu)
731931      return classdata->totalcycles + classdata->cycles_running - *classdata->icount;
r3957r3958
741941
742942void cpu_eat_cycles(const device_config *device, int cycles)
743943{
744   cpu_class_data *classdata = get_safe_classtoken(device);
944   cpu_class_data *classdata = get_class_data(device);
745945
746946   /* ignore if not the executing CPU */
747947   if (device != device->machine->cpuexec_data->executingcpu)
r3957r3958
760960
761961void cpu_adjust_icount(const device_config *device, int delta)
762962{
763   cpu_class_data *classdata = get_safe_classtoken(device);
963   cpu_class_data *classdata = get_class_data(device);
764964
765965   /* ignore if not the executing CPU */
766966   if (device != device->machine->cpuexec_data->executingcpu)
r3957r3958
778978
779979void cpu_abort_timeslice(const device_config *device)
780980{
781   cpu_class_data *classdata = get_safe_classtoken(device);
981   cpu_class_data *classdata = get_class_data(device);
782982   int delta;
783983
784984   /* ignore if not the executing CPU */
r3957r3958
796996}
797997
798998
799/*-------------------------------------------------
800    cpuexec_abort_timeslice - abort execution
801    for the current timeslice
802-------------------------------------------------*/
803999
804void cpuexec_abort_timeslice(running_machine *machine)
805{
806   const device_config *executingcpu = machine->cpuexec_data->executingcpu;
807   if (executingcpu != NULL)
808      cpu_abort_timeslice(executingcpu);
809}
810
811
812
8131000/***************************************************************************
8141001    SYNCHRONIZATION HELPERS
8151002***************************************************************************/
r3957r3958
8571044
8581045void cpu_spinuntil_int(const device_config *device)
8591046{
860   cpu_class_data *classdata = get_safe_classtoken(device);
1047   cpu_class_data *classdata = get_class_data(device);
8611048
8621049   /* suspend until the given trigger fires */
8631050   suspend_until_trigger(device, classdata->inttrigger, TRUE);
r3957r3958
8931080
8941081void cpuexec_trigger(running_machine *machine, int trigger)
8951082{
896   int cpunum;
1083   const device_config *cpu;
8971084
8981085   /* look for suspended CPUs waiting for this trigger and unsuspend them */
899   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++)
1086   for (cpu = machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
9001087   {
901      cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
1088      cpu_class_data *classdata = get_class_data(cpu);
9021089
9031090      /* if we're executing, for an immediate abort */
904      cpu_abort_timeslice(machine->cpu[cpunum]);
1091      cpu_abort_timeslice(cpu);
9051092
9061093      /* see if this is a matching trigger */
9071094      if (classdata->suspend != 0 && classdata->trigger == trigger)
9081095      {
909         cpu_resume(machine->cpu[cpunum], SUSPEND_REASON_TRIGGER);
1096         cpu_resume(cpu, SUSPEND_REASON_TRIGGER);
9101097         classdata->trigger = 0;
9111098      }
9121099   }
r3957r3958
9311118
9321119void cpu_triggerint(const device_config *device)
9331120{
934   cpu_class_data *classdata = get_safe_classtoken(device);
1121   cpu_class_data *classdata = get_class_data(device);
9351122
9361123   /* signal this CPU's interrupt trigger */
9371124   cpuexec_trigger(device->machine, classdata->inttrigger);
r3957r3958
9511138
9521139void cpu_set_input_line(const device_config *device, int line, int state)
9531140{
954   cpu_class_data *classdata = get_safe_classtoken(device);
1141   cpu_class_data *classdata = get_class_data(device);
9551142   int vector = (line >= 0 && line < MAX_INPUT_LINES) ? classdata->input[line].vector : 0xff;
9561143   cpu_set_input_line_and_vector(device, line, state, vector);
9571144}
r3957r3958
9651152
9661153void cpu_set_input_line_vector(const device_config *device, int line, int vector)
9671154{
968   cpu_class_data *classdata = get_safe_classtoken(device);
1155   cpu_class_data *classdata = get_class_data(device);
9691156   if (line >= 0 && line < MAX_INPUT_LINES)
9701157   {
9711158      classdata->input[line].vector = vector;
9721159      return;
9731160   }
974   LOG(("cpunum_set_input_line_vector CPU '%s' line %d > max input lines\n", device->tag, line));
1161   LOG(("cpu_set_input_line_vector CPU '%s' line %d > max input lines\n", device->tag, line));
9751162}
9761163
9771164
r3957r3958
9831170
9841171void cpu_set_input_line_and_vector(const device_config *device, int line, int state, int vector)
9851172{
986   cpu_class_data *classdata = get_safe_classtoken(device);
1173   cpu_class_data *classdata = get_class_data(device);
9871174
9881175   /* catch errors where people use PULSE_LINE for CPUs that don't support it */
9891176   if (state == PULSE_LINE && line != INPUT_LINE_NMI && line != INPUT_LINE_RESET)
r3957r3958
9951182      INT32 input_event = (state & 0xff) | (vector << 8);
9961183      int event_index = inputline->qindex++;
9971184
998      LOG(("cpunum_set_input_line_and_vector('%s',%d,%d,%02x)\n", device->tag, line, state, vector));
1185      LOG(("cpu_set_input_line_and_vector('%s',%d,%d,%02x)\n", device->tag, line, state, vector));
9991186
10001187      /* if we're full of events, flush the queue and log a message */
10011188      if (event_index >= ARRAY_LENGTH(inputline->queue))
r3957r3958
10261213
10271214void cpu_set_irq_callback(const device_config *device, cpu_irq_callback callback)
10281215{
1029   cpu_class_data *classdata = get_safe_classtoken(device);
1216   cpu_class_data *classdata = get_class_data(device);
10301217   classdata->driver_irq = callback;
10311218}
10321219
r3957r3958
10431230
10441231int cpu_getiloops(const device_config *device)
10451232{
1046   cpu_class_data *classdata = get_safe_classtoken(device);
1233   cpu_class_data *classdata = get_class_data(device);
10471234   return classdata->iloops;
10481235}
10491236
r3957r3958
10541241***************************************************************************/
10551242
10561243/*-------------------------------------------------
1057    cpu_timers_init - set up all the core timers
1058-------------------------------------------------*/
1059
1060static void cpu_timers_init(running_machine *machine)
1061{
1062   int numscreens = video_screen_count(machine->config);
1063   attoseconds_t refresh_attosecs;
1064   int cpunum, ipf;
1065
1066   /* set the core scheduling quantum */
1067   ipf = machine->config->cpu_slices_per_frame;
1068   if (ipf <= 0)
1069      ipf = 1;
1070   refresh_attosecs = (numscreens == 0) ? HZ_TO_ATTOSECONDS(60) : video_screen_get_frame_period(machine->primary_screen).attoseconds;
1071   timer_add_scheduling_quantum(machine, refresh_attosecs / ipf, attotime_never);
1072
1073   /* register the interrupt handler callbacks */
1074   for (cpunum = 0; cpunum < ARRAY_LENGTH(machine->cpu); cpunum++)
1075      if (machine->cpu[cpunum] != NULL)
1076      {
1077         const device_config *device = machine->cpu[cpunum];
1078         const cpu_config *config = device->inline_config;
1079         cpu_class_data *classdata = device->classtoken;
1080
1081         /* VBLANK interrupts */
1082         if (config->vblank_interrupts_per_frame > 0)
1083         {
1084            const device_config *screen;
1085
1086            /* get the screen that will trigger the VBLANK */
1087
1088            /* new style - use screen tag directly */
1089            if (config->vblank_interrupts_per_frame == 1)
1090               screen = device_list_find_by_tag(machine->config->devicelist, VIDEO_SCREEN, config->vblank_interrupt_screen);
1091
1092            /* old style 'hack' setup - use screen #0 */
1093            else
1094               screen = device_list_first(machine->config->devicelist, VIDEO_SCREEN);
1095
1096            assert(screen != NULL);
1097            video_screen_register_vblank_callback(screen, on_vblank, NULL);
1098         }
1099
1100         /* periodic interrupts */
1101         if (config->timed_interrupt_period != 0)
1102         {
1103            attotime timedint_period = attotime_make(0, config->timed_interrupt_period);
1104            assert(classdata->timedint_timer != NULL);
1105            timer_adjust_periodic(classdata->timedint_timer, timedint_period, cpunum, timedint_period);
1106         }
1107      }
1108}
1109
1110
1111/*-------------------------------------------------
11121244    update_clock_information - recomputes clock
11131245    information for the specified CPU
11141246-------------------------------------------------*/
11151247
11161248static void update_clock_information(const device_config *device)
11171249{
1118   cpu_class_data *classdata = device->classtoken;
1250   cpu_class_data *classdata = get_class_data(device);
11191251   INT64 attos;
11201252
11211253   /* recompute cps and spc */
11221254   classdata->cycles_per_second = (double)classdata->clock * classdata->clockscale;
1123   classdata->attoseconds_per_cycle = ATTOSECONDS_PER_SECOND / ((double)classdata->clock * classdata->clockscale);
1255   classdata->attoseconds_per_cycle = HZ_TO_ATTOSECONDS((double)classdata->clock * classdata->clockscale);
11241256
11251257   /* update the CPU's divisor */
11261258   attos = classdata->attoseconds_per_cycle;
r3957r3958
11441276
11451277static void compute_perfect_interleave(running_machine *machine)
11461278{
1147   if (machine->cpu[0] != NULL && machine->cpu[0]->classtoken != NULL)
1279   if (machine->cpu[0] != NULL)
11481280   {
1149      cpu_class_data *classdata = machine->cpu[0]->classtoken;
1150      attoseconds_t smallest = classdata->attoseconds_per_cycle * cputype_get_min_cycles(machine->config->cpu[0].type);
1281      attoseconds_t smallest = get_minimum_quantum(machine->cpu[0]);
11511282      attoseconds_t perfect = ATTOSECONDS_PER_SECOND - 1;
1152      int cpunum;
1283      const device_config *cpu;
11531284
11541285      /* start with a huge time factor and find the 2nd smallest cycle time */
1155      for (cpunum = 1; cpunum < ARRAY_LENGTH(machine->cpu) && machine->cpu[cpunum] != NULL; cpunum++)
1156         if (machine->cpu[cpunum] != NULL && machine->cpu[cpunum]->classtoken != NULL)
1286      for (cpu = machine->cpu[0]->typenext; cpu != NULL; cpu = cpu->typenext)
1287      {
1288         attoseconds_t curquantum = get_minimum_quantum(cpu);
1289
1290         /* find the 2nd smallest cycle interval */
1291         if (curquantum < smallest)
11571292         {
1158            cpu_class_data *classdata = machine->cpu[cpunum]->classtoken;
1159            attoseconds_t curtime = classdata->attoseconds_per_cycle * cputype_get_min_cycles(machine->config->cpu[cpunum].type);
1160
1161            /* find the 2nd smallest cycle interval */
1162            if (curtime < smallest)
1163            {
1164               perfect = smallest;
1165               smallest = curtime;
1166            }
1167            else if (curtime < perfect)
1168               perfect = classdata->attoseconds_per_cycle;
1293            perfect = smallest;
1294            smallest = curquantum;
11691295         }
1296         else if (curquantum < perfect)
1297            perfect = curquantum;
1298      }
11701299
11711300      /* adjust the final value */
11721301      timer_set_minimum_quantum(machine, perfect);
r3957r3958
11861315   /* VBLANK starting */
11871316   if (vblank_state)
11881317   {
1189      int cpunum;
1318      const device_config *cpu;
11901319
11911320      /* find any CPUs that have this screen as their VBLANK interrupt source */
1192      for (cpunum = 0; cpunum < ARRAY_LENGTH(device->machine->cpu); cpunum++)
1193         if (device->machine->cpu[cpunum] != NULL)
1194         {
1195            const device_config *cpudevice = device->machine->cpu[cpunum];
1196            const cpu_config *config = cpudevice->inline_config;
1197            cpu_class_data *classdata = cpudevice->classtoken;
1198            int cpu_interested;
1321      for (cpu = device->machine->cpu[0]; cpu != NULL; cpu = cpu->typenext)
1322      {
1323         const cpu_config *config = cpu->inline_config;
1324         cpu_class_data *classdata = get_class_data(cpu);
1325         int cpu_interested;
11991326
1200            /* start the interrupt counter */
1201            if (!(classdata->suspend & SUSPEND_REASON_DISABLE))
1202               classdata->iloops = 0;
1203            else
1204               classdata->iloops = -1;
1327         /* start the interrupt counter */
1328         if (!(classdata->suspend & SUSPEND_REASON_DISABLE))
1329            classdata->iloops = 0;
1330         else
1331            classdata->iloops = -1;
12051332
1206            /* the hack style VBLANK decleration always uses the first screen */
1207            if (config->vblank_interrupts_per_frame > 1)
1208               cpu_interested = TRUE;
1333         /* the hack style VBLANK decleration always uses the first screen */
1334         if (config->vblank_interrupts_per_frame > 1)
1335            cpu_interested = TRUE;
12091336
1210            /* for new style decleration, we need to compare the tags */
1211            else if (config->vblank_interrupts_per_frame == 1)
1212               cpu_interested = (strcmp(config->vblank_interrupt_screen, device->tag) == 0);
1337         /* for new style declaration, we need to compare the tags */
1338         else if (config->vblank_interrupt_screen != NULL)
1339            cpu_interested = (strcmp(config->vblank_interrupt_screen, device->tag) == 0);
12131340
1214            /* no VBLANK interrupt, not interested */
1215            else
1216               cpu_interested = FALSE;
1341         /* no VBLANK interrupt, not interested */
1342         else
1343            cpu_interested = FALSE;
12171344
1218            /* if interested, call the interrupt handler */
1219            if (cpu_interested)
1345         /* if interested, call the interrupt handler */
1346         if (cpu_interested)
1347         {
1348            if (!(classdata->suspend & (SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)))
1349               (*config->vblank_interrupt)(cpu);
1350
1351            /* if we have more than one interrupt per frame, start the timer now to trigger the rest of them */
1352            if (config->vblank_interrupts_per_frame > 1 && !(classdata->suspend & SUSPEND_REASON_DISABLE))
12201353            {
1221               if (!(classdata->suspend & (SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)))
1222                  (*config->vblank_interrupt)(cpudevice);
1223
1224               /* if we have more than one interrupt per frame, start the timer now to trigger the rest of them */
1225               if (config->vblank_interrupts_per_frame > 1 && !(classdata->suspend & SUSPEND_REASON_DISABLE))
1226               {
1227                  classdata->partial_frame_period = attotime_div(video_screen_get_frame_period(device->machine->primary_screen), config->vblank_interrupts_per_frame);
1228                  timer_adjust_oneshot(classdata->partial_frame_timer, classdata->partial_frame_period, cpunum);
1229               }
1354               classdata->partial_frame_period = attotime_div(video_screen_get_frame_period(device->machine->primary_screen), config->vblank_interrupts_per_frame);
1355               timer_adjust_oneshot(classdata->partial_frame_timer, classdata->partial_frame_period, 0);
12301356            }
12311357         }
1358      }
12321359   }
12331360}
12341361
r3957r3958
12421369{
12431370   const device_config *device = ptr;
12441371   const cpu_config *config = device->inline_config;
1245   cpu_class_data *classdata = device->classtoken;
1372   cpu_class_data *classdata = get_class_data(device);
12461373
12471374   if (classdata->iloops == 0)
12481375      classdata->iloops = config->vblank_interrupts_per_frame;
r3957r3958
12941421static TIMER_CALLBACK( empty_event_queue )
12951422{
12961423   const device_config *device = ptr;
1297   cpu_class_data *classdata = device->classtoken;
1424   cpu_class_data *classdata = get_class_data(device);
12981425   cpu_input_data *inputline = &classdata->input[param];
12991426   int curevent;
13001427
r3957r3958
13201447            /* if we're clearing the line that was previously asserted, or if we're just */
13211448            /* pulsing the line, reset the CPU */
13221449            if ((state == CLEAR_LINE && cpu_is_suspended(device, SUSPEND_REASON_RESET)) || state == PULSE_LINE)
1323               cpu_reset(device);
1450               device_reset(device);
13241451
13251452            /* if we're clearing the line, make sure the CPU is not halted */
13261453            cpu_resume(device, SUSPEND_REASON_RESET);
r3957r3958
13461473         switch (state)
13471474         {
13481475            case PULSE_LINE:
1349               /* temporary: PULSE_LINE only makes sense for NMI lines on Z80 */
1350               assert(classdata->header.cputype != CPU_Z80 || param == INPUT_LINE_NMI);
1351               cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, ASSERT_LINE);
1352               cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, CLEAR_LINE);
1476               device_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, ASSERT_LINE);
1477               device_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, CLEAR_LINE);
13531478               break;
13541479
13551480            case HOLD_LINE:
13561481            case ASSERT_LINE:
1357               cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, ASSERT_LINE);
1482               device_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, ASSERT_LINE);
13581483               break;
13591484
13601485            case CLEAR_LINE:
1361               cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, CLEAR_LINE);
1486               device_set_info_int(device, CPUINFO_INT_INPUT_STATE + param, CLEAR_LINE);
13621487               break;
13631488
13641489            default:
r3957r3958
13851510
13861511static IRQ_CALLBACK( standard_irq_callback )
13871512{
1388   cpu_class_data *classdata = device->classtoken;
1513   cpu_class_data *classdata = get_class_data(device);
13891514   cpu_input_data *inputline = &classdata->input[irqline];
13901515   int vector = inputline->curvector;
13911516
r3957r3958
13951520   if (inputline->curstate == HOLD_LINE)
13961521   {
13971522      LOG(("->set_irq_line('%s',%d,%d)\n", device->tag, irqline, CLEAR_LINE));
1398      cpu_set_info_int(device, CPUINFO_INT_INPUT_STATE + irqline, CLEAR_LINE);
1523      device_set_info_int(device, CPUINFO_INT_INPUT_STATE + irqline, CLEAR_LINE);
13991524      inputline->curstate = CLEAR_LINE;
14001525   }
14011526
r3957r3958
14181543
14191544static void register_save_states(const device_config *device)
14201545{
1421   cpu_class_data *classdata = device->classtoken;
1546   cpu_class_data *classdata = get_class_data(device);
14221547   int line;
14231548
14241549   state_save_register_device_item(device, 0, classdata->suspend);
r3957r3958
14441569   }
14451570}
14461571
1572
1573/*-------------------------------------------------
1574    get_register_value - return a register value
1575    of a CPU using the state table
1576-------------------------------------------------*/
1577
1578static UINT64 get_register_value(const device_config *device, void *baseptr, const cpu_state_entry *entry)
1579{
1580   void *dataptr;
1581   UINT64 result;
1582
1583   /* NULL entry returns 0 */
1584   if (entry == NULL || baseptr == NULL)
1585      return 0;
1586
1587   /* if we have an exporter, call it now */
1588   if ((entry->flags & CPUSTATE_EXPORT) != 0)
1589   {
1590      cpu_state_io_func exportcb = (cpu_state_io_func)device_get_info_fct(device, CPUINFO_FCT_EXPORT_STATE);
1591      assert(exportcb != NULL);
1592      (*exportcb)(device, baseptr, entry);
1593   }
1594
1595   /* pick up the value */
1596   dataptr = (UINT8 *)baseptr + entry->dataoffs;
1597   switch (entry->datasize)
1598   {
1599      default:
1600      case 1:   result = *(UINT8 *)dataptr;      break;
1601      case 2:   result = *(UINT16 *)dataptr;   break;
1602      case 4:   result = *(UINT32 *)dataptr;   break;
1603      case 8:   result = *(UINT64 *)dataptr;   break;
1604   }
1605   return result & entry->mask;
1606}
1607
1608
1609/*-------------------------------------------------
1610    set_register_value - set the value of a
1611    CPU register using the state table
1612-------------------------------------------------*/
1613
1614static void set_register_value(const device_config *device, void *baseptr, const cpu_state_entry *entry, UINT64 value)
1615{
1616   void *dataptr;
1617
1618   /* NULL entry is a no-op */
1619   if (entry == NULL || baseptr == NULL)
1620      return;
1621
1622   /* apply the mask */
1623   value &= entry->mask;
1624
1625   /* sign-extend if necessary */
1626   if ((entry->flags & CPUSTATE_IMPORT_SEXT) != 0 && value > (entry->mask >> 1))
1627      value |= ~entry->mask;
1628
1629   /* store the value */
1630   dataptr = (UINT8 *)baseptr + entry->dataoffs;
1631   switch (entry->datasize)
1632   {
1633      default:
1634      case 1:   *(UINT8 *)dataptr = value;      break;
1635      case 2:   *(UINT16 *)dataptr = value;      break;
1636      case 4:   *(UINT32 *)dataptr = value;      break;
1637      case 8:   *(UINT64 *)dataptr = value;      break;
1638   }
1639
1640   /* if we have an importer, call it now */
1641   if ((entry->flags & CPUSTATE_IMPORT) != 0)
1642   {
1643      cpu_state_io_func importcb = (cpu_state_io_func)device_get_info_fct(device, CPUINFO_FCT_IMPORT_STATE);
1644      assert(importcb != NULL);
1645      (*importcb)(device, baseptr, entry);
1646   }
1647}
1648
1649
1650/*-------------------------------------------------
1651    get_register_string_value - return a string
1652    representation of a CPU register using the
1653    state table
1654-------------------------------------------------*/
1655
1656static void get_register_string_value(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *dest)
1657{
1658   static const UINT64 decdivisor[] = {
1659      1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000,
1660      U64(10000000000),          U64(100000000000),          U64(1000000000000),
1661      U64(10000000000000),       U64(100000000000000),       U64(1000000000000000),
1662      U64(10000000000000000),    U64(100000000000000000),    U64(1000000000000000000),
1663      U64(10000000000000000000)
1664   };
1665   static const char hexchars[] = "0123456789ABCDEF";
1666   int leadzero = 0, width = 0, percent = 0, explicitsign = 0, hitnonzero = 0, reset;
1667   const char *fptr;
1668   UINT64 result;
1669
1670   /* NULL entry does nothing */
1671   if (entry == NULL || entry->symbol == NULL || entry->format == NULL)
1672      return;
1673
1674   /* fetch the data */
1675   result = get_register_value(device, baseptr, entry);
1676
1677   /* start with the basics */
1678   dest += sprintf(dest, "%s%s:", (entry->flags & CPUSTATE_NOSHOW) ? "~" : "", entry->symbol);
1679
1680   /* parse the format */
1681   reset = TRUE;
1682   for (fptr = entry->format; *fptr != 0; fptr++)
1683   {
1684      int digitnum;
1685
1686      /* reset any accumulated state */
1687      if (reset)
1688         leadzero = width = percent = explicitsign = reset = 0;
1689
1690      /* if we're not within a format, then anything other than a % outputs directly */
1691      if (!percent && *fptr != '%')
1692      {
1693         *dest++ = *fptr;
1694         continue;
1695      }
1696
1697      /* handle each character in turn */
1698      switch (*fptr)
1699      {
1700         /* % starts a format; %% outputs a single % */
1701         case '%':
1702            if (!percent)
1703               percent = TRUE;
1704            else
1705            {
1706               *dest++ = *fptr;
1707               percent = FALSE;
1708            }
1709            break;
1710
1711         /* 0 means insert leading 0s, unless it follows another width digit */
1712         case '0':
1713            if (width == 0)
1714               leadzero = TRUE;
1715            else
1716               width *= 10;
1717            break;
1718
1719         /* 1-9 accumulate into the width */
1720         case '1':    case '2':    case '3':    case '4':   case '5':
1721         case '6':   case '7':   case '8':   case '9':
1722            width = width * 10 + (*fptr - '0');
1723            break;
1724
1725         /* + means explicit sign */
1726         case '+':
1727            explicitsign = TRUE;
1728            break;
1729
1730         /* X outputs as hexadecimal */
1731         case 'X':
1732            if (width == 0)
1733               fatalerror("Width required for %%X formats\n");
1734            hitnonzero = FALSE;
1735            while (leadzero && width > 16)
1736            {
1737               *dest++ = ' ';
1738               width--;
1739            }
1740            for (digitnum = 15; digitnum >= 0; digitnum--)
1741            {
1742               int digit = (result >> (4 * digitnum)) & 0x0f;
1743               if (digit != 0)
1744                  *dest++ = hexchars[digit];
1745               else if (hitnonzero || (leadzero && digitnum < width) || digitnum == 0)
1746                  *dest++ = '0';
1747               hitnonzero |= digit;
1748            }
1749            reset = TRUE;
1750            break;
1751
1752         /* d outputs as signed decimal */
1753         case 'd':
1754            if (width == 0)
1755               fatalerror("Width required for %%d formats\n");
1756            if ((result & entry->mask) > (entry->mask >> 1))
1757            {
1758               result = -result & entry->mask;
1759               *dest++ = '-';
1760               width--;
1761            }
1762            else if (explicitsign)
1763            {
1764               *dest++ = '+';
1765               width--;
1766            }
1767            /* fall through to unsigned case */
1768
1769         /* u outputs as unsigned decimal */
1770         case 'u':
1771            if (width == 0)
1772               fatalerror("Width required for %%u formats\n");
1773            hitnonzero = FALSE;
1774            while (leadzero && width > ARRAY_LENGTH(decdivisor))
1775            {
1776               *dest++ = ' ';
1777               width--;
1778            }
1779            for (digitnum = ARRAY_LENGTH(decdivisor); digitnum >= 0; digitnum--)
1780            {
1781               int digit = (result >= decdivisor[digitnum]) ? (result / decdivisor[digitnum]) % 10 : 0;
1782               if (digit != 0)
1783                  *dest++ = '0' + digit;
1784               else if (hitnonzero || (leadzero && digitnum < width) || digitnum == 0)
1785                  *dest++ = '0';
1786               hitnonzero |= digit;
1787            }
1788            reset = TRUE;
1789            break;
1790
1791         /* s is a custom format */
1792         case 's':
1793         {
1794            cpu_string_io_func exportstring = (cpu_string_io_func)device_get_info_fct(device, CPUINFO_FCT_EXPORT_STRING);
1795            assert(exportstring != NULL);
1796            (*exportstring)(device, baseptr, entry, dest);
1797            dest += strlen(dest);
1798            break;
1799         }
1800
1801         /* other formats unknown */
1802         default:
1803            fatalerror("Unknown format character '%c'\n", *fptr);
1804            break;
1805      }
1806   }
1807   *dest = 0;
1808}
1809
1810
1811/*-------------------------------------------------
1812    get_register_string_max_width - return the
1813    maximum width of a string described by a
1814    format
1815-------------------------------------------------*/
1816
1817#ifdef UNUSED_FUNCTION
1818static int get_register_string_max_width(const device_config *device, void *baseptr, const cpu_state_entry *entry)
1819{
1820   int leadzero = 0, width = 0, percent = 0, explicitsign = 0, reset;
1821   int totalwidth = 0;
1822   const char *fptr;
1823
1824   /* NULL entry does nothing */
1825   if (entry == NULL || entry->symbol == NULL || entry->format == NULL)
1826      return 0;
1827
1828   /* parse the format */
1829   reset = TRUE;
1830   for (fptr = entry->format; *fptr != 0; fptr++)
1831   {
1832      /* reset any accumulated state */
1833      if (reset)
1834         leadzero = width = percent = explicitsign = reset = 0;
1835
1836      /* if we're not within a format, then anything other than a % outputs directly */
1837      if (!percent && *fptr != '%')
1838      {
1839         totalwidth++;
1840         continue;
1841      }
1842
1843      /* handle each character in turn */
1844      switch (*fptr)
1845      {
1846         /* % starts a format; %% outputs a single % */
1847         case '%':
1848            if (!percent)
1849               percent = TRUE;
1850            else
1851            {
1852               totalwidth++;
1853               percent = FALSE;
1854            }
1855            break;
1856
1857         /* 0 means insert leading 0s, unless it follows another width digit */
1858         case '0':
1859            if (width == 0)
1860               leadzero = TRUE;
1861            else
1862               width *= 10;
1863            break;
1864
1865         /* 1-9 accumulate into the width */
1866         case '1':    case '2':    case '3':    case '4':   case '5':
1867         case '6':   case '7':   case '8':   case '9':
1868            width = width * 10 + (*fptr - '0');
1869            break;
1870
1871         /* + means explicit sign */
1872         case '+':
1873            explicitsign = TRUE;
1874            break;
1875
1876         /* X outputs as hexadecimal */
1877         /* d outputs as signed decimal */
1878         /* u outputs as unsigned decimal */
1879         /* s outputs as custom format */
1880         case 'X':
1881         case 'd':
1882         case 'u':
1883         case 's':
1884            totalwidth += width;
1885            reset = TRUE;
1886            break;
1887
1888            if (width == 0)
1889               fatalerror("Width required for %%d formats\n");
1890            totalwidth += width;
1891            break;
1892
1893         /* other formats unknown */
1894         default:
1895            fatalerror("Unknown format character '%c'\n", *fptr);
1896            break;
1897      }
1898   }
1899   return totalwidth;
1900}
1901#endif
src/emu/cpuintrf.h
r3957r3958
1818#include "memory.h"
1919#include "watchdog.h"
2020#include "state.h"
21#include <stddef.h>
2122
2223
2324/***************************************************************************
2425    CONSTANTS
2526***************************************************************************/
2627
27#define MAX_CPU 8
28#define MAX_CPU             8
2829#define MAX_INPUT_EVENTS      32
2930
3031
31/* Interrupt line constants */
32/* I/O line states */
3233enum
3334{
34   /* line states */
35   CLEAR_LINE = 0,            /* clear (a fired, held or pulsed) line */
35   CLEAR_LINE = 0,            /* clear (a fired or held) line */
3636   ASSERT_LINE,            /* assert an interrupt immediately */
3737   HOLD_LINE,               /* hold interrupt line until acknowledged */
38   PULSE_LINE,               /* pulse interrupt line for one instruction */
38   PULSE_LINE               /* pulse interrupt line instantaneously (only for NMI, RESET) */
39};
3940
41
42/* I/O line definitions */
43enum
44{
4045   /* input lines */
4146   MAX_INPUT_LINES = 32+3,
4247   INPUT_LINE_IRQ0 = 0,
r3957r3958
6065};
6166
6267
63/* Maximum number of registers of any CPU */
68/* register definitions */
6469enum
6570{
66   MAX_REGS = 256
71   MAX_REGS = 256,
72
73   REG_GENPCBASE = MAX_REGS - 1,   /* generic "base" PC, should point to start of current opcode */
74   REG_GENPC = MAX_REGS - 2,      /* generic PC, may point within an opcode */
75   REG_GENSP = MAX_REGS - 3      /* generic SP, or closest equivalent */
6776};
6877
6978
r3957r3958
7382   /* --- the following bits of info are returned as 64-bit signed integers --- */
7483   CPUINFO_INT_FIRST = DEVINFO_INT_FIRST,
7584
76      /* direct map to device data */
77      CPUINFO_INT_CONTEXT_SIZE = DEVINFO_INT_TOKEN_BYTES,      /* R/O: size of CPU context in bytes */
78
7985      /* CPU-specific additions */
80      CPUINFO_INT_INPUT_LINES = DEVINFO_INT_CLASS_SPECIFIC,   /* R/O: number of input lines */
86      CPUINFO_INT_CONTEXT_SIZE = DEVINFO_INT_CLASS_SPECIFIC,   /* R/O: size of CPU context in bytes */
87      CPUINFO_INT_INPUT_LINES,                     /* R/O: number of input lines */
8188      CPUINFO_INT_OUTPUT_LINES,                     /* R/O: number of output lines */
8289      CPUINFO_INT_DEFAULT_IRQ_VECTOR,                  /* R/O: default IRQ vector */
8390      CPUINFO_INT_ENDIANNESS,                        /* R/O: either ENDIANNESS_BIG or ENDIANNESS_LITTLE */
r3957r3958
8996      CPUINFO_INT_MAX_CYCLES,                        /* R/O: maximum cycles for a single instruction */
9097
9198      CPUINFO_INT_DATABUS_WIDTH,                     /* R/O: data bus size for each address space (8,16,32,64) */
99      CPUINFO_INT_DATABUS_WIDTH_PROGRAM = CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM,
100      CPUINFO_INT_DATABUS_WIDTH_DATA = CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA,
101      CPUINFO_INT_DATABUS_WIDTH_IO = CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO,
92102      CPUINFO_INT_DATABUS_WIDTH_LAST = CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACES - 1,
93103      CPUINFO_INT_ADDRBUS_WIDTH,                     /* R/O: address bus size for each address space (12-32) */
104      CPUINFO_INT_ADDRBUS_WIDTH_PROGRAM = CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM,
105      CPUINFO_INT_ADDRBUS_WIDTH_DATA = CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA,
106      CPUINFO_INT_ADDRBUS_WIDTH_IO = CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO,
94107      CPUINFO_INT_ADDRBUS_WIDTH_LAST = CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACES - 1,
95108      CPUINFO_INT_ADDRBUS_SHIFT,                     /* R/O: shift applied to addresses each address space (+3 means >>3, -1 means <<1) */
109      CPUINFO_INT_ADDRBUS_SHIFT_PROGRAM = CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM,
110      CPUINFO_INT_ADDRBUS_SHIFT_DATA = CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA,
111      CPUINFO_INT_ADDRBUS_SHIFT_IO = CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO,
96112      CPUINFO_INT_ADDRBUS_SHIFT_LAST = CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACES - 1,
97113      CPUINFO_INT_LOGADDR_WIDTH,                     /* R/O: address bus size for logical accesses in each space (0=same as physical) */
114      CPUINFO_INT_LOGADDR_WIDTH_PROGRAM = CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_PROGRAM,
115      CPUINFO_INT_LOGADDR_WIDTH_DATA = CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_DATA,
116      CPUINFO_INT_LOGADDR_WIDTH_IO = CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACE_IO,
98117      CPUINFO_INT_LOGADDR_WIDTH_LAST = CPUINFO_INT_LOGADDR_WIDTH + ADDRESS_SPACES - 1,
99118      CPUINFO_INT_PAGE_SHIFT,                        /* R/O: size of a page log 2 (i.e., 12=4096), or 0 if paging not supported */
119      CPUINFO_INT_PAGE_SHIFT_PROGRAM = CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_PROGRAM,
120      CPUINFO_INT_PAGE_SHIFT_DATA = CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_DATA,
121      CPUINFO_INT_PAGE_SHIFT_IO = CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACE_IO,
100122      CPUINFO_INT_PAGE_SHIFT_LAST = CPUINFO_INT_PAGE_SHIFT + ADDRESS_SPACES - 1,
101123
102      CPUINFO_INT_SP,                              /* R/W: the current stack pointer value */
103      CPUINFO_INT_PC,                              /* R/W: the current PC value */
104      CPUINFO_INT_PREVIOUSPC,                        /* R/W: the previous PC value */
105124      CPUINFO_INT_INPUT_STATE,                     /* R/W: states for each input line */
106125      CPUINFO_INT_INPUT_STATE_LAST = CPUINFO_INT_INPUT_STATE + MAX_INPUT_LINES - 1,
107126      CPUINFO_INT_OUTPUT_STATE,                     /* R/W: states for each output line */
108127      CPUINFO_INT_OUTPUT_STATE_LAST = CPUINFO_INT_OUTPUT_STATE + MAX_OUTPUT_LINES - 1,
109128      CPUINFO_INT_REGISTER,                        /* R/W: values of up to MAX_REGs registers */
129      CPUINFO_INT_SP = CPUINFO_INT_REGISTER + REG_GENSP,      /* R/W: the current stack pointer value */
130      CPUINFO_INT_PC = CPUINFO_INT_REGISTER + REG_GENPC,      /* R/W: the current PC value */
131      CPUINFO_INT_PREVIOUSPC = CPUINFO_INT_REGISTER + REG_GENPCBASE,   /* R/W: the previous PC value */
110132      CPUINFO_INT_REGISTER_LAST = CPUINFO_INT_REGISTER + MAX_REGS - 1,
111133
112134   CPUINFO_INT_CPU_SPECIFIC = 0x08000,                  /* R/W: CPU-specific values start here */
r3957r3958
118140      CPUINFO_PTR_INSTRUCTION_COUNTER = DEVINFO_PTR_CLASS_SPECIFIC,
119141                                             /* R/O: int *icount */
120142      CPUINFO_PTR_INTERNAL_MEMORY_MAP,               /* R/O: const addrmap_token *map */
143      CPUINFO_PTR_INTERNAL_MEMORY_MAP_PROGRAM = CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM,
144      CPUINFO_PTR_INTERNAL_MEMORY_MAP_DATA = CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA,
145      CPUINFO_PTR_INTERNAL_MEMORY_MAP_IO = CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO,
121146      CPUINFO_PTR_INTERNAL_MEMORY_MAP_LAST = CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACES - 1,
122      CPUINFO_PTR_DEBUG_REGISTER_LIST,               /* R/O: int *list: list of registers for the debugger */
147      CPUINFO_PTR_STATE_TABLE,                     /* R/O: cpu_state_table *state */
123148
124149   CPUINFO_PTR_CPU_SPECIFIC = DEVINFO_PTR_DEVICE_SPECIFIC,   /* R/W: CPU-specific values start here */
125150
r3957r3958
127152   CPUINFO_FCT_FIRST = DEVINFO_FCT_FIRST,
128153
129154      /* CPU-specific additions */
130      CPUINFO_PTR_RESET = DEVINFO_FCT_RESET,            /* R/O: void (*reset)(const device_config *device) */
131      CPUINFO_PTR_EXIT = DEVINFO_FCT_STOP,            /* R/O: void (*exit)(const device_config *device) */
155      CPUINFO_FCT_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC,   /* R/O: void (*set_info)(const device_config *device, UINT32 state, INT64 data, void *ptr) */
156      CPUINFO_FCT_INIT,                           /* R/O: void (*init)(const device_config *device, int index, int clock, int (*irqcallback)(const device_config *device, int)) */
157      CPUINFO_FCT_RESET,                           /* R/O: void (*reset)(const device_config *device) */
158      CPUINFO_FCT_EXIT,                           /* R/O: void (*exit)(const device_config *device) */
159      CPUINFO_FCT_EXECUTE,                        /* R/O: int (*execute)(const device_config *device, int cycles) */
160      CPUINFO_FCT_BURN,                           /* R/O: void (*burn)(const device_config *device, int cycles) */
161      CPUINFO_FCT_DISASSEMBLE,                     /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) */
162      CPUINFO_FCT_TRANSLATE,                        /* R/O: int (*translate)(const device_config *device, int space, int intention, offs_t *address) */
163      CPUINFO_FCT_READ,                           /* R/O: int (*read)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value) */
164      CPUINFO_FCT_WRITE,                           /* R/O: int (*write)(const device_config *device, int space, UINT32 offset, int size, UINT64 value) */
165      CPUINFO_FCT_READOP,                           /* R/O: int (*readop)(const device_config *device, UINT32 offset, int size, UINT64 *value) */
166      CPUINFO_FCT_DEBUG_INIT,                        /* R/O: void (*debug_init)(const device_config *device) */
167      CPUINFO_FCT_VALIDITY_CHECK,                     /* R/O: int (*validity_check)(const game_driver *driver, const void *config) */
168      CPUINFO_FCT_IMPORT_STATE,                     /* R/O: void (*import_state)(const device_config *device, void *baseptr, const cpu_state_entry *entry) */
169      CPUINFO_FCT_EXPORT_STATE,                     /* R/O: void (*export_state)(const device_config *device, void *baseptr, const cpu_state_entry *entry) */
170      CPUINFO_FCT_IMPORT_STRING,                     /* R/O: void (*import_string)(const device_config *device, void *baseptr, const cpu_state_entry *entry, const char *format, char *string) */
171      CPUINFO_FCT_EXPORT_STRING,                     /* R/O: void (*export_string)(const device_config *device, void *baseptr, const cpu_state_entry *entry, const char *format, char *string) */
132172
133      CPUINFO_PTR_SET_INFO = DEVINFO_FCT_CLASS_SPECIFIC,   /* R/O: void (*set_info)(const device_config *device, UINT32 state, INT64 data, void *ptr) */
134      CPUINFO_PTR_INIT,                           /* R/O: void (*init)(const device_config *device, int index, int clock, int (*irqcallback)(const device_config *device, int)) */
135      CPUINFO_PTR_EXECUTE,                        /* R/O: int (*execute)(const device_config *device, int cycles) */
136      CPUINFO_PTR_BURN,                           /* R/O: void (*burn)(const device_config *device, int cycles) */
137      CPUINFO_PTR_DISASSEMBLE,                     /* R/O: offs_t (*disassemble)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) */
138      CPUINFO_PTR_TRANSLATE,                        /* R/O: int (*translate)(const device_config *device, int space, int intention, offs_t *address) */
139      CPUINFO_PTR_READ,                           /* R/O: int (*read)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value) */
140      CPUINFO_PTR_WRITE,                           /* R/O: int (*write)(const device_config *device, int space, UINT32 offset, int size, UINT64 value) */
141      CPUINFO_PTR_READOP,                           /* R/O: int (*readop)(const device_config *device, UINT32 offset, int size, UINT64 *value) */
142      CPUINFO_PTR_DEBUG_INIT,                        /* R/O: void (*debug_init)(const device_config *device) */
143      CPUINFO_PTR_VALIDITY_CHECK,                     /* R/O: int (*validity_check)(const game_driver *driver, const void *config) */
144
145173   CPUINFO_FCT_CPU_SPECIFIC = DEVINFO_FCT_DEVICE_SPECIFIC,   /* R/W: CPU-specific values start here */
146174
147175   /* --- the following bits of info are returned as NULL-terminated strings --- */
r3957r3958
163191};
164192
165193
166/* get_reg/set_reg constants */
167enum
168{
169   /* This value is passed to cpu_get_reg to retrieve the previous
170     * program counter value, ie. before a CPU emulation started
171     * to fetch opcodes and arguments for the current instrution. */
172   REG_PREVIOUSPC = CPUINFO_INT_PREVIOUSPC - CPUINFO_INT_REGISTER,
173
174   /* This value is passed to cpu_get_reg to retrieve the current
175     * program counter value. */
176   REG_PC = CPUINFO_INT_PC - CPUINFO_INT_REGISTER,
177
178   /* This value is passed to cpu_get_reg to retrieve the current
179     * stack pointer value. */
180   REG_SP = CPUINFO_INT_SP - CPUINFO_INT_REGISTER
181};
182
183
184194/* Translation intentions */
185195#define TRANSLATE_TYPE_MASK      0x03      /* read write or fetch */
186196#define TRANSLATE_USER_MASK      0x04      /* user mode or fully privileged */
r3957r3958
207217#define DASMFLAG_STEP_OVER_EXTRA(x)         ((x) << DASMFLAG_OVERINSTSHIFT)
208218
209219
210/* list of all possible CPUs we might be compiled with */
211enum _cpu_type
212{
213   CPU_DUMMY,
214   CPU_Z80,
215   CPU_Z180,
216   CPU_8080,
217   CPU_8085A,
218   CPU_M6502,
219   CPU_M65C02,
220   CPU_M65SC02,
221   CPU_M65CE02,
222   CPU_M6509,
223   CPU_M6510,
224   CPU_M6510T,
225   CPU_M7501,
226   CPU_M8502,
227   CPU_N2A03,
228   CPU_DECO16,
229   CPU_M4510,
230   CPU_H6280,
231   CPU_I8086,
232   CPU_I8088,
233   CPU_I80186,
234   CPU_I80188,
235   CPU_I80286,
236   CPU_V20,
237   CPU_V25,
238   CPU_V30,
239   CPU_V33,
240   CPU_V35,
241   CPU_V60,
242   CPU_V70,
243   CPU_I8035,
244   CPU_I8048,
245   CPU_I8648,
246   CPU_I8748,
247   CPU_MB8884,
248   CPU_N7751,
249   CPU_I8039,
250   CPU_I8049,
251   CPU_I8749,
252   CPU_M58715,
253   CPU_I8041,
254   CPU_I8741,
255   CPU_I8042,
256   CPU_I8242,
257   CPU_I8742,
258   CPU_I8031,
259   CPU_I8032,
260   CPU_I8051,
261   CPU_I8052,
262   CPU_I8751,
263   CPU_I8752,
264   CPU_I80C31,
265   CPU_I80C32,
266   CPU_I80C51,
267   CPU_I80C52,
268   CPU_I87C51,
269   CPU_I87C52,
270   CPU_AT89C4051,
271   CPU_DS5002FP,
272   CPU_M6800,
273   CPU_M6801,
274   CPU_M6802,
275   CPU_M6803,
276   CPU_M6808,
277   CPU_HD63701,
278   CPU_NSC8105,
279   CPU_M6805,
280   CPU_M68705,
281   CPU_HD63705,
282   CPU_HD6309,
283   CPU_M6809,
284   CPU_M6809E,
285   CPU_KONAMI,
286   CPU_M68000,
287   CPU_M68008,
288   CPU_M68010,
289   CPU_M68EC020,
290   CPU_M68020,
291   CPU_M68040,
292   CPU_T11,
293   CPU_S2650,
294   CPU_TMS34010,
295   CPU_TMS34020,
296   CPU_TI990_10,
297   CPU_TMS9900,
298   CPU_TMS9980,
299   CPU_TMS9995,
300   CPU_Z8000,
301   CPU_TMS32010,
302   CPU_TMS32025,
303   CPU_TMS32026,
304   CPU_TMS32031,
305   CPU_TMS32032,
306   CPU_TMS32051,
307   CPU_CCPU,
308   CPU_ADSP2100,
309    CPU_ADSP2101,
310   CPU_ADSP2104,
311   CPU_ADSP2105,
312   CPU_ADSP2115,
313   CPU_ADSP2181,
314   CPU_PSXCPU,
315   CPU_ASAP,
316   CPU_UPD7810,
317   CPU_UPD7807,
318   CPU_UPD7801,
319   CPU_UPD78C05,
320   CPU_UPD78C06,
321   CPU_JAGUARGPU,
322   CPU_JAGUARDSP,
323   CPU_CQUESTSND,
324   CPU_CQUESTROT,
325   CPU_CQUESTLIN,
326   CPU_R3000BE,
327   CPU_R3000LE,
328   CPU_R3041BE,
329   CPU_R3041LE,
330   CPU_R4600BE,
331   CPU_R4600LE,
332   CPU_R4650BE,
333   CPU_R4650LE,
334   CPU_R4700BE,
335   CPU_R4700LE,
336   CPU_R5000BE,
337   CPU_R5000LE,
338   CPU_QED5271BE,
339   CPU_QED5271LE,
340   CPU_RM7000BE,
341   CPU_RM7000LE,
342   CPU_ARM,
343   CPU_ARM7,
344   CPU_SH1,
345   CPU_SH2,
346   CPU_SH4,
347   CPU_DSP32C,
348   CPU_PIC16C54,
349   CPU_PIC16C55,
350   CPU_PIC16C56,
351   CPU_PIC16C57,
352   CPU_PIC16C58,
353   CPU_G65816,
354   CPU_SPC700,
355   CPU_E116T,
356   CPU_E116XT,
357   CPU_E116XS,
358   CPU_E116XSR,
359   CPU_E132N,
360   CPU_E132T,
361   CPU_E132XN,
362   CPU_E132XT,
363   CPU_E132XS,
364   CPU_E132XSR,
365   CPU_GMS30C2116,
366   CPU_GMS30C2132,
367   CPU_GMS30C2216,
368   CPU_GMS30C2232,
369   CPU_I386,
370   CPU_I486,
371   CPU_PENTIUM,
372   CPU_MEDIAGX,
373   CPU_I960,
374   CPU_H83002,
375   CPU_H83007,
376   CPU_H83044,
377   CPU_H83334,
378   CPU_V810,
379   CPU_M37702,
380   CPU_M37710,
381   CPU_PPC403GA,
382   CPU_PPC403GCX,
383   CPU_PPC601,
384   CPU_PPC602,
385   CPU_PPC603,
386   CPU_PPC603E,
387   CPU_PPC603R,
388   CPU_PPC604,
389   CPU_MPC8240,
390   CPU_SE3208,
391   CPU_MC68HC11,
392   CPU_ADSP21062,
393   CPU_DSP56156,
394   CPU_RSP,
395   CPU_ALPHA8201,
396   CPU_ALPHA8301,
397   CPU_CDP1802,
398   CPU_COP401,
399   CPU_COP410,
400   CPU_COP411,
401   CPU_COP402,
402   CPU_COP420,
403   CPU_COP421,
404   CPU_COP422,
405   CPU_COP404,
406   CPU_COP424,
407   CPU_COP425,
408   CPU_COP426,
409   CPU_COP444,
410   CPU_COP445,
411   CPU_TMP90840,
412   CPU_TMP90841,
413   CPU_TMP91640,
414   CPU_TMP91641,
415   CPU_APEXC,
416   CPU_CP1610,
417   CPU_F8,
418   CPU_LH5801,
419   CPU_PDP1,
420   CPU_SATURN,
421   CPU_SC61860,
422   CPU_TX0_64KW,
423   CPU_TX0_8KW,
424   CPU_LR35902,
425   CPU_TMS7000,
426   CPU_TMS7000_EXL,
427   CPU_SM8500,
428   CPU_V30MZ,
429   CPU_MB8841,
430   CPU_MB8842,
431   CPU_MB8843,
432   CPU_MB8844,
433   CPU_MB86233,
434   CPU_SSP1601,
435   CPU_MINX,
436   CPU_CXD8661R,
437    CPU_COUNT
438};
439typedef enum _cpu_type cpu_type;
220/* state table flags */
221#define CPUSTATE_NOSHOW         0x01      /* don't display this entry in the registers view */
222#define CPUSTATE_IMPORT         0x02      /* call the import function after writing new data */
223#define CPUSTATE_IMPORT_SEXT   0x04      /* sign-extend the data when writing new data */
224#define CPUSTATE_EXPORT         0x08      /* call the export function prior to fetching the data */
440225
441226
442227
r3957r3958
446231
447232#define IRQ_CALLBACK(func)         int func(const device_config *device, int irqline)
448233
449#define CPU_GET_INFO_NAME(name)      cpu_get_info_##name
450#define CPU_GET_INFO(name)         void CPU_GET_INFO_NAME(name)(const device_config *device, UINT32 state, cpuinfo *info)
451#define CPU_GET_INFO_CALL(name)      CPU_GET_INFO_NAME(name)(device, state, info)
234#define CPU_GET_INFO_NAME(name)         cpu_get_info_##name
235#define CPU_GET_INFO(name)            void CPU_GET_INFO_NAME(name)(const device_config *device, UINT32 state, cpuinfo *info)
236#define CPU_GET_INFO_CALL(name)         CPU_GET_INFO_NAME(name)(device, state, info)
452237
453#define CPU_SET_INFO_NAME(name)      cpu_set_info_##name
454#define CPU_SET_INFO(name)         void CPU_SET_INFO_NAME(name)(const device_config *device, UINT32 state, cpuinfo *info)
455#define CPU_SET_INFO_CALL(name)      CPU_SET_INFO_NAME(name)(device, state, info)
238#define CPU_SET_INFO_NAME(name)         cpu_set_info_##name
239#define CPU_SET_INFO(name)            void CPU_SET_INFO_NAME(name)(const device_config *device, UINT32 state, cpuinfo *info)
240#define CPU_SET_INFO_CALL(name)         CPU_SET_INFO_NAME(name)(device, state, info)
456241
457#define CPU_INIT_NAME(name)         cpu_init_##name
458#define CPU_INIT(name)            void CPU_INIT_NAME(name)(const device_config *device, int index, int clock, cpu_irq_callback irqcallback)
459#define CPU_INIT_CALL(name)         CPU_INIT_NAME(name)(device, index, clock, irqcallback)
242#define CPU_INIT_NAME(name)            cpu_init_##name
243#define CPU_INIT(name)               void CPU_INIT_NAME(name)(const device_config *device, cpu_irq_callback irqcallback)
244#define CPU_INIT_CALL(name)            CPU_INIT_NAME(name)(device, irqcallback)
460245
461#define CPU_RESET_NAME(name)      cpu_reset_##name
462#define CPU_RESET(name)            void CPU_RESET_NAME(name)(const device_config *device)
463#define CPU_RESET_CALL(name)      CPU_RESET_NAME(name)(device)
246#define CPU_RESET_NAME(name)         cpu_reset_##name
247#define CPU_RESET(name)               void CPU_RESET_NAME(name)(const device_config *device)
248#define CPU_RESET_CALL(name)         CPU_RESET_NAME(name)(device)
464249
465#define CPU_EXIT_NAME(name)         cpu_exit_##name
466#define CPU_EXIT(name)            void CPU_EXIT_NAME(name)(const device_config *device)
467#define CPU_EXIT_CALL(name)         CPU_EXIT_NAME(name)(device)
250#define CPU_EXIT_NAME(name)            cpu_exit_##name
251#define CPU_EXIT(name)               void CPU_EXIT_NAME(name)(const device_config *device)
252#define CPU_EXIT_CALL(name)            CPU_EXIT_NAME(name)(device)
468253
469#define CPU_EXECUTE_NAME(name)      cpu_execute_##name
470#define CPU_EXECUTE(name)         int CPU_EXECUTE_NAME(name)(const device_config *device, int cycles)
471#define CPU_EXECUTE_CALL(name)      CPU_EXECUTE_NAME(name)(device, cycles)
254#define CPU_EXECUTE_NAME(name)         cpu_execute_##name
255#define CPU_EXECUTE(name)            int CPU_EXECUTE_NAME(name)(const device_config *device, int cycles)
256#define CPU_EXECUTE_CALL(name)         CPU_EXECUTE_NAME(name)(device, cycles)
472257
473#define CPU_BURN_NAME(name)         cpu_burn_##name
474#define CPU_BURN(name)            void CPU_BURN_NAME(name)(const device_config *device, int cycles)
475#define CPU_BURN_CALL(name)         CPU_BURN_NAME(name)(device, cycles)
258#define CPU_BURN_NAME(name)            cpu_burn_##name
259#define CPU_BURN(name)               void CPU_BURN_NAME(name)(const device_config *device, int cycles)
260#define CPU_BURN_CALL(name)            CPU_BURN_NAME(name)(device, cycles)
476261
477#define CPU_TRANSLATE_NAME(name)   cpu_translate_##name
478#define CPU_TRANSLATE(name)         int CPU_TRANSLATE_NAME(name)(const device_config *device, int space, int intention, offs_t *address)
479#define CPU_TRANSLATE_CALL(name)   CPU_TRANSLATE_NAME(name)(device, space, intention, address)
262#define CPU_TRANSLATE_NAME(name)      cpu_translate_##name
263#define CPU_TRANSLATE(name)            int CPU_TRANSLATE_NAME(name)(const device_config *device, int space, int intention, offs_t *address)
264#define CPU_TRANSLATE_CALL(name)      CPU_TRANSLATE_NAME(name)(device, space, intention, address)
480265
481#define CPU_READ_NAME(name)         cpu_read_##name
482#define CPU_READ(name)            int CPU_READ_NAME(name)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value)
483#define CPU_READ_CALL(name)         CPU_READ_NAME(name)(device, space, offset, size, value)
266#define CPU_READ_NAME(name)            cpu_read_##name
267#define CPU_READ(name)               int CPU_READ_NAME(name)(const device_config *device, int space, UINT32 offset, int size, UINT64 *value)
268#define CPU_READ_CALL(name)            CPU_READ_NAME(name)(device, space, offset, size, value)
484269
485#define CPU_WRITE_NAME(name)      cpu_write_##name
486#define CPU_WRITE(name)            int CPU_WRITE_NAME(name)(const device_config *device, int space, UINT32 offset, int size, UINT64 value)
487#define CPU_WRITE_CALL(name)      CPU_WRITE_NAME(name)(device, space, offset, size, value)
270#define CPU_WRITE_NAME(name)         cpu_write_##name
271#define CPU_WRITE(name)               int CPU_WRITE_NAME(name)(const device_config *device, int space, UINT32 offset, int size, UINT64 value)
272#define CPU_WRITE_CALL(name)         CPU_WRITE_NAME(name)(device, space, offset, size, value)
488273
489#define CPU_READOP_NAME(name)      cpu_readop_##name
490#define CPU_READOP(name)         int CPU_READOP_NAME(name)(const device_config *device, UINT32 offset, int size, UINT64 *value)
491#define CPU_READOP_CALL(name)      CPU_READOP_NAME(name)(device, offset, size, value)
274#define CPU_READOP_NAME(name)         cpu_readop_##name
275#define CPU_READOP(name)            int CPU_READOP_NAME(name)(const device_config *device, UINT32 offset, int size, UINT64 *value)
276#define CPU_READOP_CALL(name)         CPU_READOP_NAME(name)(device, offset, size, value)
492277
493#define CPU_DEBUG_INIT_NAME(name)    cpu_debug_init_##name
494#define CPU_DEBUG_INIT(name)      void CPU_DEBUG_INIT_NAME(name)(const device_config *device)
495#define CPU_DEBUG_INIT_CALL(name)   CPU_DEBUG_INIT_NAME(name)(device)
278#define CPU_DEBUG_INIT_NAME(name)       cpu_debug_init_##name
279#define CPU_DEBUG_INIT(name)         void CPU_DEBUG_INIT_NAME(name)(const device_config *device)
280#define CPU_DEBUG_INIT_CALL(name)      CPU_DEBUG_INIT_NAME(name)(device)
496281
497#define CPU_DISASSEMBLE_NAME(name)   cpu_disassemble_##name
498#define CPU_DISASSEMBLE(name)      offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
499#define CPU_DISASSEMBLE_CALL(name)   CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram)
282#define CPU_DISASSEMBLE_NAME(name)      cpu_disassemble_##name
283#define CPU_DISASSEMBLE(name)         offs_t CPU_DISASSEMBLE_NAME(name)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
284#define CPU_DISASSEMBLE_CALL(name)      CPU_DISASSEMBLE_NAME(name)(device, buffer, pc, oprom, opram)
500285
501286#define CPU_VALIDITY_CHECK_NAME(name)   cpu_validity_check_##name
502287#define CPU_VALIDITY_CHECK(name)      int CPU_VALIDITY_CHECK_NAME(name)(const game_driver *driver, const void *config)
503288#define CPU_VALIDITY_CHECK_CALL(name)   CPU_VALIDITY_CHECK_NAME(name)(driver, config)
504289
290#define CPU_IMPORT_STATE_NAME(name)      cpu_state_import_##name
291#define CPU_IMPORT_STATE(name)         void CPU_IMPORT_STATE_NAME(name)(const device_config *device, void *baseptr, const cpu_state_entry *entry)
292#define CPU_IMPORT_STATE_CALL(name)      CPU_IMPORT_STATE_NAME(name)(device, baseptr, entry)
505293
506/* helpers for accessing common CPU state */
507#define cpu_get_context_size(cpu)         cpu_get_info_int(cpu, CPUINFO_INT_CONTEXT_SIZE)
508#define cpu_get_input_lines(cpu)         cpu_get_info_int(cpu, CPUINFO_INT_INPUT_LINES)
509#define cpu_get_output_lines(cpu)         cpu_get_info_int(cpu, CPUINFO_INT_OUTPUT_LINES)
510#define cpu_get_default_irq_vector(cpu)      cpu_get_info_int(cpu, CPUINFO_INT_DEFAULT_IRQ_VECTOR)
511#define cpu_get_endianness(cpu)            cpu_get_info_int(cpu, CPUINFO_INT_ENDIANNESS)
512#define cpu_get_clock_multiplier(cpu)      cpu_get_info_int(cpu, CPUINFO_INT_CLOCK_MULTIPLIER)
513#define cpu_get_clock_divider(cpu)         cpu_get_info_int(cpu, CPUINFO_INT_CLOCK_DIVIDER)
514#define cpu_get_min_opcode_bytes(cpu)      cpu_get_info_int(cpu, CPUINFO_INT_MIN_INSTRUCTION_BYTES)
515#define cpu_get_max_opcode_bytes(cpu)      cpu_get_info_int(cpu, CPUINFO_INT_MAX_INSTRUCTION_BYTES)
516#define cpu_get_min_cycles(cpu)            cpu_get_info_int(cpu, CPUINFO_INT_MIN_CYCLES)
517#define cpu_get_max_cycles(cpu)            cpu_get_info_int(cpu, CPUINFO_INT_MAX_CYCLES)
518#define cpu_get_databus_width(cpu, space)   cpu_get_info_int(cpu, CPUINFO_INT_DATABUS_WIDTH + (space))
519#define cpu_get_addrbus_width(cpu, space)   cpu_get_info_int(cpu, CPUINFO_INT_ADDRBUS_WIDTH + (space))
520#define cpu_get_addrbus_shift(cpu, space)   cpu_get_info_int(cpu, CPUINFO_INT_ADDRBUS_SHIFT + (space))
521#define cpu_get_logaddr_width(cpu, space)   cpu_get_info_int(cpu, CPUINFO_INT_LOGADDR_WIDTH + (space))
522#define cpu_get_page_shift(cpu, space)      cpu_get_info_int(cpu, CPUINFO_INT_PAGE_SHIFT + (space))
523#define cpu_get_reg(cpu, reg)            cpu_get_info_int(cpu, CPUINFO_INT_REGISTER + (reg))
524#define   cpu_get_previouspc(cpu)            ((offs_t)cpu_get_reg(cpu, REG_PREVIOUSPC))
525#define   cpu_get_pc(cpu)                  ((offs_t)cpu_get_reg(cpu, REG_PC))
526#define   cpu_get_sp(cpu)                  cpu_get_reg(cpu, REG_SP)
527#define cpu_get_icount_ptr(cpu)            (int *)cpu_get_info_ptr(cpu, CPUINFO_PTR_INSTRUCTION_COUNTER)
528#define cpu_get_debug_register_list(cpu)   cpu_get_info_ptr(cpu, CPUINFO_PTR_DEBUG_REGISTER_LIST)
529#define cpu_get_name(cpu)               cpu_get_info_string(cpu, CPUINFO_STR_NAME)
530#define cpu_get_core_family(cpu)         cpu_get_info_string(cpu, CPUINFO_STR_CORE_FAMILY)
531#define cpu_get_core_version(cpu)         cpu_get_info_string(cpu, CPUINFO_STR_CORE_VERSION)
532#define cpu_get_core_file(cpu)            cpu_get_info_string(cpu, CPUINFO_STR_CORE_FILE)
533#define cpu_get_core_credits(cpu)         cpu_get_info_string(cpu, CPUINFO_STR_CORE_CREDITS)
534#define cpu_get_flags_string(cpu)         cpu_get_info_string(cpu, CPUINFO_STR_FLAGS)
535#define cpu_get_irq_string(cpu, irq)      cpu_get_info_string(cpu, CPUINFO_STR_IRQ_STATE + (irq))
536#define cpu_get_reg_string(cpu, reg)      cpu_get_info_string(cpu, CPUINFO_STR_REGISTER + (reg))
537#define cpu_set_reg(cpu, reg, val)         cpu_set_info_int(cpu, CPUINFO_INT_REGISTER + (reg), (val))
294#define CPU_EXPORT_STATE_NAME(name)      cpu_state_export_##name
295#define CPU_EXPORT_STATE(name)         void CPU_EXPORT_STATE_NAME(name)(const device_config *device, void *baseptr, const cpu_state_entry *entry)
296#define CPU_EXPORT_STATE_CALL(name)      CPU_EXPORT_STATE_NAME(name)(device, baseptr, entry)
538297
298#define CPU_IMPORT_STRING_NAME(name)   cpu_string_import_##name
299#define CPU_IMPORT_STRING(name)         void CPU_IMPORT_STRING_NAME(name)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string)
300#define CPU_IMPORT_STRING_CALL(name)   CPU_IMPORT_STRING_NAME(name)(device, baseptr, entry, string)
539301
540/* helpers for accessing common CPU type state */
541#define cputype_get_context_size(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_CONTEXT_SIZE)
542#define cputype_get_input_lines(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_INPUT_LINES)
543#define cputype_get_output_lines(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_OUTPUT_LINES)
544#define cputype_get_default_irq_vector(cputype)      cputype_get_info_int(cputype, CPUINFO_INT_DEFAULT_IRQ_VECTOR)
545#define cputype_get_endianness(cputype)            cputype_get_info_int(cputype, CPUINFO_INT_ENDIANNESS)
546#define cputype_get_clock_multiplier(cputype)      cputype_get_info_int(cputype, CPUINFO_INT_CLOCK_MULTIPLIER)
547#define cputype_get_clock_divider(cputype)         cputype_get_info_int(cputype, CPUINFO_INT_CLOCK_DIVIDER)
548#define cputype_get_min_instruction_bytes(cputype)   cputype_get_info_int(cputype, CPUINFO_INT_MIN_INSTRUCTION_BYTES)
549#define cputype_get_max_instruction_bytes(cputype)   cputype_get_info_int(cputype, CPUINFO_INT_MAX_INSTRUCTION_BYTES)
550#define cputype_get_min_cycles(cputype)            cputype_get_info_int(cputype, CPUINFO_INT_MIN_CYCLES)
551#define cputype_get_max_cycles(cputype)            cputype_get_info_int(cputype, CPUINFO_INT_MAX_CYCLES)
552#define cputype_get_databus_width(cputype, space)   cputype_get_info_int(cputype, CPUINFO_INT_DATABUS_WIDTH + (space))
553#define cputype_get_addrbus_width(cputype, space)   cputype_get_info_int(cputype, CPUINFO_INT_ADDRBUS_WIDTH + (space))
554#define cputype_get_addrbus_shift(cputype, space)   cputype_get_info_int(cputype, CPUINFO_INT_ADDRBUS_SHIFT + (space))
555#define cputype_get_logaddr_width(cputype, space)   cputype_get_info_int(cputype, CPUINFO_INT_LOGADDR_WIDTH + (space))
556#define cputype_get_page_shift(cputype, space)      cputype_get_info_int(cputype, CPUINFO_INT_PAGE_SHIFT + (space))
557#define cputype_get_debug_register_list(cputype)   cputype_get_info_ptr(cputype, CPUINFO_PTR_DEBUG_REGISTER_LIST)
558#define cputype_get_name(cputype)               cputype_get_info_string(cputype, CPUINFO_STR_NAME)
559#define cputype_get_core_family(cputype)         cputype_get_info_string(cputype, CPUINFO_STR_CORE_FAMILY)
560#define cputype_get_core_version(cputype)         cputype_get_info_string(cputype, CPUINFO_STR_CORE_VERSION)
561#define cputype_get_core_file(cputype)            cputype_get_info_string(cputype, CPUINFO_STR_CORE_FILE)
562#define cputype_get_core_credits(cputype)         cputype_get_info_string(cputype, CPUINFO_STR_CORE_CREDITS)
302#define CPU_EXPORT_STRING_NAME(name)   cpu_string_export_##name
303#define CPU_EXPORT_STRING(name)         void CPU_EXPORT_STRING_NAME(name)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string)
304#define CPU_EXPORT_STRING_CALL(name)   CPU_EXPORT_STRING_NAME(name)(device, baseptr, entry, string)
563305
564306
307
308#define cpu_get_index(cpu)               device_list_index((cpu)->machine->config->devicelist, CPU, (cpu)->tag)
309
310
311/* helpers for accessing common CPU state */
312#define cpu_get_context_size(cpu)         device_get_info_int(cpu, CPUINFO_INT_CONTEXT_SIZE)
313#define cpu_get_input_lines(cpu)         device_get_info_int(cpu, CPUINFO_INT_INPUT_LINES)
314#define cpu_get_output_lines(cpu)         device_get_info_int(cpu, CPUINFO_INT_OUTPUT_LINES)
315#define cpu_get_default_irq_vector(cpu)      device_get_info_int(cpu, CPUINFO_INT_DEFAULT_IRQ_VECTOR)
316#define cpu_get_endianness(cpu)            device_get_info_int(cpu, CPUINFO_INT_ENDIANNESS)
317#define cpu_get_clock_multiplier(cpu)      device_get_info_int(cpu, CPUINFO_INT_CLOCK_MULTIPLIER)
318#define cpu_get_clock_divider(cpu)         device_get_info_int(cpu, CPUINFO_INT_CLOCK_DIVIDER)
319#define cpu_get_min_opcode_bytes(cpu)      device_get_info_int(cpu, CPUINFO_INT_MIN_INSTRUCTION_BYTES)
320#define cpu_get_max_opcode_bytes(cpu)      device_get_info_int(cpu, CPUINFO_INT_MAX_INSTRUCTION_BYTES)
321#define cpu_get_min_cycles(cpu)            device_get_info_int(cpu, CPUINFO_INT_MIN_CYCLES)
322#define cpu_get_max_cycles(cpu)            device_get_info_int(cpu, CPUINFO_INT_MAX_CYCLES)
323#define cpu_get_databus_width(cpu, space)   device_get_info_int(cpu, CPUINFO_INT_DATABUS_WIDTH + (space))
324#define cpu_get_addrbus_width(cpu, space)   device_get_info_int(cpu, CPUINFO_INT_ADDRBUS_WIDTH + (space))
325#define cpu_get_addrbus_shift(cpu, space)   device_get_info_int(cpu, CPUINFO_INT_ADDRBUS_SHIFT + (space))
326#define cpu_get_logaddr_width(cpu, space)   device_get_info_int(cpu, CPUINFO_INT_LOGADDR_WIDTH + (space))
327#define cpu_get_page_shift(cpu, space)      device_get_info_int(cpu, CPUINFO_INT_PAGE_SHIFT + (space))
328#define cpu_get_reg(cpu, reg)            device_get_info_int(cpu, CPUINFO_INT_REGISTER + (reg))
329#define   cpu_get_previouspc(cpu)            ((offs_t)cpu_get_reg(cpu, REG_GENPCBASE))
330#define   cpu_get_pc(cpu)                  ((offs_t)cpu_get_reg(cpu, REG_GENPC))
331#define   cpu_get_sp(cpu)                  cpu_get_reg(cpu, REG_GENSP)
332#define cpu_get_icount_ptr(cpu)            (int *)device_get_info_ptr(cpu, CPUINFO_PTR_INSTRUCTION_COUNTER)
333#define cpu_get_state_table(cpu)         (const cpu_state_table *)device_get_info_ptr(cpu, CPUINFO_PTR_STATE_TABLE)
334#define cpu_get_name(cpu)               device_get_info_string(cpu, CPUINFO_STR_NAME)
335#define cpu_get_core_family(cpu)         device_get_info_string(cpu, CPUINFO_STR_CORE_FAMILY)
336#define cpu_get_core_version(cpu)         device_get_info_string(cpu, CPUINFO_STR_CORE_VERSION)
337#define cpu_get_core_file(cpu)            device_get_info_string(cpu, CPUINFO_STR_CORE_FILE)
338#define cpu_get_core_credits(cpu)         device_get_info_string(cpu, CPUINFO_STR_CORE_CREDITS)
339#define cpu_get_flags_string(cpu)         device_get_info_string(cpu, CPUINFO_STR_FLAGS)
340#define cpu_get_irq_string(cpu, irq)      device_get_info_string(cpu, CPUINFO_STR_IRQ_STATE + (irq))
341#define cpu_get_reg_string(cpu, reg)      device_get_info_string(cpu, CPUINFO_STR_REGISTER + (reg))
342#define cpu_set_reg(cpu, reg, val)         device_set_info_int(cpu, CPUINFO_INT_REGISTER + (reg), (val))
343
344
565345/* helpers for using machine/cputag instead of cpu objects */
566#define cputag_reset(mach, tag)                  cpu_reset(cputag_get_cpu(mach, tag))
346#define cputag_reset(mach, tag)                  device_reset(cputag_get_cpu(mach, tag))
567347#define cputag_get_index(mach, tag)               cpu_get_index(cputag_get_cpu(mach, tag))
568348#define cputag_get_address_space(mach, tag, space)   cpu_get_address_space(cputag_get_cpu(mach, tag), space)
569349
570350
351#define CPU_STATE_ENTRY(_index, _symbol, _format, _struct, _member, _datamask, _validmask, _flags) \
352   { _index, _validmask, offsetof(_struct, _member), _datamask, sizeof(((_struct *)0)->_member), _flags, _symbol, _format },
571353
354
355
572356/***************************************************************************
573357    TYPE DEFINITIONS
574358***************************************************************************/
575359
576/* opaque definition of CPU debugging info */
360/* opaque definition of CPU internal and debugging info */
577361typedef struct _cpu_debug_data cpu_debug_data;
578362
579363
580/* forward declaration of this union */
364/* forward declaration of types */
581365typedef union _cpuinfo cpuinfo;
366typedef struct _cpu_state_entry cpu_state_entry;
582367
583368
584369/* define the various callback functions */
r3957r3958
586371
587372typedef void (*cpu_get_info_func)(const device_config *device, UINT32 state, cpuinfo *info);
588373typedef void (*cpu_set_info_func)(const device_config *device, UINT32 state, cpuinfo *info);
589typedef void (*cpu_init_func)(const device_config *device, int index, int clock, cpu_irq_callback irqcallback);
374typedef void (*cpu_init_func)(const device_config *device, cpu_irq_callback irqcallback);
590375typedef void (*cpu_reset_func)(const device_config *device);
591376typedef void (*cpu_exit_func)(const device_config *device);
592377typedef int   (*cpu_execute_func)(const device_config *device, int cycles);
r3957r3958
597382typedef int   (*cpu_readop_func)(const device_config *device, UINT32 offset, int size, UINT64 *value);
598383typedef void (*cpu_debug_init_func)(const device_config *device);
599384typedef offs_t (*cpu_disassemble_func)(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
600
601385typedef int (*cpu_validity_check_func)(const game_driver *driver, const void *config);
386typedef void (*cpu_state_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry);
387typedef void (*cpu_string_io_func)(const device_config *device, void *baseptr, const cpu_state_entry *entry, char *string);
602388
603389
390/* structure describing a single item of exposed CPU state */
391struct _cpu_state_entry
392{
393   UINT32               index;                  /* state index this entry applies to */
394   UINT32               validmask;               /* mask for which CPU subtypes this entry is valid */
395   FPTR               dataoffs;               /* offset to the data, relative to the baseptr */
396   UINT64               mask;                  /* mask applied to the data */
397   UINT8               datasize;               /* size of the data item in memory */
398   UINT8               flags;                  /* flags */
399   const char *         symbol;                  /* symbol for display; all lower-case version for expressions */
400   const char *         format;                  /* supported formats */
401};
402
403
404/* structure describing a table of exposed CPU state */
405typedef struct _cpu_state_table cpu_state_table;
406struct _cpu_state_table
407{
408   void *               baseptr;               /* pointer to the base of state (offsets are relative to this) */
409   UINT32               subtypemask;            /* mask of subtypes that apply to this CPU */
410   UINT32               entrycount;               /* number of entries */
411   const cpu_state_entry *   entrylist;               /* array of entries */
412};
413
414
415/* a cpu_type is just a pointer to the CPU's get_info function */
416typedef cpu_get_info_func cpu_type;
417
418
604419/* cpuinfo union used to pass data to/from the get_info/set_info functions */
605420union _cpuinfo
606421{
r3957r3958
609424   genf *              f;                     /* generic function pointers */
610425   char *               s;                     /* generic strings */
611426
612   cpu_set_info_func      setinfo;               /* CPUINFO_PTR_SET_INFO */
613   cpu_init_func         init;                  /* CPUINFO_PTR_INIT */
614   cpu_reset_func         reset;                  /* CPUINFO_PTR_RESET */
615   cpu_exit_func         exit;                  /* CPUINFO_PTR_EXIT */
616   cpu_execute_func      execute;               /* CPUINFO_PTR_EXECUTE */
617   cpu_burn_func         burn;                  /* CPUINFO_PTR_BURN */
618   cpu_translate_func      translate;               /* CPUINFO_PTR_TRANSLATE */
619   cpu_read_func         read;                  /* CPUINFO_PTR_READ */
620   cpu_write_func         write;                  /* CPUINFO_PTR_WRITE */
621   cpu_readop_func         readop;                  /* CPUINFO_PTR_READOP */
622   cpu_debug_init_func      debug_init;               /* CPUINFO_PTR_DEBUG_INIT */
623   cpu_disassemble_func   disassemble;            /* CPUINFO_PTR_DISASSEMBLE */
624   cpu_validity_check_func   validity_check;            /* CPUINFO_PTR_VALIDITY_CHECK */
427   cpu_set_info_func      setinfo;               /* CPUINFO_FCT_SET_INFO */
428   cpu_init_func         init;                  /* CPUINFO_FCT_INIT */
429   cpu_reset_func         reset;                  /* CPUINFO_FCT_RESET */
430   cpu_exit_func         exit;                  /* CPUINFO_FCT_EXIT */
431   cpu_execute_func      execute;               /* CPUINFO_FCT_EXECUTE */
432   cpu_burn_func         burn;                  /* CPUINFO_FCT_BURN */
433   cpu_translate_func      translate;               /* CPUINFO_FCT_TRANSLATE */
434   cpu_read_func         read;                  /* CPUINFO_FCT_READ */
435   cpu_write_func         write;                  /* CPUINFO_FCT_WRITE */
436   cpu_readop_func         readop;                  /* CPUINFO_FCT_READOP */
437   cpu_debug_init_func      debug_init;               /* CPUINFO_FCT_DEBUG_INIT */
438   cpu_disassemble_func   disassemble;            /* CPUINFO_FCT_DISASSEMBLE */
439   cpu_validity_check_func   validity_check;            /* CPUINFO_FCT_VALIDITY_CHECK */
440   cpu_state_io_func      import_state;            /* CPUINFO_FCT_IMPORT_STATE */
441   cpu_state_io_func      export_state;            /* CPUINFO_FCT_EXPORT_STATE */
442   cpu_string_io_func       import_string;            /* CPUINFO_FCT_IMPORT_STRING */
443   cpu_string_io_func       export_string;            /* CPUINFO_FCT_EXPORT_STRING */
625444   int *               icount;                  /* CPUINFO_PTR_INSTRUCTION_COUNTER */
445   const cpu_state_table *   state_table;            /* CPUINFO_PTR_STATE_TABLE */
626446   const addrmap8_token *   internal_map8;            /* CPUINFO_PTR_INTERNAL_MEMORY_MAP */
627447   const addrmap16_token *   internal_map16;            /* CPUINFO_PTR_INTERNAL_MEMORY_MAP */
628448   const addrmap32_token *   internal_map32;            /* CPUINFO_PTR_INTERNAL_MEMORY_MAP */
r3957r3958
634454typedef struct _cpu_class_header cpu_class_header;
635455struct _cpu_class_header
636456{
637   int                  index;               /* index of this CPU */
638   cpu_type            cputype;             /* type index of this CPU */
639   cpu_debug_data *      debug;               /* debugging data */
640   const address_space *   space[ADDRESS_SPACES];   /* address spaces */
457   cpu_debug_data *      debug;                  /* debugging data */
458   const address_space *   space[ADDRESS_SPACES];      /* address spaces */
641459
642460   /* table of core functions */
643   cpu_get_info_func      get_info;
644461   cpu_set_info_func      set_info;
645   cpu_init_func         init;
646   cpu_reset_func         reset;
647   cpu_exit_func         exit;
648462   cpu_execute_func      execute;
649463   cpu_burn_func         burn;
650464   cpu_translate_func      translate;
651465   cpu_disassemble_func   disassemble;
652466   cpu_disassemble_func    dasm_override;
653
654   /* other frequently-needed information */
655   INT8               address_shift[ADDRESS_SPACES];
656   UINT32               clock_divider;
657   UINT32               clock_multiplier;
658467};
659468
660469
661470
662471/***************************************************************************
663    FUNCTION PROTOTYPES
472    CPU DEFINITIONS
664473***************************************************************************/
665474
475#define cpu_count(config)      device_list_items((config)->devicelist, CPU)
476#define cpu_first(config)      device_list_first((config)->devicelist, CPU)
477#define cpu_next(previous)      device_list_next((previous), CPU)
666478
667/* ----- global management ----- */
668479
669/* reset the internal CPU tracking */
670void cpuintrf_init(running_machine *machine);
480CPU_GET_INFO( dummy );
481#define CPU_DUMMY CPU_GET_INFO_NAME( dummy )
671482
672/* circular string buffer */
673char *cpuintrf_temp_str(void);
674483
675484
485/***************************************************************************
486    FUNCTION PROTOTYPES
487***************************************************************************/
676488
677/* ----- live context control ----- */
678489
679/* find a CPU in the machine by searching */
680int cpu_get_index_slow(const device_config *cpu);
681
682
683
684490/* ----- live CPU accessors ----- */
685491
686/* initialize a live CPU */
687void cpu_init(const device_config *cpu, int index, int clock, cpu_irq_callback irqcallback);
688
689/* free a live CPU */
690void cpu_exit(const device_config *cpu);
691
692/* return information about a live CPU */
693INT64 cpu_get_info_int(const device_config *cpu, UINT32 state);
694void *cpu_get_info_ptr(const device_config *cpu, UINT32 state);
695genf *cpu_get_info_fct(const device_config *cpu, UINT32 state);
696const char *cpu_get_info_string(const device_config *cpu, UINT32 state);
697
698/* set information about a live CPU */
699void cpu_set_info_int(const device_config *cpu, UINT32 state, INT64 data);
700void cpu_set_info_ptr(const device_config *cpu, UINT32 state, void *data);
701void cpu_set_info_fct(const device_config *cpu, UINT32 state, genf *data);
702
703/* signal a reset for a given CPU */
704void cpu_reset(const device_config *cpu);
705
706492/* return the PC, corrected to a byte offset and translated to physical space, on a given CPU */
707493offs_t cpu_get_physical_pc_byte(const device_config *cpu);
708494
r3957r3958
714500
715501
716502
717/* ----- CPU type accessors ----- */
718
719/* return a header template for a given CPU type */
720const cpu_class_header *cputype_get_header_template(cpu_type cputype);
721
722/* return information about a given CPU type */
723INT64 cputype_get_info_int(cpu_type cputype, UINT32 state);
724void *cputype_get_info_ptr(cpu_type cputype, UINT32 state);
725genf *cputype_get_info_fct(cpu_type cputype, UINT32 state);
726const char *cputype_get_info_string(cpu_type cputype, UINT32 state);
727
728
729
730503/***************************************************************************
731504    INLINE FUNCTIONS
732505***************************************************************************/
733506
734507/*-------------------------------------------------
735    cpu_get_index - return the index of the
736    specified CPU (deprecated soon)
508    cpu_get_class_header - return a pointer to
509    the class header
737510-------------------------------------------------*/
738511
739INLINE int cpu_get_index(const device_config *cpu)
512INLINE cpu_class_header *cpu_get_class_header(const device_config *device)
740513{
741   cpu_class_header *classheader = cpu->classtoken;
742   return (classheader != NULL) ? classheader->index : cpu_get_index_slow(cpu);
514   if (device->token != NULL)
515      return (cpu_class_header *)((UINT8 *)device->token + device->tokenbytes) - 1;
516   return NULL;
743517}
744518
745519
r3957r3958
748522    the given CPU's debugger data
749523-------------------------------------------------*/
750524
751INLINE cpu_debug_data *cpu_get_debug_data(const device_config *cpu)
525INLINE cpu_debug_data *cpu_get_debug_data(const device_config *device)
752526{
753   cpu_class_header *classheader = cpu->classtoken;
527   cpu_class_header *classheader = cpu_get_class_header(device);
754528   return classheader->debug;
755529}
756530
r3957r3958
760534    the given CPU's address space
761535-------------------------------------------------*/
762536
763INLINE const address_space *cpu_get_address_space(const device_config *cpu, int spacenum)
537INLINE const address_space *cpu_get_address_space(const device_config *device, int spacenum)
764538{
765   cpu_class_header *classheader = cpu->classtoken;
766   return classheader->space[spacenum];
539   /* it is faster to pull this from the class header, but only after we've started */
540   if (device->token != NULL)
541   {
542      cpu_class_header *classheader = cpu_get_class_header(device);
543      return classheader->space[spacenum];
544   }
545   return memory_find_address_space(device, spacenum);
767546}
768547
769548
r3957r3958
774553
775554INLINE int cpu_execute(const device_config *device, int cycles)
776555{
777   cpu_class_header *classheader = device->classtoken;
556   cpu_class_header *classheader = cpu_get_class_header(device);
778557   return (*classheader->execute)(device, cycles);
779558}
780559
src/emu/cpuexec.h
r3957r3958
4949    TYPE DEFINITIONS
5050***************************************************************************/
5151
52typedef void (*cpu_interrupt_func)(const device_config *device);
53
54
5255/* CPU description for drivers */
5356typedef struct _cpu_config cpu_config;
5457struct _cpu_config
5558{
56   cpu_type      type;                  /* index for the CPU type */
57   int            flags;                  /* flags; see #defines below */
58   int            clock;                  /* in Hertz */
59   const addrmap_token *address_map[ADDRESS_SPACES][2]; /* 2 memory maps per address space */
60   void          (*vblank_interrupt)(const device_config *device);   /* for interrupts tied to VBLANK */
61   int          vblank_interrupts_per_frame;/* usually 1 */
62   const char *   vblank_interrupt_screen;   /* the screen that causes the VBLANK interrupt */
63   void          (*timed_interrupt)(const device_config *device);   /* for interrupts not tied to VBLANK */
64   attoseconds_t    timed_interrupt_period;      /* period for periodic interrupts */
65   const void *   reset_param;            /* parameter for cpu_reset */
66   const char *   tag;
59   cpu_type         type;                  /* index for the CPU type */
60   UINT32            flags;                  /* flags; see #defines below */
61   const addrmap_token *address_map[ADDRESS_SPACES]; /* 2 memory maps per address space */
62   const addrmap_token *address_map2[ADDRESS_SPACES]; /* 2 memory maps per address space */
63   cpu_interrupt_func    vblank_interrupt;         /* for interrupts tied to VBLANK */
64   int             vblank_interrupts_per_frame;/* usually 1 */
65   const char *      vblank_interrupt_screen;   /* the screen that causes the VBLANK interrupt */
66   cpu_interrupt_func    timed_interrupt;         /* for interrupts not tied to VBLANK */
67   UINT64             timed_interrupt_period;      /* period for periodic interrupts */
6768};
6869
6970
7071
7172/***************************************************************************
73    CPU DEVICE CONFIGURATION MACROS
74***************************************************************************/
75
76#define MDRV_CPU_ADD(_tag, _type, _clock) \
77   MDRV_DEVICE_ADD(_tag, CPU, _clock) \
78   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, type, CPU_##_type)
79
80#define MDRV_CPU_REMOVE(_tag) \
81   MDRV_DEVICE_REMOVE(_tag, CPU)
82
83#define MDRV_CPU_MODIFY(_tag) \
84   MDRV_DEVICE_MODIFY(_tag, CPU)
85
86#define MDRV_CPU_TYPE(_type) \
87   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, type, CPU_##_type)
88
89#define MDRV_CPU_CLOCK(_clock) \
90   MDRV_DEVICE_CLOCK(_clock)
91
92#define MDRV_CPU_REPLACE(_tag, _type, _clock) \
93   MDRV_DEVICE_MODIFY(_tag, CPU) \
94   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, type, CPU_##_type) \
95   MDRV_DEVICE_CLOCK(_clock)
96
97#define MDRV_CPU_FLAGS(_flags) \
98   MDRV_DEVICE_CONFIG_DATA32(cpu_config, flags, _flags)
99
100#define MDRV_CPU_CONFIG(_config) \
101   MDRV_DEVICE_CONFIG(_config)
102
103#define MDRV_CPU_PROGRAM_MAP(_map1, _map2) \
104   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_PROGRAM, ADDRESS_MAP_NAME(_map1)) \
105   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_PROGRAM, ADDRESS_MAP_NAME(_map2))
106
107#define MDRV_CPU_DATA_MAP(_map1, _map2) \
108   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_DATA, ADDRESS_MAP_NAME(_map1)) \
109   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_DATA, ADDRESS_MAP_NAME(_map2))
110
111#define MDRV_CPU_IO_MAP(_map1, _map2) \
112   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map, ADDRESS_SPACE_IO, ADDRESS_MAP_NAME(_map1)) \
113   MDRV_DEVICE_CONFIG_DATAPTR_ARRAY(cpu_config, address_map2, ADDRESS_SPACE_IO, ADDRESS_MAP_NAME(_map2))
114
115#define MDRV_CPU_VBLANK_INT(_tag, _func) \
116   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt, _func) \
117   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, vblank_interrupt_screen, _tag) \
118   MDRV_DEVICE_CONFIG_DATA32(cpu_config, vblank_interrupts_per_frame, 0)
119
120#define MDRV_CPU_PERIODIC_INT(_func, _rate)   \
121   MDRV_DEVICE_CONFIG_DATAPTR(cpu_config, timed_interrupt, _func) \
122   MDRV_DEVICE_CONFIG_DATA64(cpu_config, timed_interrupt_period, UINT64_ATTOTIME_IN_HZ(_rate))
123
124
125
126/***************************************************************************
72127    MACROS
73128***************************************************************************/
74129
75130#define INTERRUPT_GEN(func)      void func(const device_config *device)
76131
132/* return a pointer to the given CPU by tag */
133#define cputag_get_cpu(mach, tag)                              devtag_get_device(mach, CPU, tag)
134
77135/* helpers for using machine/cputag instead of cpu objects */
78136#define cputag_suspend(mach, tag, reason, eat)                     cpu_suspend(cputag_get_cpu(mach, tag), reason, eat)
79137#define cputag_resume(mach, tag, reason)                        cpu_resume(cputag_get_cpu(mach, tag), reason)
r3957r3958
96154
97155/* ----- core CPU execution ----- */
98156
99/* temporary function to allocate a fake CPU device for each CPU */
100const device_config *cpuexec_create_cpu_device(const cpu_config *config);
101
102157/* prepare CPUs for execution */
103158void cpuexec_init(running_machine *machine);
104159
r3957r3958
110165
111166
112167
168/* ----- CPU device interface ----- */
169
170/* device get info callback */
171#define CPU DEVICE_GET_INFO_NAME(cpu)
172DEVICE_GET_INFO( cpu );
173
174
175
113176/* ----- global helpers ----- */
114177
115/* return a pointer to the given CPU by tag */
116const device_config *cputag_get_cpu(running_machine *machine, const char *tag);
117
118178/* abort execution for the current timeslice */
119179void cpuexec_abort_timeslice(running_machine *machine);
120180
r3957r3958
227287void cpu_set_irq_callback(const device_config *cpu, cpu_irq_callback callback);
228288
229289
290
291/***************************************************************************
292    INLINE FUNCTIONS
293***************************************************************************/
294
295
296/*-------------------------------------------------
297    cpu_get_type - return the type of the
298    specified CPU
299-------------------------------------------------*/
300
301INLINE cpu_type cpu_get_type(const device_config *device)
302{
303   const cpu_config *config = device->inline_config;
304   return config->type;
305}
306
307
308
230309#endif   /* __CPUEXEC_H__ */
src/emu/sound/cdp1869.c
r3957r3958
4040 *
4141 *************************************/
4242
43static void cdp1869_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
43static STREAM_UPDATE( cdp1869_update )
4444{
4545   struct CDP1869 *info = param;
4646   INT16 signal = info->signal;
47   stream_sample_t *buffer = _buffer[0];
47   stream_sample_t *buffer = outputs[0];
4848
49   memset( buffer, 0, length * sizeof(*buffer) );
49   memset( buffer, 0, samples * sizeof(*buffer) );
5050
5151   if (!info->toneoff && info->toneamp)
5252   {
r3957r3958
6767         signal = info->toneamp * (0x07fff / 15);
6868      }
6969
70      while( length-- > 0 )
70      while( samples-- > 0 )
7171      {
7272         *buffer++ = signal;
7373         incr -= frequency;
r3957r3958
188188      /* --- the following bits of info are returned as 64-bit signed integers --- */
189189
190190      /* --- the following bits of info are returned as pointers to data or functions --- */
191      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdp1869 );      break;
192      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cdp1869 );         break;
193      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
194      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
191      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdp1869 );   break;
192      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cdp1869 );      break;
193      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
194      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
195195
196196      /* --- the following bits of info are returned as NULL-terminated strings --- */
197      case SNDINFO_STR_NAME:                     info->s = "CDP1869";               break;
198      case SNDINFO_STR_CORE_FAMILY:               info->s = "RCA CDP1869";            break;
199      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
200      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
201      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
197      case SNDINFO_STR_NAME:                     strcpy(info->s, "CDP1869");                  break;
198      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "RCA CDP1869");               break;
199      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
200      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
201      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
202202   }
203203}
src/emu/sound/sp0256.c
r3957r3958
5858   if( sp->sby_line != line_state )           \
5959   {                                          \
6060      sp->sby_line = line_state;             \
61      if( sp->sby ) sp->sby(sp->sby_line);   \
61      if( sp->sby ) sp->sby(sp->device, sp->sby_line);   \
6262   }                                          \
6363}
6464
r3957r3958
7777
7878struct sp0256
7979{
80   const device_config *device;
8081   sound_stream  *stream;           /* MAME core sound stream                       */
81   void         (*drq)(int state); /* Data request callback                        */
82   void         (*sby)(int state); /* Standby callback                             */
82   void         (*drq)(const device_config *device, int state); /* Data request callback                        */
83   void         (*sby)(const device_config *device, int state); /* Standby callback                             */
8384   int            sby_line;        /* Standby line state                           */
8485    INT16         *cur_buf;         /* Current sound buffer.                        */
8586    int            cur_len;         /* Fullness of current sound buffer.            */
r3957r3958
766767            sp->ald      = 0;
767768            for (i = 0; i < 16; i++)
768769                sp->filt.r[i] = 0;
769            if( sp->drq) sp->drq(ASSERT_LINE);
770            if( sp->drq) sp->drq(sp->device, ASSERT_LINE);
770771        }
771772
772773        /* ---------------------------------------------------------------- */
r3957r3958
10911092    }
10921093}
10931094
1094static void sp0256_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
1095static STREAM_UPDATE( sp0256_update )
10951096{
10961097   struct sp0256 *sp = param;
1097   stream_sample_t *output = buffer[0];
1098   stream_sample_t *output = outputs[0];
10981099   int output_index = 0;
1099    int samples, did_samp, old_idx;
1100   int length, did_samp, old_idx;
11001101
1101   while( output_index < length )
1102   while( output_index < samples )
11021103   {
11031104      /* ---------------------------------------------------------------- */
11041105      /*  First, drain as much of our scratch buffer as we can into the   */
r3957r3958
11101111         output[output_index++] = sp->scratch[sp->sc_tail++ & SCBUF_MASK];
11111112         sp->sc_tail &= SCBUF_MASK;
11121113
1113         if( output_index > length )
1114         if( output_index > samples )
11141115            break;
11151116      }
11161117
11171118      /* ---------------------------------------------------------------- */
1118      /*  If output buffer is full, then we're done.                      */
1119      /*  If output outputs is full, then we're done.                      */
11191120      /* ---------------------------------------------------------------- */
1120      if( output_index > length )
1121      if( output_index > samples )
11211122         break;
11221123
1123      samples = length - output_index;
1124      length = samples - output_index;
11241125
11251126      /* ---------------------------------------------------------------- */
11261127      /*  Process the current set of filter coefficients as long as the   */
r3957r3958
11281129      /* ---------------------------------------------------------------- */
11291130      did_samp = 0;
11301131      old_idx  = sp->sc_head;
1131      if (samples > 0) do
1132      if (length > 0) do
11321133      {
11331134         int do_samp;
11341135
r3957r3958
11411142         /* ------------------------------------------------------------ */
11421143         /*  Do as many samples as we can.                               */
11431144         /* ------------------------------------------------------------ */
1144         do_samp = samples - did_samp;
1145         do_samp = length - did_samp;
11451146         if (sp->sc_head + do_samp - sp->sc_tail > SCBUF_SIZE)
11461147            do_samp = sp->sc_tail + SCBUF_SIZE - sp->sc_head;
11471148
r3957r3958
11641165
11651166         sp->sc_head &= SCBUF_MASK;
11661167
1167      } while (sp->filt.rpt >= 0 && samples > did_samp);
1168      } while (sp->filt.rpt >= 0 && length > did_samp);
11681169   }
11691170}
11701171
r3957r3958
11751176
11761177   sp = auto_malloc(sizeof(*sp));
11771178   memset(sp, 0, sizeof(*sp));
1179   sp->device = device;
11781180   sp->drq = intf->lrq_callback;
11791181   sp->sby = intf->sby_callback;
1180   if( sp->drq ) sp->drq(ASSERT_LINE);
1181   if( sp->sby ) sp->sby(sp->sby_line = ASSERT_LINE);
1182   if( sp->drq ) sp->drq(device, ASSERT_LINE);
1183   if( sp->sby ) sp->sby(device, sp->sby_line = ASSERT_LINE);
11821184
11831185   sp->stream = stream_create(device, 0, 1, clock / CLOCK_DIVIDER, sp, sp0256_update);
11841186
r3957r3958
12361238   sp->mode     = 0;
12371239   sp->page     = 0x1000 << 3;
12381240   sp->silent   = 1;
1239   if( sp->drq ) sp->drq(ASSERT_LINE);
1241   if( sp->drq ) sp->drq(sp->device, ASSERT_LINE);
12401242   SET_SBY(ASSERT_LINE)
12411243}
12421244
r3957r3958
12651267   /* ---------------------------------------------------------------- */
12661268   sp->lrq = 0;
12671269   sp->ald = (0xFF & data) << 4;
1268   if( sp->drq ) sp->drq(CLEAR_LINE);
1270   if( sp->drq ) sp->drq(sp->device, CLEAR_LINE);
12691271   SET_SBY(CLEAR_LINE)
12701272
12711273   return;
r3957r3958
13621364      /* --- the following bits of info are returned as 64-bit signed integers --- */
13631365
13641366      /* --- the following bits of info are returned as pointers to data or functions --- */
1365      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0256 );      break;
1366      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sp0256 );            break;
1367      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( sp0256 );            break;
1368      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( sp0256 );             break;
1367      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0256 );   break;
1368      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sp0256 );         break;
1369      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( sp0256 );         break;
1370      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( sp0256 );         break;
13691371
13701372      /* --- the following bits of info are returned as NULL-terminated strings --- */
1371      case SNDINFO_STR_NAME:                     info->s = "SP0256";                  break;
1372      case SNDINFO_STR_CORE_FAMILY:               info->s = "GI";                     break;
1373      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
1374      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1375      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Joseph Zbiciak, tim lindner"; break;
1373      case SNDINFO_STR_NAME:                     strcpy(info->s, "SP0256");                  break;
1374      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "GI");                     break;
1375      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
1376      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
1377      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Joseph Zbiciak, tim lindner"); break;
13761378   }
13771379}
13781380
src/emu/sound/hc55516.c
r3957r3958
4848static double charge, decay, leak;
4949
5050
51static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length);
51static STREAM_UPDATE( hc55516_update );
5252
5353
5454
r3957r3958
182182}
183183
184184
185static void hc55516_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
185static STREAM_UPDATE( hc55516_update )
186186{
187187   struct hc55516_data *chip = param;
188   stream_sample_t *buffer = _buffer[0];
188   stream_sample_t *buffer = outputs[0];
189189   int i;
190190   INT32 sample, slope;
191191
192192   /* zero-length? bail */
193   if (length == 0)
193   if (samples == 0)
194194      return;
195195
196196   if (!is_external_osciallator(chip))
197197   {
198198      /* track how many samples we've updated without a clock */
199      chip->update_count += length;
199      chip->update_count += samples;
200200      if (chip->update_count > SAMPLE_RATE / 32)
201201      {
202202         chip->update_count = SAMPLE_RATE;
r3957r3958
206206
207207   /* compute the interpolation slope */
208208   sample = chip->curr_sample;
209   slope = ((INT32)chip->next_sample - sample) / length;
209   slope = ((INT32)chip->next_sample - sample) / samples;
210210   chip->curr_sample = chip->next_sample;
211211
212212   if (is_external_osciallator(chip))
213213   {
214214      /* external oscillator */
215      for (i = 0; i < length; i++, sample += slope)
215      for (i = 0; i < samples; i++, sample += slope)
216216      {
217217         UINT8 clock_state;
218218
r3957r3958
236236
237237   /* software driven clock */
238238   else
239      for (i = 0; i < length; i++, sample += slope)
239      for (i = 0; i < samples; i++, sample += slope)
240240         *buffer++ = sample;
241241}
242242
r3957r3958
339339   switch (state)
340340   {
341341      /* --- the following bits of info are returned as 64-bit signed integers --- */
342      case SNDINFO_INT_ALIAS:                     info->i = SOUND_HC55516;            break;
342      case SNDINFO_INT_ALIAS:                     info->i = SOUND_HC55516;               break;
343343
344344      /* --- the following bits of info are returned as pointers to data or functions --- */
345      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( hc55516 );         break;
346      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( hc55516 );         break;
345      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( hc55516 );   break;
346      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( hc55516 );   break;
347347
348348      /* --- the following bits of info are returned as NULL-terminated strings --- */
349      case SNDINFO_STR_NAME:                     info->s = "HC-55516";               break;
350      case SNDINFO_STR_CORE_FAMILY:               info->s = "CVSD";                  break;
351      case SNDINFO_STR_CORE_VERSION:               info->s = "2.1";                  break;
352      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
353      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
349      case SNDINFO_STR_NAME:                     strcpy(info->s, "HC-55516");            break;
350      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "CVSD");               break;
351      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "2.1");                  break;
352      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
353      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
354354   }
355355}
356356
r3957r3958
359359{
360360   switch (state)
361361   {
362      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( mc3417 );            break;
363      case SNDINFO_PTR_RESET:                     /* chip has no reset pin */            break;
364      case SNDINFO_STR_NAME:                     info->s = "MC3417";                  break;
365      default:                               SND_GET_INFO_CALL(hc55516);   break;
362      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( mc3417 );      break;
363      case SNDINFO_PTR_RESET:                     /* chip has no reset pin */               break;
364      case SNDINFO_STR_NAME:                     strcpy(info->s, "MC3417");               break;
365      default:                               SND_GET_INFO_CALL(hc55516);               break;
366366   }
367367}
368368
r3957r3958
371371{
372372   switch (state)
373373   {
374      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( mc3418 );            break;
375      case SNDINFO_PTR_RESET:                     /* chip has no reset pin */            break;
376      case SNDINFO_STR_NAME:                     info->s = "MC3418";                  break;
377      default:                               SND_GET_INFO_CALL(hc55516);   break;
374      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( mc3418 );      break;
375      case SNDINFO_PTR_RESET:                     /* chip has no reset pin */               break;
376      case SNDINFO_STR_NAME:                     strcpy(info->s, "MC3418");               break;
377      default:                               SND_GET_INFO_CALL(hc55516);               break;
378378   }
379379}
src/emu/sound/sp0256.h
r3957r3958
2525
2626typedef struct _sp0256_interface sp0256_interface;
2727struct _sp0256_interface {
28   void (*lrq_callback)(int state);
29   void (*sby_callback)(int state);
28   void (*lrq_callback)(const device_config *device, int state);
29   void (*sby_callback)(const device_config *device, int state);
3030};
3131
3232void sp0256_bitrevbuff(UINT8 *buffer, unsigned int start, unsigned int length);
src/emu/sound/iremga20.c
r3957r3958
5555   struct IremGA20_channel_def channel[4];
5656};
5757
58static void IremGA20_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
58static STREAM_UPDATE( IremGA20_update )
5959{
6060   struct IremGA20_chip_def *chip = param;
6161   UINT32 rate[4], pos[4], frac[4], end[4], vol[4], play[4];
r3957r3958
7474      play[i] = chip->channel[i].play;
7575   }
7676
77   i = length;
77   i = samples;
7878   pSamples = chip->rom;
79   outL = buffer[0];
80   outR = buffer[1];
79   outL = outputs[0];
80   outR = outputs[1];
8181
82   for (i = 0; i < length; i++)
82   for (i = 0; i < samples; i++)
8383   {
8484      sampleout = 0;
8585
r3957r3958
288288      /* --- the following bits of info are returned as 64-bit signed integers --- */
289289
290290      /* --- the following bits of info are returned as pointers to data or functions --- */
291      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( iremga20 );      break;
292      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( iremga20 );         break;
293      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
294      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( iremga20 );         break;
291      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( iremga20 );   break;
292      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( iremga20 );      break;
293      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
294      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( iremga20 );      break;
295295
296296      /* --- the following bits of info are returned as NULL-terminated strings --- */
297      case SNDINFO_STR_NAME:                     info->s = "Irem GA20";               break;
298      case SNDINFO_STR_CORE_FAMILY:               info->s = "Irem custom";            break;
299      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
300      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
301      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
297      case SNDINFO_STR_NAME:                     strcpy(info->s, "Irem GA20");               break;
298      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Irem custom");               break;
299      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
300      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
301      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
302302   }
303303}
304304
src/emu/sound/custom.c
r3957r3958
3434{
3535   struct custom_info *info = device->token;
3636   if (info->intf->stop)
37      (*info->intf->stop)(info->token);
37      (*info->intf->stop)(device, info->token);
3838}
3939
4040
r3957r3958
4242{
4343   struct custom_info *info = device->token;
4444   if (info->intf->reset)
45      (*info->intf->reset)(info->token);
45      (*info->intf->reset)(device, info->token);
4646}
4747
4848
r3957r3958
7474      /* --- the following bits of info are returned as 64-bit signed integers --- */
7575
7676      /* --- the following bits of info are returned as pointers to data or functions --- */
77      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( custom );      break;
78      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( custom );            break;
79      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( custom );            break;
80      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( custom );            break;
77      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( custom );   break;
78      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( custom );         break;
79      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( custom );         break;
80      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( custom );         break;
8181
8282      /* --- the following bits of info are returned as NULL-terminated strings --- */
83      case SNDINFO_STR_NAME:                     info->s = "Custom";                  break;
84      case SNDINFO_STR_CORE_FAMILY:               info->s = "None";                  break;
85      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
86      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
87      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
83      case SNDINFO_STR_NAME:                     strcpy(info->s, "Custom");                  break;
84      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "None");                  break;
85      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
86      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
87      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
8888   }
8989}
9090
src/emu/sound/tms5110.c
r3957r3958
111111   UINT8  addr_bit;
112112
113113   /* external callback */
114   int (*M0_callback)(void);
114   int (*M0_callback)(const device_config *);
115115   void (*set_load_address)(int);
116   const device_config *device;
116117
117118   /* these contain data describing the current and previous voice frames */
118119   UINT16 old_energy;
r3957r3958
183184   tms = malloc_or_die(sizeof(*tms));
184185   memset(tms, 0, sizeof(*tms));
185186
187   tms->device = device;
186188   tms5110_set_variant(tms, variant);
187189
188190   state_save_register_device_item_array(device, 0, tms->fifo);
r3957r3958
280282
281283******************************************************************************************/
282284
283void tms5110_set_M0_callback(void *chip, int (*func)(void))
285void tms5110_set_M0_callback(void *chip, int (*func)(const device_config *))
284286{
285287   struct tms5110 *tms = chip;
286288   tms->M0_callback = func;
r3957r3958
347349   {
348350      if (tms->M0_callback)
349351      {
350         int data = (*tms->M0_callback)();
352         int data = (*tms->M0_callback)(tms->device);
351353         FIFO_data_write(tms, data);
352354      }
353355      else
r3957r3958
361363   {
362364      if (tms->M0_callback)
363365      {
364         int data = (*tms->M0_callback)();
366         int data = (*tms->M0_callback)(tms->device);
365367            if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1);
366368      }
367369         else
src/emu/sound/2612intf.c
r3957r3958
7373/*    YM2612                                               */
7474/***********************************************************/
7575
76static void ym2612_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
76static STREAM_UPDATE( ym2612_stream_update )
7777{
7878   struct ym2612_info *info = param;
79   ym2612_update_one(info->chip, buffers, length);
79   ym2612_update_one(info->chip, outputs, samples);
8080}
8181
8282
r3957r3958
370370      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2612 );            break;
371371
372372      /* --- the following bits of info are returned as NULL-terminated strings --- */
373      case SNDINFO_STR_NAME:                     info->s = "YM2612";                  break;
374      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
375      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
376      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
377      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
373      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2612");                     break;
374      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
375      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
376      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
377      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
378378   }
379379}
380380
r3957r3958
406406      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2612 );            break;
407407
408408      /* --- the following bits of info are returned as NULL-terminated strings --- */
409      case SNDINFO_STR_NAME:                     info->s = "YM3438";                  break;
410      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
411      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
412      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
413      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
409      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM3438");                     break;
410      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
411      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
412      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
413      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
414414   }
415415}
416416
src/emu/sound/c352.c
r3957r3958
325325}
326326
327327
328static void c352_update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int sample_count)
328static STREAM_UPDATE( c352_update )
329329{
330330   struct c352_info *info = param;
331331   int i, j;
332   stream_sample_t *bufferl = buf[0];
333   stream_sample_t *bufferr = buf[1];
334   stream_sample_t *bufferl2 = buf[2];
335   stream_sample_t *bufferr2 = buf[3];
332   stream_sample_t *bufferl = outputs[0];
333   stream_sample_t *bufferr = outputs[1];
334   stream_sample_t *bufferl2 = outputs[2];
335   stream_sample_t *bufferr2 = outputs[3];
336336
337   for(i = 0 ; i < sample_count ; i++)
337   for(i = 0 ; i < samples ; i++)
338338   {
339339          info->channel_l[i] = info->channel_r[i] = info->channel_l2[i] = info->channel_r2[i] = 0;
340340   }
341341
342342   for (j = 0 ; j < 32 ; j++)
343343   {
344      c352_mix_one_channel(info, j, sample_count);
344      c352_mix_one_channel(info, j, samples);
345345   }
346346
347   for(i = 0 ; i < sample_count ; i++)
347   for(i = 0 ; i < samples ; i++)
348348   {
349349      *bufferl++ = (short) (info->channel_l[i] >>3);
350350      *bufferr++ = (short) (info->channel_r[i] >>3);
r3957r3958
593593      /* --- the following bits of info are returned as 64-bit signed integers --- */
594594
595595      /* --- the following bits of info are returned as pointers to data or functions --- */
596      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c352 );         break;
597      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c352 );            break;
598      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
599      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
596      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c352 );   break;
597      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c352 );      break;
598      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
599      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
600600
601601      /* --- the following bits of info are returned as NULL-terminated strings --- */
602      case SNDINFO_STR_NAME:                     info->s = "C352";                  break;
603      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco PCM";               break;
604      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
605      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
606      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
602      case SNDINFO_STR_NAME:                     strcpy(info->s, "C352");               break;
603      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco PCM");            break;
604      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                  break;
605      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
606      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
607607   }
608608}
609609
src/emu/sound/custom.h
r3957r3958
77struct _custom_sound_interface
88{
99   void *(*start)(const device_config *device, int clock, const custom_sound_interface *config);
10   void (*stop)(void *token);
11   void (*reset)(void *token);
10   void (*stop)(const device_config *device, void *token);
11   void (*reset)(const device_config *device, void *token);
1212   void *extra_data;
1313};
1414
1515void *custom_get_token(int index);
1616
1717#define CUSTOM_START(name) void *name(const device_config *device, int clock, const custom_sound_interface *config)
18#define CUSTOM_STOP(name) void name(void *token)
19#define CUSTOM_RESET(name) void name(void *token)
18#define CUSTOM_STOP(name) void name(const device_config *device, void *token)
19#define CUSTOM_RESET(name) void name(const device_config *device, void *token)
2020
2121#endif /* __CUSTOM_H__ */
src/emu/sound/tms5110.h
r3957r3958
3333void tms5110_set_variant(void *chip, int variant);
3434
3535void tms5110_reset_chip(void *chip);
36void tms5110_set_M0_callback(void *chip, int (*func)(void));
36void tms5110_set_M0_callback(void *chip, int (*func)(const device_config *));
3737void tms5110_set_load_address(void *chip, void (*func)(int));
3838
3939void tms5110_CTL_set(void *chip, int data);
src/emu/sound/k051649.c
r3957r3958
8181
8282
8383/* generate sound to the mix buffer */
84static void k051649_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
84static STREAM_UPDATE( k051649_update )
8585{
8686   struct k051649_info *info = param;
8787   k051649_sound_channel *voice=info->channel_list;
88   stream_sample_t *buffer = _buffer[0];
88   stream_sample_t *buffer = outputs[0];
8989   short *mix;
9090   int i,v,f,j,k;
9191
9292   /* zap the contents of the mixer buffer */
93   memset(info->mixer_buffer, 0, length * sizeof(short));
93   memset(info->mixer_buffer, 0, samples * sizeof(short));
9494
9595   for (j=0; j<5; j++) {
9696      v=voice[j].volume;
r3957r3958
105105         mix = info->mixer_buffer;
106106
107107         /* add our contribution */
108         for (i = 0; i < length; i++)
108         for (i = 0; i < samples; i++)
109109         {
110110            int offs;
111111
r3957r3958
123123
124124   /* mix it down */
125125   mix = info->mixer_buffer;
126   for (i = 0; i < length; i++)
126   for (i = 0; i < samples; i++)
127127      *buffer++ = info->mixer_lookup[*mix++];
128128}
129129
r3957r3958
239239      /* --- the following bits of info are returned as 64-bit signed integers --- */
240240
241241      /* --- the following bits of info are returned as pointers to data or functions --- */
242      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k051649 );      break;
243      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k051649 );         break;
244      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
245      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( k051649 );         break;
242      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k051649 );   break;
243      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k051649 );      break;
244      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
245      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( k051649 );      break;
246246
247247      /* --- the following bits of info are returned as NULL-terminated strings --- */
248      case SNDINFO_STR_NAME:                     info->s = "K051649";               break;
249      case SNDINFO_STR_CORE_FAMILY:               info->s = "Konami custom";            break;
250      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
251      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
252      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
248      case SNDINFO_STR_NAME:                     strcpy(info->s, "K051649");                  break;
249      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Konami custom");            break;
250      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
251      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
252      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
253253   }
254254}
255255
src/emu/sound/k054539.c
r3957r3958
119119      info->regs[0x22c] &= ~(1 << channel);
120120}
121121
122static void k054539_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
122static STREAM_UPDATE( k054539_update )
123123{
124124   struct k054539_info *info = param;
125125#define VOL_CAP 1.80
r3957r3958
131131
132132   int ch, reverb_pos;
133133   short *rbase;
134   unsigned char *samples;
134   unsigned char *rom;
135135   UINT32 rom_mask;
136136
137137   unsigned char *base1, *base2;
r3957r3958
146146   reverb_pos = info->reverb_pos;
147147   rbase = (short *)(info->ram);
148148
149   memset(buffer[0], 0, length*sizeof(*buffer[0]));
150   memset(buffer[1], 0, length*sizeof(*buffer[1]));
149   memset(outputs[0], 0, samples*sizeof(*outputs[0]));
150   memset(outputs[1], 0, samples*sizeof(*outputs[1]));
151151
152   samples = info->rom;
152   rom = info->rom;
153153   rom_mask = info->rom_mask;
154154
155155   if(!(info->regs[0x22f] & 1)) return;
156156
157   info->reverb_pos = (reverb_pos + length) & 0x3fff;
157   info->reverb_pos = (reverb_pos + samples) & 0x3fff;
158158
159159
160160   for(ch=0; ch<8; ch++)
r3957r3958
199199
200200         cur_pos = (base1[0x0c] | (base1[0x0d] << 8) | (base1[0x0e] << 16)) & rom_mask;
201201
202         bufl = buffer[0];
203         bufr = buffer[1];
202         bufl = outputs[0];
203         bufr = outputs[1];
204204//*
205205
206206         if(base2[0] & 0x20) {
r3957r3958
233233
234234         switch(base2[0] & 0xc) {
235235         case 0x0: { // 8bit pcm
236            for(i=0; i<length; i++) {
236            for(i=0; i<samples; i++) {
237237               cur_pfrac += delta;
238238               while(cur_pfrac & ~0xffff) {
239239                  cur_pfrac += fdelta;
240240                  cur_pos += pdelta;
241241
242242                  cur_pval = cur_val;
243                  cur_val = (INT16)(samples[cur_pos] << 8);
243                  cur_val = (INT16)(rom[cur_pos] << 8);
244244                  if(cur_val == (INT16)0x8000) {
245245                     if(base2[1] & 1) {
246246                        cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
247                        cur_val = (INT16)(samples[cur_pos] << 8);
247                        cur_val = (INT16)(rom[cur_pos] << 8);
248248                        if(cur_val != (INT16)0x8000)
249249                           continue;
250250                     }
r3957r3958
261261         case 0x4: { // 16bit pcm lsb first
262262            pdelta <<= 1;
263263
264            for(i=0; i<length; i++) {
264            for(i=0; i<samples; i++) {
265265               cur_pfrac += delta;
266266               while(cur_pfrac & ~0xffff) {
267267                  cur_pfrac += fdelta;
268268                  cur_pos += pdelta;
269269
270270                  cur_pval = cur_val;
271                  cur_val = (INT16)(samples[cur_pos] | samples[cur_pos+1]<<8);
271                  cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
272272                  if(cur_val == (INT16)0x8000) {
273273                     if(base2[1] & 1) {
274274                        cur_pos = (base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask;
275                        cur_val = (INT16)(samples[cur_pos] | samples[cur_pos+1]<<8);
275                        cur_val = (INT16)(rom[cur_pos] | rom[cur_pos+1]<<8);
276276                        if(cur_val != (INT16)0x8000)
277277                           continue;
278278                     }
r3957r3958
294294               cur_pos |= 1;
295295            }
296296
297            for(i=0; i<length; i++) {
297            for(i=0; i<samples; i++) {
298298               cur_pfrac += delta;
299299               while(cur_pfrac & ~0xffff) {
300300                  cur_pfrac += fdelta;
301301                  cur_pos += pdelta;
302302
303303                  cur_pval = cur_val;
304                  cur_val = samples[cur_pos>>1];
304                  cur_val = rom[cur_pos>>1];
305305                  if(cur_val == 0x88) {
306306                     if(base2[1] & 1) {
307307                        cur_pos = ((base1[0x08] | (base1[0x09] << 8) | (base1[0x0a] << 16)) & rom_mask) << 1;
308                        cur_val = samples[cur_pos>>1];
308                        cur_val = rom[cur_pos>>1];
309309                        if(cur_val != 0x88)
310310                           goto next_iter;
311311                     }
r3957r3958
351351   //* drivers should be given the option to disable reverb when things go terribly wrong
352352   if(!(info->k054539_flags & K054539_DISABLE_REVERB))
353353   {
354      for(i=0; i<length; i++) {
354      for(i=0; i<samples; i++) {
355355         short val = rbase[(i+reverb_pos) & 0x3fff];
356         buffer[0][i] += val;
357         buffer[1][i] += val;
356         outputs[0][i] += val;
357         outputs[1][i] += val;
358358      }
359359   }
360360
361   if(reverb_pos + length > 0x4000) {
361   if(reverb_pos + samples > 0x4000) {
362362      i = 0x4000 - reverb_pos;
363363      memset(rbase + reverb_pos, 0, i*2);
364      memset(rbase, 0, (length-i)*2);
364      memset(rbase, 0, (samples-i)*2);
365365   } else
366      memset(rbase + reverb_pos, 0, length*2);
366      memset(rbase + reverb_pos, 0, samples*2);
367367
368368   #if CHANNEL_DEBUG
369369   {
r3957r3958
715715      /* --- the following bits of info are returned as 64-bit signed integers --- */
716716
717717      /* --- the following bits of info are returned as pointers to data or functions --- */
718      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k054539 );      break;
719      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k054539 );         break;
720      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
721      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
718      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k054539 );   break;
719      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k054539 );      break;
720      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
721      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
722722
723723      /* --- the following bits of info are returned as NULL-terminated strings --- */
724      case SNDINFO_STR_NAME:                     info->s = "K054539";               break;
725      case SNDINFO_STR_CORE_FAMILY:               info->s = "Konami custom";            break;
726      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
727      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
728      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
724      case SNDINFO_STR_NAME:                     strcpy(info->s, "K054539");                  break;
725      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Konami custom");            break;
726      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
727      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
728      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
729729   }
730730}
731731
src/emu/sound/namco52.c
r3957r3958
7272static void namco_52xx_reset(struct namco_52xx *chip);
7373
7474
75static void namco_52xx_stream_update_one(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
75static STREAM_UPDATE( namco_52xx_stream_update_one )
7676{
7777   struct namco_52xx *chip = param;
7878   int i, rom_pos, whole_pb_cycles, buf;
79   stream_sample_t *buffer = _buffer[0];
79   stream_sample_t *buffer = outputs[0];
8080
8181   if (chip->n52_start >= chip->n52_end)
8282   {
83      memset(buffer, 0, length * sizeof(*buffer));
83      memset(buffer, 0, samples * sizeof(*buffer));
8484      return;
8585   }
8686
87   for (i = 0; i < length; i++)
87   for (i = 0; i < samples; i++)
8888   {
8989      chip->n52_pb_cycle += chip->n52_step;
9090      if (chip->n52_pb_cycle >= 1)
r3957r3958
9797      if (chip->n52_pos > chip->n52_length)
9898      {
9999         /* sample done */
100         memset(&buffer[i], 0, (length - i) * sizeof(INT16));
101         i = length;
100         memset(&buffer[i], 0, (samples - i) * sizeof(INT16));
101         i = samples;
102102         namco_52xx_reset(chip);
103103      }
104104      else
r3957r3958
217217      /* --- the following bits of info are returned as pointers to data or functions --- */
218218      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_52xx );   break;
219219      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco_52xx );         break;
220      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
220      case SNDINFO_PTR_STOP:                     /* Nothing */                              break;
221221      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( namco_52xx );         break;
222222
223223      /* --- the following bits of info are returned as NULL-terminated strings --- */
224      case SNDINFO_STR_NAME:                     info->s = "Namco 52XX";               break;
225      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco custom";            break;
226      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
227      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
228      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
224      case SNDINFO_STR_NAME:                     strcpy(info->s, "Namco 52XX");                  break;
225      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco custom");               break;
226      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
227      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
228      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
229229   }
230230}
231231
src/emu/sound/c140.c
r3957r3958
259259   return in;
260260}
261261
262static void update_stereo(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
262static STREAM_UPDATE( update_stereo )
263263{
264264   struct c140_info *info = param;
265265   int      i,j;
r3957r3958
277277
278278   INT16   *lmix, *rmix;
279279
280   if(length>info->sample_rate) length=info->sample_rate;
280   if(samples>info->sample_rate) samples=info->sample_rate;
281281
282282   /* zap the contents of the mixer buffer */
283   memset(info->mixer_buffer_left, 0, length * sizeof(INT16));
284   memset(info->mixer_buffer_right, 0, length * sizeof(INT16));
283   memset(info->mixer_buffer_left, 0, samples * sizeof(INT16));
284   memset(info->mixer_buffer_right, 0, samples * sizeof(INT16));
285285
286286   /* get the number of voices to update */
287287   voicecnt = (info->banking_type == C140_TYPE_ASIC219) ? 16 : 24;
r3957r3958
306306         lvol=(vreg->volume_left*32)/MAX_VOICE; //32ch -> 24ch
307307         rvol=(vreg->volume_right*32)/MAX_VOICE;
308308
309         /* Set mixer buffer base pointers */
309         /* Set mixer outputs base pointers */
310310         lmix = info->mixer_buffer_left;
311311         rmix = info->mixer_buffer_right;
312312
r3957r3958
330330         {
331331            //compressed PCM (maybe correct...)
332332            /* Loop for enough to fill sample buffer as requested */
333            for(j=0;j<length;j++)
333            for(j=0;j<samples;j++)
334334            {
335335               offset += delta;
336336               cnt = (offset>>16)&0x7fff;
r3957r3958
377377         else
378378         {
379379            /* linear 8bit signed PCM */
380            for(j=0;j<length;j++)
380            for(j=0;j<samples;j++)
381381            {
382382               offset += delta;
383383               cnt = (offset>>16)&0x7fff;
r3957r3958
444444   lmix = info->mixer_buffer_left;
445445   rmix = info->mixer_buffer_right;
446446   {
447      stream_sample_t *dest1 = buffer[0];
448      stream_sample_t *dest2 = buffer[1];
449      for (i = 0; i < length; i++)
447      stream_sample_t *dest1 = outputs[0];
448      stream_sample_t *dest2 = outputs[1];
449      for (i = 0; i < samples; i++)
450450      {
451451         *dest1++ = limit(8*(*lmix++));
452452         *dest2++ = limit(8*(*rmix++));
r3957r3958
516516      /* --- the following bits of info are returned as 64-bit signed integers --- */
517517
518518      /* --- the following bits of info are returned as pointers to data or functions --- */
519      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c140 );         break;
520      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c140 );            break;
521      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
522      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
519      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c140 );   break;
520      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c140 );      break;
521      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
522      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
523523
524524      /* --- the following bits of info are returned as NULL-terminated strings --- */
525      case SNDINFO_STR_NAME:                     info->s = "C140";                  break;
526      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco PCM";               break;
527      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
528      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
529      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
525      case SNDINFO_STR_NAME:                     strcpy(info->s, "C140");               break;
526      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco PCM");            break;
527      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
528      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
529      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
530530   }
531531}
532532
src/emu/sound/msm5205.c
r3957r3958
9090}
9191
9292/* stream update callbacks */
93static void MSM5205_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
93static STREAM_UPDATE( MSM5205_update )
9494{
9595   struct MSM5205Voice *voice = param;
96   stream_sample_t *buffer = _buffer[0];
96   stream_sample_t *buffer = outputs[0];
9797
9898   /* if this voice is active */
9999   if(voice->signal)
100100   {
101101      short val = voice->signal * 16;
102      while (length)
102      while (samples)
103103      {
104104         *buffer++ = val;
105         length--;
105         samples--;
106106      }
107107   }
108108   else
109      memset (buffer,0,length*sizeof(*buffer));
109      memset (buffer,0,samples*sizeof(*buffer));
110110}
111111
112112/* timer callback at VCLK low eddge */
r3957r3958
318318      /* --- the following bits of info are returned as 64-bit signed integers --- */
319319
320320      /* --- the following bits of info are returned as pointers to data or functions --- */
321      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5205 );      break;
322      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( msm5205 );break;
323      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
324      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( msm5205 );break;
321      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5205 );   break;
322      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( msm5205 );      break;
323      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
324      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( msm5205 );      break;
325325
326326      /* --- the following bits of info are returned as NULL-terminated strings --- */
327      case SNDINFO_STR_NAME:                     info->s = "MSM5205";               break;
328      case SNDINFO_STR_CORE_FAMILY:               info->s = "ADPCM";                  break;
329      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
330      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
331      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
327      case SNDINFO_STR_NAME:                     strcpy(info->s, "MSM5205");                  break;
328      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "ADPCM");                  break;
329      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
330      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
331      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
332332   }
333333}
334334
src/emu/sound/qsound.c
r3957r3958
8989};
9090
9191/* Function prototypes */
92static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length );
92static STREAM_UPDATE( qsound_update );
9393static void qsound_set_command(struct qsound_info *chip, int data, int value);
9494
9595static SND_START( qsound )
r3957r3958
304304}
305305
306306
307static void qsound_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
307static STREAM_UPDATE( qsound_update )
308308{
309309   struct qsound_info *chip = param;
310310   int i,j;
r3957r3958
312312   struct QSOUND_CHANNEL *pC=&chip->channel[0];
313313   stream_sample_t  *datap[2];
314314
315   datap[0] = buffer[0];
316   datap[1] = buffer[1];
317   memset( datap[0], 0x00, length * sizeof(*datap[0]) );
318   memset( datap[1], 0x00, length * sizeof(*datap[1]) );
315   datap[0] = outputs[0];
316   datap[1] = outputs[1];
317   memset( datap[0], 0x00, samples * sizeof(*datap[0]) );
318   memset( datap[1], 0x00, samples * sizeof(*datap[1]) );
319319
320320   for (i=0; i<QSOUND_CHANNELS; i++)
321321   {
r3957r3958
326326         rvol=(pC->rvol*pC->vol)>>8;
327327         lvol=(pC->lvol*pC->vol)>>8;
328328
329         for (j=length-1; j>=0; j--)
329         for (j=samples-1; j>=0; j--)
330330         {
331331            count=(pC->offset)>>16;
332332            pC->offset &= 0xffff;
r3957r3958
358358   }
359359
360360   if (chip->fpRawDataL)
361      fwrite(datap[0], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL);
361      fwrite(datap[0], samples*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataL);
362362   if (chip->fpRawDataR)
363      fwrite(datap[1], length*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR);
363      fwrite(datap[1], samples*sizeof(QSOUND_SAMPLE), 1, chip->fpRawDataR);
364364}
365365
366366
r3957r3958
385385      /* --- the following bits of info are returned as 64-bit signed integers --- */
386386
387387      /* --- the following bits of info are returned as pointers to data or functions --- */
388      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( qsound );      break;
389      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( qsound );            break;
390      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( qsound );            break;
391      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
388      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( qsound );   break;
389      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( qsound );         break;
390      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( qsound );         break;
391      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
392392
393393      /* --- the following bits of info are returned as NULL-terminated strings --- */
394      case SNDINFO_STR_NAME:                     info->s = "Q-Sound";               break;
395      case SNDINFO_STR_CORE_FAMILY:               info->s = "Capcom custom";            break;
396      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
397      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
398      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
394      case SNDINFO_STR_NAME:                     strcpy(info->s, "Q-Sound");                  break;
395      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Capcom custom");            break;
396      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
397      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
398      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
399399   }
400400}
401401
src/emu/sound/3812intf.c
r3957r3958
6666}
6767
6868
69static void ym3812_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
69static STREAM_UPDATE( ym3812_stream_update )
7070{
7171   struct ym3812_info *info = param;
72   ym3812_update_one(info->chip, buffer[0], length);
72   ym3812_update_one(info->chip, outputs[0], samples);
7373}
7474
7575static void _stream_update_3812(void * param, int interval)
r3957r3958
182182      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym3812 );            break;
183183
184184      /* --- the following bits of info are returned as NULL-terminated strings --- */
185      case SNDINFO_STR_NAME:                     info->s = "YM3812";                  break;
186      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
187      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
188      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
189      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
185      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM3812");                     break;
186      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
187      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
188      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
189      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
190190   }
191191}
192192
r3957r3958
237237}
238238
239239
240static void ym3526_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
240static STREAM_UPDATE( ym3526_stream_update )
241241{
242242   struct ym3526_info *info = param;
243   ym3526_update_one(info->chip, buffer[0], length);
243   ym3526_update_one(info->chip, outputs[0], samples);
244244}
245245
246246static void _stream_update_3526(void *param, int interval)
r3957r3958
352352      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym3526 );            break;
353353
354354      /* --- the following bits of info are returned as NULL-terminated strings --- */
355      case SNDINFO_STR_NAME:                     info->s = "YM3526";                  break;
356      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
357      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
358      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
359      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
355      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM3526");                     break;
356      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
357      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
358      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
359      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
360360   }
361361}
362362
r3957r3958
442442      info->intf->keyboardwrite(space,info->index,data);
443443}
444444
445static void y8950_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
445static STREAM_UPDATE( y8950_stream_update )
446446{
447447   struct y8950_info *info = param;
448   y8950_update_one(info->chip, buffer[0], length);
448   y8950_update_one(info->chip, outputs[0], samples);
449449}
450450
451451static void _stream_update_8950(void *param, int interval)
r3957r3958
566566      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( y8950 );            break;
567567
568568      /* --- the following bits of info are returned as NULL-terminated strings --- */
569      case SNDINFO_STR_NAME:                     info->s = "Y8950";                  break;
570      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
571      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
572      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
573      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
569      case SNDINFO_STR_NAME:                     strcpy(info->s, "Y8950");                     break;
570      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
571      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
572      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
573      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
574574   }
575575}
576576
src/emu/sound/snkwave.c
r3957r3958
5353
5454
5555/* generate sound to the mix buffer */
56static void snkwave_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
56static STREAM_UPDATE( snkwave_update )
5757{
5858   struct snkwave_sound *chip = param;
59   stream_sample_t *buffer = _buffer[0];
59   stream_sample_t *buffer = outputs[0];
6060
6161   /* zap the contents of the buffer */
62   memset(buffer, 0, length * sizeof(*buffer));
62   memset(buffer, 0, samples * sizeof(*buffer));
6363
6464   assert(chip->counter < 0x1000);
6565   assert(chip->frequency < 0x1000);
r3957r3958
6969      return;
7070
7171   /* generate sound into buffer while updating the counter */
72   while (length-- > 0)
72   while (samples-- > 0)
7373   {
7474      int loops;
7575      INT16 out = 0;
r3957r3958
179179      /* --- the following bits of info are returned as 64-bit signed integers --- */
180180
181181      /* --- the following bits of info are returned as pointers to data or functions --- */
182      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( snkwave );      break;
183      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( snkwave );         break;
184      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
185      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
182      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( snkwave );   break;
183      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( snkwave );      break;
184      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
185      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
186186
187187      /* --- the following bits of info are returned as NULL-terminated strings --- */
188      case SNDINFO_STR_NAME:                     info->s = "SNK Wave";               break;
189      case SNDINFO_STR_CORE_FAMILY:               info->s = "SNK Wave";               break;
190      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
191      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
192      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
188      case SNDINFO_STR_NAME:                     strcpy(info->s, "SNK Wave");               break;
189      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "SNK Wave");               break;
190      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
191      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
192      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
193193   }
194194}
src/emu/sound/rf5c400.c
r3957r3958
102102   return val;
103103}
104104
105static void rf5c400_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
105static STREAM_UPDATE( rf5c400_update )
106106{
107107   int i, ch;
108108   struct rf5c400_info *info = param;
r3957r3958
113113   UINT8 env_phase;
114114   double env_level, env_step, env_rstep;
115115
116   memset(buffer[0], 0, length * sizeof(*buffer[0]));
117   memset(buffer[1], 0, length * sizeof(*buffer[1]));
116   memset(outputs[0], 0, samples * sizeof(*outputs[0]));
117   memset(outputs[1], 0, samples * sizeof(*outputs[1]));
118118
119119   for (ch=0; ch < 32; ch++)
120120   {
121121      struct RF5C400_CHANNEL *channel = &info->channels[ch];
122      stream_sample_t *buf0 = buffer[0];
123      stream_sample_t *buf1 = buffer[1];
122      stream_sample_t *buf0 = outputs[0];
123      stream_sample_t *buf1 = outputs[1];
124124
125125      start = ((channel->startH & 0xFF00) << 8) | channel->startL;
126126      end = ((channel->endHloopH & 0xFF) << 16) | channel->endL;
r3957r3958
136136      env_step = channel->env_step;
137137      env_rstep = env_step * channel->env_scale;
138138
139      for (i=0; i < length; i++)
139      for (i=0; i < samples; i++)
140140      {
141141         INT16 tmp;
142142         INT32 sample;
r3957r3958
582582      /* --- the following bits of info are returned as 64-bit signed integers --- */
583583
584584      /* --- the following bits of info are returned as pointers to data or functions --- */
585      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c400 );      break;
586      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( rf5c400 );         break;
587      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
588      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
585      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c400 );   break;
586      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( rf5c400 );      break;
587      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
588      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
589589
590590      /* --- the following bits of info are returned as NULL-terminated strings --- */
591      case SNDINFO_STR_NAME:                     info->s = "RF5C400";               break;
592      case SNDINFO_STR_CORE_FAMILY:               info->s = "Ricoh PCM";               break;
593      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
594      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
595      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team & hoot development team"; break;
591      case SNDINFO_STR_NAME:                     strcpy(info->s, "RF5C400");                  break;
592      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Ricoh PCM");               break;
593      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                     break;
594      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
595      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team & hoot development team"); break;
596596   }
597597}
src/emu/sound/saa1099.c
r3957r3958
212212}
213213
214214
215static void saa1099_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
215static STREAM_UPDATE( saa1099_update )
216216{
217217   struct SAA1099 *saa = param;
218218    int j, ch;
r3957r3958
221221   if (!saa->all_ch_enable)
222222   {
223223      /* init output data */
224      memset(buffer[LEFT],0,length*sizeof(*buffer[LEFT]));
225      memset(buffer[RIGHT],0,length*sizeof(*buffer[RIGHT]));
224      memset(outputs[LEFT],0,samples*sizeof(*outputs[LEFT]));
225      memset(outputs[RIGHT],0,samples*sizeof(*outputs[RIGHT]));
226226        return;
227227   }
228228
r3957r3958
238238   }
239239
240240    /* fill all data needed */
241   for( j = 0; j < length; j++ )
241   for( j = 0; j < samples; j++ )
242242   {
243243      int output_l = 0, output_r = 0;
244244
r3957r3958
305305         }
306306      }
307307        /* write sound data to the buffer */
308      buffer[LEFT][j] = output_l / 6;
309      buffer[RIGHT][j] = output_r / 6;
308      outputs[LEFT][j] = output_l / 6;
309      outputs[RIGHT][j] = output_r / 6;
310310   }
311311}
312312
r3957r3958
506506      /* --- the following bits of info are returned as 64-bit signed integers --- */
507507
508508      /* --- the following bits of info are returned as pointers to data or functions --- */
509      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( saa1099 );      break;
510      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( saa1099 );         break;
511      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
512      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
509      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( saa1099 );   break;
510      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( saa1099 );      break;
511      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
512      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
513513
514514      /* --- the following bits of info are returned as NULL-terminated strings --- */
515      case SNDINFO_STR_NAME:                     info->s = "SAA1099";               break;
516      case SNDINFO_STR_CORE_FAMILY:               info->s = "Philips";               break;
517      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
518      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
519      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
515      case SNDINFO_STR_NAME:                     strcpy(info->s, "SAA1099");                  break;
516      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Philips");                  break;
517      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
518      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
519      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
520520   }
521521}
522522
src/emu/sound/cem3394.c
r3957r3958
139139
140140
141141/* generate sound to the mix buffer in mono */
142static void cem3394_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
142static STREAM_UPDATE( cem3394_update )
143143{
144144   sound_chip *chip = param;
145145   int int_volume = (chip->volume * chip->mixer_internal) / 256;
146146   int ext_volume = (chip->volume * chip->mixer_external) / 256;
147147   UINT32 step = chip->step, position, end_position = 0;
148   stream_sample_t *buffer = _buffer[0];
148   stream_sample_t *buffer = outputs[0];
149149   INT16 *mix, *ext;
150150   int i;
151151
r3957r3958
160160   /* bail if nothing's going on */
161161   if (int_volume == 0 && ext_volume == 0)
162162   {
163      memset(buffer, 0, sizeof(*buffer) * length);
163      memset(buffer, 0, sizeof(*buffer) * samples);
164164      return;
165165   }
166166
r3957r3958
171171      INT16 last_ext = chip->last_ext;
172172
173173      /* fetch the external data */
174      (*chip->external)(chip->index, length, chip->external_buffer);
174      (*chip->external)(chip->index, samples, chip->external_buffer);
175175
176176      /* compute the modulation depth, and adjust fstep to the maximum frequency */
177177      /* we lop off 13 bits of depth so that we can multiply by stepadjust, below, */
r3957r3958
182182
183183      /* "apply" the filter: note this is pretty cheesy; it basically just downsamples the
184184           external sample to filter_freq by allowing only 2 transitions for every cycle */
185      for (i = 0, ext = chip->external_buffer, position = chip->position; i < length; i++, ext++)
185      for (i = 0, ext = chip->external_buffer, position = chip->position; i < samples; i++, ext++)
186186      {
187187         UINT32 newposition;
188188         INT32 stepadjust;
r3957r3958
224224         /* if the width is wider than the step, we're guaranteed to hit it once per cycle */
225225         if (pulse_width >= step)
226226         {
227            for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
227            for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
228228            {
229229               if (position < pulse_width)
230230                  *mix = 0x1932;
r3957r3958
238238         else
239239         {
240240            INT16 volume = 0x1932 * pulse_width / step;
241            for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
241            for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
242242            {
243243               UINT32 newposition = position + step;
244244               if ((newposition ^ position) & ~FRACTION_MASK)
r3957r3958
253253
254254      /* otherwise, clear the mixing buffer */
255255      else
256         memset(chip->mixer_buffer, 0, sizeof(INT16) * length);
256         memset(chip->mixer_buffer, 0, sizeof(INT16) * samples);
257257
258258      /* handle the sawtooth component; it maxes out at 0x2000, which is 27% larger */
259259      /* than the pulse */
260260      if (ENABLE_SAWTOOTH && (chip->wave_select & WAVE_SAWTOOTH))
261261      {
262         for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
262         for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
263263         {
264264            *mix += ((position >> (FRACTION_BITS - 14)) & 0x3fff) - 0x2000;
265265            position += step;
r3957r3958
272272      /* a multiplication) */
273273      if (ENABLE_TRIANGLE && (chip->wave_select & WAVE_TRIANGLE))
274274      {
275         for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < length; i++, mix++)
275         for (i = 0, mix = chip->mixer_buffer, position = chip->position; i < samples; i++, mix++)
276276         {
277277            INT16 value;
278278            if (position & (1 << (FRACTION_BITS - 1)))
r3957r3958
296296      /* internal + external */
297297      if (ext_volume != 0 && int_volume != 0)
298298      {
299         for (i = 0; i < length; i++, mix++, ext++)
299         for (i = 0; i < samples; i++, mix++, ext++)
300300            *buffer++ = (*mix * int_volume + *ext * ext_volume) / 128;
301301      }
302302      /* internal only */
303303      else if (int_volume != 0)
304304      {
305         for (i = 0; i < length; i++, mix++)
305         for (i = 0; i < samples; i++, mix++)
306306            *buffer++ = *mix * int_volume / 128;
307307      }
308308      /* external only */
309309      else
310310      {
311         for (i = 0; i < length; i++, ext++)
311         for (i = 0; i < samples; i++, ext++)
312312            *buffer++ = *ext * ext_volume / 128;
313313      }
314314   }
r3957r3958
577577      /* --- the following bits of info are returned as 64-bit signed integers --- */
578578
579579      /* --- the following bits of info are returned as pointers to data or functions --- */
580      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cem3394 );      break;
581      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cem3394 );         break;
582      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
583      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
580      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cem3394 );   break;
581      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cem3394 );      break;
582      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
583      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
584584
585585      /* --- the following bits of info are returned as NULL-terminated strings --- */
586      case SNDINFO_STR_NAME:                     info->s = "CEM3394";               break;
587      case SNDINFO_STR_CORE_FAMILY:               info->s = "Analog Synth";            break;
588      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
589      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
590      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
586      case SNDINFO_STR_NAME:                     strcpy(info->s, "CEM3394");                  break;
587      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Analog Synth");            break;
588      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
589      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
590      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
591591   }
592592}
593593
src/emu/sound/ymz280b.c
r3957r3958
488488
489489***********************************************************************************************/
490490
491static void ymz280b_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
491static STREAM_UPDATE( ymz280b_update )
492492{
493493   struct YMZ280BChip *chip = param;
494   stream_sample_t *lacc = buffer[0];
495   stream_sample_t *racc = buffer[1];
494   stream_sample_t *lacc = outputs[0];
495   stream_sample_t *racc = outputs[1];
496496   int v;
497497
498498   /* clear out the accumulator */
499   memset(lacc, 0, length * sizeof(lacc[0]));
500   memset(racc, 0, length * sizeof(racc[0]));
499   memset(lacc, 0, samples * sizeof(lacc[0]));
500   memset(racc, 0, samples * sizeof(racc[0]));
501501
502502   /* loop over voices */
503503   for (v = 0; v < 8; v++)
r3957r3958
510510      INT32 *rdest = racc;
511511      UINT32 new_samples, samples_left;
512512      UINT32 final_pos;
513      int remaining = length;
513      int remaining = samples;
514514      int lvol = voice->output_left;
515515      int rvol = voice->output_right;
516516
r3957r3958
612612      voice->curr_sample = curr;
613613   }
614614
615   for (v = 0; v < length; v++)
615   for (v = 0; v < samples; v++)
616616   {
617      buffer[0][v] /= 256;
618      buffer[1][v] /= 256;
617      outputs[0][v] /= 256;
618      outputs[1][v] /= 256;
619619   }
620620}
621621
r3957r3958
11181118      /* --- the following bits of info are returned as 64-bit signed integers --- */
11191119
11201120      /* --- the following bits of info are returned as pointers to data or functions --- */
1121      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymz280b );      break;
1122      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymz280b );         break;
1123      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
1124      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
1121      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymz280b );   break;
1122      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymz280b );      break;
1123      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
1124      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
11251125
11261126      /* --- the following bits of info are returned as NULL-terminated strings --- */
1127      case SNDINFO_STR_NAME:                     info->s = "YMZ280B";               break;
1128      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha Wavetable";         break;
1129      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
1130      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1131      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1127      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMZ280B");                  break;
1128      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha Wavetable");         break;
1129      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
1130      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
1131      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
11321132   }
11331133}
11341134
src/emu/sound/rf5c68.c
r3957r3958
3939/*    RF5C68 stream update                      */
4040/************************************************/
4141
42static void rf5c68_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
42static STREAM_UPDATE( rf5c68_update )
4343{
4444   struct rf5c68pcm *chip = param;
45   stream_sample_t *left = buffer[0];
46   stream_sample_t *right = buffer[1];
45   stream_sample_t *left = outputs[0];
46   stream_sample_t *right = outputs[1];
4747   int i, j;
4848
4949   /* start with clean buffers */
50   memset(left, 0, length * sizeof(*left));
51   memset(right, 0, length * sizeof(*right));
50   memset(left, 0, samples * sizeof(*left));
51   memset(right, 0, samples * sizeof(*right));
5252
5353   /* bail if not enabled */
5454   if (!chip->enable)
r3957r3958
6666         int rv = ((chan->pan >> 4) & 0x0f) * chan->env;
6767
6868         /* loop over the sample buffer */
69         for (j = 0; j < length; j++)
69         for (j = 0; j < samples; j++)
7070         {
7171            int sample;
7272
r3957r3958
100100   }
101101
102102   /* now clamp and shift the result (output is only 10 bits) */
103   for (j = 0; j < length; j++)
103   for (j = 0; j < samples; j++)
104104   {
105105      stream_sample_t temp;
106106
r3957r3958
126126   /* allocate memory for the chip */
127127   struct rf5c68pcm *chip = auto_malloc(sizeof(*chip));
128128   memset(chip, 0, sizeof(*chip));
129   memset(chip->data, 0xff, sizeof(chip->data));
130129
131130   /* allocate the stream */
132131   chip->stream = stream_create(device, 0, 2, clock / 384, chip, rf5c68_update);
r3957r3958
243242      /* --- the following bits of info are returned as 64-bit signed integers --- */
244243
245244      /* --- the following bits of info are returned as pointers to data or functions --- */
246      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c68 );      break;
247      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( rf5c68 );            break;
248      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
249      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
245      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( rf5c68 );   break;
246      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( rf5c68 );         break;
247      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
248      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
250249
251250      /* --- the following bits of info are returned as NULL-terminated strings --- */
252      case SNDINFO_STR_NAME:                     info->s = "RF5C68";                  break;
253      case SNDINFO_STR_CORE_FAMILY:               info->s = "Ricoh PCM";               break;
254      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
255      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
256      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
251      case SNDINFO_STR_NAME:                     strcpy(info->s, "RF5C68");                  break;
252      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Ricoh PCM");               break;
253      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
254      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
255      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
257256   }
258257}
259258
src/emu/sound/k005289.c
r3957r3958
8787
8888
8989/* generate sound to the mix buffer */
90static void K005289_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
90static STREAM_UPDATE( K005289_update )
9191{
9292   struct k005289_info *info = param;
9393   k005289_sound_channel *voice=info->channel_list;
94   stream_sample_t *buffer = _buffer[0];
94   stream_sample_t *buffer = outputs[0];
9595   short *mix;
9696   int i,v,f;
9797
9898   /* zap the contents of the mixer buffer */
99   memset(info->mixer_buffer, 0, length * sizeof(INT16));
99   memset(info->mixer_buffer, 0, samples * sizeof(INT16));
100100
101101   v=voice[0].volume;
102102   f=voice[0].frequency;
r3957r3958
108108      mix = info->mixer_buffer;
109109
110110      /* add our contribution */
111      for (i = 0; i < length; i++)
111      for (i = 0; i < samples; i++)
112112      {
113113         int offs;
114114
r3957r3958
131131      mix = info->mixer_buffer;
132132
133133      /* add our contribution */
134      for (i = 0; i < length; i++)
134      for (i = 0; i < samples; i++)
135135      {
136136         int offs;
137137
r3957r3958
146146
147147   /* mix it down */
148148   mix = info->mixer_buffer;
149   for (i = 0; i < length; i++)
149   for (i = 0; i < samples; i++)
150150      *buffer++ = info->mixer_lookup[*mix++];
151151}
152152
r3957r3958
268268      /* --- the following bits of info are returned as 64-bit signed integers --- */
269269
270270      /* --- the following bits of info are returned as pointers to data or functions --- */
271      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k005289 );      break;
272      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k005289 );         break;
273      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
274      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
271      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k005289 );   break;
272      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k005289 );      break;
273      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
274      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
275275
276276      /* --- the following bits of info are returned as NULL-terminated strings --- */
277      case SNDINFO_STR_NAME:                     info->s = "K005289";               break;
278      case SNDINFO_STR_CORE_FAMILY:               info->s = "Konami custom";            break;
279      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
280      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
281      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
277      case SNDINFO_STR_NAME:                     strcpy(info->s, "K005289");                  break;
278      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Konami custom");            break;
279      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
280      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
281      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
282282   }
283283}
284284
src/emu/sound/votrax.c
r3957r3958
5858 0
5959};
6060
61static void votrax_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
61static STREAM_UPDATE( votrax_update_sound )
6262{
6363   struct votrax_info *info = param;
64   stream_sample_t *buffer = _buffer[0];
64   stream_sample_t *buffer = outputs[0];
6565
6666   if (info->sample)
6767   {
r3957r3958
175175      /* --- the following bits of info are returned as 64-bit signed integers --- */
176176
177177      /* --- the following bits of info are returned as pointers to data or functions --- */
178      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( votrax );      break;
179      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( votrax );            break;
180      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
181      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
178      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( votrax );   break;
179      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( votrax );         break;
180      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
181      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
182182
183183      /* --- the following bits of info are returned as NULL-terminated strings --- */
184      case SNDINFO_STR_NAME:                     info->s = "Votrax SC-01";            break;
185      case SNDINFO_STR_CORE_FAMILY:               info->s = "Votrax speech";            break;
186      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
187      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
188      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
184      case SNDINFO_STR_NAME:                     strcpy(info->s, "Votrax SC-01");            break;
185      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Votrax speech");            break;
186      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
187      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
188      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
189189   }
190190}
191191
src/emu/sound/aica.c
r3957r3958
12761276}
12771277#endif
12781278
1279static void AICA_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
1279static STREAM_UPDATE( AICA_Update )
12801280{
12811281   struct _AICA *AICA = param;
1282   bufferl = buf[0];
1283   bufferr = buf[1];
1282   bufferl = outputs[0];
1283   bufferr = outputs[1];
12841284   length = samples;
12851285   AICA_DoMasterSamples(AICA, samples);
12861286}
r3957r3958
13841384      /* --- the following bits of info are returned as 64-bit signed integers --- */
13851385
13861386      /* --- the following bits of info are returned as pointers to data or functions --- */
1387      case SNDINFO_PTR_SET_INFO:               info->set_info = SND_SET_INFO_NAME( aica );         break;
1388      case SNDINFO_PTR_START:                  info->start = SND_START_NAME( aica );         break;
1389      case SNDINFO_PTR_STOP:                  /* Nothing */               break;
1390      case SNDINFO_PTR_RESET:                  /* Nothing */               break;
1387      case SNDINFO_PTR_SET_INFO:               info->set_info = SND_SET_INFO_NAME( aica );   break;
1388      case SNDINFO_PTR_START:                  info->start = SND_START_NAME( aica );      break;
1389      case SNDINFO_PTR_STOP:                  /* Nothing */                        break;
1390      case SNDINFO_PTR_RESET:                  /* Nothing */                        break;
13911391
13921392      /* --- the following bits of info are returned as NULL-terminated strings --- */
1393      case SNDINFO_STR_NAME:                  info->s = "AICA";            break;
1394      case SNDINFO_STR_CORE_FAMILY:               info->s = "Sega/Yamaha custom";          break;
1395      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0.1";             break;
1396      case SNDINFO_STR_CORE_FILE:               info->s = __FILE__;            break;
1397      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1393      case SNDINFO_STR_NAME:                  strcpy(info->s, "AICA");               break;
1394      case SNDINFO_STR_CORE_FAMILY:            strcpy(info->s, "Sega/Yamaha custom");      break;
1395      case SNDINFO_STR_CORE_VERSION:            strcpy(info->s, "1.0.1");                break;
1396      case SNDINFO_STR_CORE_FILE:               strcpy(info->s, __FILE__);               break;
1397      case SNDINFO_STR_CORE_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
13981398   }
13991399}
14001400
src/emu/sound/sn76496.c
r3957r3958
134134WRITE8_HANDLER( sn76496_4_w ) {   SN76496Write(4,data); }
135135
136136
137static void SN76496Update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
137static STREAM_UPDATE( SN76496Update )
138138{
139139   int i;
140140   struct SN76496 *R = param;
141   stream_sample_t *buffer = _buffer[0];
141   stream_sample_t *buffer = outputs[0];
142142
143143
144144   /* If the volume is 0, increase the counter */
r3957r3958
146146   {
147147      if (R->Volume[i] == 0)
148148      {
149         /* note that I do count += length, NOT count = length + 1. You might think */
149         /* note that I do count += samples, NOT count = samples + 1. You might think */
150150         /* it's the same since the volume is 0, but doing the latter could cause */
151151         /* interferencies when the program is rapidly modulating the volume. */
152         if (R->Count[i] <= length*STEP) R->Count[i] += length*STEP;
152         if (R->Count[i] <= samples*STEP) R->Count[i] += samples*STEP;
153153      }
154154   }
155155
156   while (length > 0)
156   while (samples > 0)
157157   {
158158      int vol[4];
159159      unsigned int out;
r3957r3958
245245
246246      *(buffer++) = out / STEP;
247247
248      length--;
248      samples--;
249249   }
250250}
251251
r3957r3958
392392   switch (state)
393393   {
394394      /* --- the following bits of info are returned as 64-bit signed integers --- */
395      case SNDINFO_INT_ALIAS:                     info->i = SOUND_SN76496;            break;
395      case SNDINFO_INT_ALIAS:                     info->i = SOUND_SN76496;                  break;
396396
397397      /* --- the following bits of info are returned as pointers to data or functions --- */
398      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sn76496 );      break;
399      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76496 );         break;
400      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
401      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
398      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sn76496 );   break;
399      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76496 );      break;
400      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
401      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
402402
403403      /* --- the following bits of info are returned as NULL-terminated strings --- */
404      case SNDINFO_STR_NAME:                     info->s = "SN76496";               break;
405      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI PSG";                  break;
406      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
407      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
408      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
404      case SNDINFO_STR_NAME:                     strcpy(info->s, "SN76496");                  break;
405      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "TI PSG");                  break;
406      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                     break;
407      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
408      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
409409   }
410410}
411411
r3957r3958
413413{
414414   switch (state)
415415   {
416      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76489 );         break;
417      case SNDINFO_STR_NAME:                     info->s = "SN76489";               break;
418      default:                               SND_GET_INFO_CALL(sn76496);   break;
416      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76489 );      break;
417      case SNDINFO_STR_NAME:                     strcpy(info->s, "SN76489");                  break;
418      default:                               SND_GET_INFO_CALL(sn76496);                  break;
419419   }
420420}
421421
r3957r3958
423423{
424424   switch (state)
425425   {
426      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76489a );         break;
427      case SNDINFO_STR_NAME:                     info->s = "SN76489A";               break;
428      default:                               SND_GET_INFO_CALL(sn76496);   break;
426      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76489a );      break;
427      case SNDINFO_STR_NAME:                     strcpy(info->s, "SN76489A");               break;
428      default:                               SND_GET_INFO_CALL(sn76496);                  break;
429429   }
430430}
431431
r3957r3958
433433{
434434   switch (state)
435435   {
436      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76494 );         break;
437      case SNDINFO_STR_NAME:                     info->s = "SN76494";               break;
438      default:                               SND_GET_INFO_CALL(sn76496);   break;
436      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sn76494 );      break;
437      case SNDINFO_STR_NAME:                     strcpy(info->s, "SN76494");                  break;
438      default:                               SND_GET_INFO_CALL(sn76496);                  break;
439439   }
440440}
441441
r3957r3958
443443{
444444   switch (state)
445445   {
446      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( gamegear );         break;
447      case SNDINFO_STR_NAME:                     info->s = "Game Gear PSG";            break;
448      default:                               SND_GET_INFO_CALL(sn76496);   break;
446      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( gamegear );      break;
447      case SNDINFO_STR_NAME:                     strcpy(info->s, "Game Gear PSG");            break;
448      default:                               SND_GET_INFO_CALL(sn76496);                  break;
449449   }
450450}
451451
r3957r3958
453453{
454454   switch (state)
455455   {
456      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( smsiii );            break;
457      case SNDINFO_STR_NAME:                     info->s = "SMSIII PSG";               break;
458      default:                               SND_GET_INFO_CALL(sn76496);   break;
456      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( smsiii );         break;
457      case SNDINFO_STR_NAME:                     strcpy(info->s, "SMSIII PSG");               break;
458      default:                               SND_GET_INFO_CALL(sn76496);                  break;
459459   }
460460}
src/emu/sound/wave.c
r3957r3958
2222
2323
2424
25static void wave_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
25static STREAM_UPDATE( wave_sound_update )
2626{
2727#ifdef MESS
2828   const device_config *image = param;
r3957r3958
3030   cassette_state state;
3131   double time_index;
3232   double duration;
33   stream_sample_t *buffer = _buffer[0];
33   stream_sample_t *buffer = outputs[0];
3434   int i;
3535
3636   state = cassette_get_state(image);
r3957r3958
4040   {
4141      cassette = cassette_get_image(image);
4242      time_index = cassette_get_position(image);
43      duration = ((double) length) / image->machine->sample_rate;
43      duration = ((double) samples) / image->machine->sample_rate;
4444
45      cassette_get_samples(cassette, 0, time_index, duration, length, 2, buffer, CASSETTE_WAVEFORM_16BIT);
45      cassette_get_samples(cassette, 0, time_index, duration, samples, 2, buffer, CASSETTE_WAVEFORM_16BIT);
4646
47      for (i = length-1; i >= 0; i--)
47      for (i = samples-1; i >= 0; i--)
4848         buffer[i] = ((INT16 *) buffer)[i];
4949   }
5050   else
5151   {
52      memset(buffer, 0, sizeof(*buffer) * length);
52      memset(buffer, 0, sizeof(*buffer) * samples);
5353   }
5454#endif
5555}
r3957r3958
8989      /* --- the following bits of info are returned as 64-bit signed integers --- */
9090
9191      /* --- the following bits of info are returned as pointers to data or functions --- */
92      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( wave );         break;
93      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( wave );            break;
94      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
95      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
92      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( wave );   break;
93      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( wave );      break;
94      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
95      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
9696
9797      /* --- the following bits of info are returned as NULL-terminated strings --- */
98      case SNDINFO_STR_NAME:                     info->s = "Cassette";               break;
99      case SNDINFO_STR_CORE_FAMILY:               info->s = "Cassette";               break;
100      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
101      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
102      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright The MESS Team"; break;
98      case SNDINFO_STR_NAME:                     strcpy(info->s, "Cassette");            break;
99      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Cassette");            break;
100      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
101      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
102      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright The MESS Team"); break;
103103   }
104104}
src/emu/sound/astrocde.c
r3957r3958
7676 *
7777 *************************************/
7878
79static void astrocade_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int samples)
79static STREAM_UPDATE( astrocade_update )
8080{
8181   struct astrocade_info *chip = param;
82   stream_sample_t *dest = buffer[0];
82   stream_sample_t *dest = outputs[0];
8383   UINT16 noise_state;
8484   UINT8 master_count;
8585   UINT8 noise_clock;
r3957r3958
342342      /* --- the following bits of info are returned as pointers to data or functions --- */
343343      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( astrocade );   break;
344344      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( astrocade );         break;
345      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
345      case SNDINFO_PTR_STOP:                     /* nothing */                              break;
346346      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( astrocade );         break;
347347
348348      /* --- the following bits of info are returned as NULL-terminated strings --- */
349      case SNDINFO_STR_NAME:                     info->s = "Astrocade";               break;
350      case SNDINFO_STR_CORE_FAMILY:               info->s = "Bally";                  break;
351      case SNDINFO_STR_CORE_VERSION:               info->s = "2.0";                  break;
352      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
353      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
349      case SNDINFO_STR_NAME:                     strcpy(info->s, "Astrocade");                  break;
350      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Bally");                     break;
351      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "2.0");                        break;
352      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
353      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
354354   }
355355}
src/emu/sound/x1_010.c
r3957r3958
102102/*--------------------------------------------------------------
103103 generate sound to the mix buffer
104104--------------------------------------------------------------*/
105static void seta_update( void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
105static STREAM_UPDATE( seta_update )
106106{
107107   struct x1_010_info *info = param;
108108   X1_010_CHANNEL   *reg;
r3957r3958
113113   const UINT8 *snd1 = info->region;
114114
115115   // mixer buffer zero clear
116   memset( buffer[0], 0, length*sizeof(*buffer[0]) );
117   memset( buffer[1], 0, length*sizeof(*buffer[1]) );
116   memset( outputs[0], 0, samples*sizeof(*outputs[0]) );
117   memset( outputs[1], 0, samples*sizeof(*outputs[1]) );
118118
119119//  if( info->sound_enable == 0 ) return;
120120
121121   for( ch = 0; ch < SETA_NUM_CHANNELS; ch++ ) {
122122      reg = (X1_010_CHANNEL *)&(info->reg[ch*sizeof(X1_010_CHANNEL)]);
123123      if( (reg->status&1) != 0 ) {                     // Key On
124         stream_sample_t *bufL = buffer[0];
125         stream_sample_t *bufR = buffer[1];
124         stream_sample_t *bufL = outputs[0];
125         stream_sample_t *bufR = outputs[1];
126126         if( (reg->status&2) == 0 ) {                  // PCM sampling
127127            start    = (INT8 *)(reg->start      *0x1000+snd1);
128128            end      = (INT8 *)((0x100-reg->end)*0x1000+snd1);
r3957r3958
138138               LOG_SOUND(( "Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n",
139139                  start, end, ch, volL, volR, freq, smp_step, smp_offs ));
140140            }
141            for( i = 0; i < length; i++ ) {
141            for( i = 0; i < samples; i++ ) {
142142               delta = smp_offs>>FREQ_BASE_BITS;
143143               // sample ended?
144144               if( start+delta >= end ) {
r3957r3958
165165               LOG_SOUND(( "Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n",
166166                  reg->volume, ch, reg->end, freq, smp_step, smp_offs ));
167167            }
168            for( i = 0; i < length; i++ ) {
168            for( i = 0; i < samples; i++ ) {
169169               int vol;
170170               delta = env_offs>>ENV_BASE_BITS;
171171                // Envelope one shot mode
r3957r3958
304304      /* --- the following bits of info are returned as 64-bit signed integers --- */
305305
306306      /* --- the following bits of info are returned as pointers to data or functions --- */
307      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( x1_010 );      break;
308      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( x1_010 );            break;
309      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
310      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
307      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( x1_010 );   break;
308      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( x1_010 );         break;
309      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
310      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
311311
312312      /* --- the following bits of info are returned as NULL-terminated strings --- */
313      case SNDINFO_STR_NAME:                     info->s = "X1-010";                  break;
314      case SNDINFO_STR_CORE_FAMILY:               info->s = "Seta custom";            break;
315      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
316      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
317      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
313      case SNDINFO_STR_NAME:                     strcpy(info->s, "X1-010");                  break;
314      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Seta custom");               break;
315      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
316      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
317      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
318318   }
319319}
320320
src/emu/sound/upd7759.c
r3957r3958
148148
149149struct upd7759_chip
150150{
151   const device_config *device;
151152   sound_stream *channel;               /* stream channel for playback */
152153
153154   /* internal clock to output sample rate mapping */
r3957r3958
161162   UINT8      reset;                  /* current state of the RESET line */
162163   UINT8      start;                  /* current state of the START line */
163164   UINT8      drq;                  /* current state of the DRQ line */
164   void (*drqcallback)(int param);         /* drq callback */
165   void (*drqcallback)(const device_config *device, int param);         /* drq callback */
165166
166167   /* internal state machine */
167168   INT8      state;                  /* current overall chip state */
r3957r3958
459460
460461*************************************************************/
461462
462static void upd7759_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int samples)
463static STREAM_UPDATE( upd7759_update )
463464{
464465   struct upd7759_chip *chip = param;
465466   INT32 clocks_left = chip->clocks_left;
466467   INT16 sample = chip->sample;
467468   UINT32 step = chip->step;
468469   UINT32 pos = chip->pos;
469   stream_sample_t *buffer = _buffer[0];
470   stream_sample_t *buffer = outputs[0];
470471
471472   /* loop until done */
472473   if (chip->state != STATE_IDLE)
r3957r3958
536537   /* if the DRQ changed, update it */
537538   logerror("slave_update: DRQ %d->%d\n", olddrq, chip->drq);
538539   if (olddrq != chip->drq && chip->drqcallback)
539      (*chip->drqcallback)(chip->drq);
540      (*chip->drqcallback)(chip->device, chip->drq);
540541
541542   /* set a timer to go off when that is done */
542543   if (chip->state != STATE_IDLE)
r3957r3958
634635   chip = auto_malloc(sizeof(*chip));
635636   memset(chip, 0, sizeof(*chip));
636637
638   chip->device = device;
639
637640   /* allocate a stream channel */
638641   chip->channel = stream_create(device, 0, 1, clock/4, chip, upd7759_update);
639642
r3957r3958
791794      /* --- the following bits of info are returned as 64-bit signed integers --- */
792795
793796      /* --- the following bits of info are returned as pointers to data or functions --- */
794      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( upd7759 );      break;
795      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( upd7759 );         break;
796      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
797      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( upd7759 );                     break;
797      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( upd7759 );   break;
798      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( upd7759 );      break;
799      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
800      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( upd7759 );      break;
798801
799802      /* --- the following bits of info are returned as NULL-terminated strings --- */
800      case SNDINFO_STR_NAME:                     info->s = "UPD7759";               break;
801      case SNDINFO_STR_CORE_FAMILY:               info->s = "NEC ADPCM";               break;
802      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
803      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
804      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
803      case SNDINFO_STR_NAME:                     strcpy(info->s, "UPD7759");                  break;
804      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "NEC ADPCM");               break;
805      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
806      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
807      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
805808   }
806809}
807810
src/emu/sound/ymf271.c
r3957r3958
675675   return slot_output;
676676}
677677
678static void ymf271_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
678static STREAM_UPDATE( ymf271_update )
679679{
680680   int i, j;
681681   int op;
682682   INT32 *mixp;
683683   YMF271Chip *chip = param;
684684
685   memset(mix, 0, sizeof(mix[0])*length*2);
685   memset(mix, 0, sizeof(mix[0])*samples*2);
686686
687687   for (j = 0; j < 12; j++)
688688   {
r3957r3958
707707
708708            if (chip->slots[slot1].active)
709709            {
710               for (i = 0; i < length; i++)
710               for (i = 0; i < samples; i++)
711711               {
712712                  INT64 output1 = 0, output2 = 0, output3 = 0, output4 = 0, phase_mod1 = 0, phase_mod2 = 0;
713713                  switch (chip->slots[slot1].algorithm)
r3957r3958
893893               mixp = &mix[0];
894894               if (chip->slots[slot1].active)
895895               {
896                  for (i = 0; i < length; i++)
896                  for (i = 0; i < samples; i++)
897897                  {
898898                     INT64 output1 = 0, output2 = 0, phase_mod = 0;
899899                     switch (chip->slots[slot1].algorithm & 3)
r3957r3958
946946
947947            if (chip->slots[slot1].active)
948948            {
949               for (i = 0; i < length; i++)
949               for (i = 0; i < samples; i++)
950950               {
951951                  INT64 output1 = 0, output2 = 0, output3 = 0, phase_mod = 0;
952952                  switch (chip->slots[slot1].algorithm & 7)
r3957r3958
10281028               }
10291029            }
10301030
1031            update_pcm(chip, j + (3*12), mixp, length);
1031            update_pcm(chip, j + (3*12), mixp, samples);
10321032            break;
10331033         }
10341034
10351035         case 3:      // PCM
10361036         {
1037            update_pcm(chip, j + (0*12), mixp, length);
1038            update_pcm(chip, j + (1*12), mixp, length);
1039            update_pcm(chip, j + (2*12), mixp, length);
1040            update_pcm(chip, j + (3*12), mixp, length);
1037            update_pcm(chip, j + (0*12), mixp, samples);
1038            update_pcm(chip, j + (1*12), mixp, samples);
1039            update_pcm(chip, j + (2*12), mixp, samples);
1040            update_pcm(chip, j + (3*12), mixp, samples);
10411041            break;
10421042         }
10431043
r3957r3958
10461046   }
10471047
10481048   mixp = &mix[0];
1049   for (i = 0; i < length; i++)
1049   for (i = 0; i < samples; i++)
10501050   {
10511051      outputs[0][i] = (*mixp++)>>2;
10521052      outputs[1][i] = (*mixp++)>>2;
r3957r3958
18291829      /* --- the following bits of info are returned as 64-bit signed integers --- */
18301830
18311831      /* --- the following bits of info are returned as pointers to data or functions --- */
1832      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf271 );      break;
1833      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymf271 );            break;
1834      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
1835      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ymf271 );            break;
1832      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf271 );   break;
1833      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymf271 );         break;
1834      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
1835      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ymf271 );         break;
18361836
18371837      /* --- the following bits of info are returned as NULL-terminated strings --- */
1838      case SNDINFO_STR_NAME:                     info->s = "YMF271";                  break;
1839      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
1840      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
1841      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1842      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1838      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMF271");                  break;
1839      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");               break;
1840      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
1841      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
1842      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
18431843   }
18441844}
src/emu/sound/n63701x.c
r3957r3958
4545static const int vol_table[4] = { 26, 84, 200, 258 };
4646
4747
48static void namco_63701x_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
48static STREAM_UPDATE( namco_63701x_update )
4949{
5050   struct namco_63701x *chip = param;
5151   int ch;
5252
5353   for (ch = 0;ch < 2;ch++)
5454   {
55      stream_sample_t *buf = buffer[ch];
55      stream_sample_t *buf = outputs[ch];
5656      voice *v = &chip->voices[ch];
5757
5858      if (v->playing)
r3957r3958
6262         int vol = vol_table[v->volume];
6363         int p;
6464
65         for (p = 0;p < length;p++)
65         for (p = 0;p < samples;p++)
6666         {
6767            if (v->silence_counter)
6868            {
r3957r3958
9494         v->position = pos;
9595      }
9696      else
97         memset(buf, 0, length * sizeof(*buf));
97         memset(buf, 0, samples * sizeof(*buf));
9898   }
9999}
100100
r3957r3958
177177      /* --- the following bits of info are returned as pointers to data or functions --- */
178178      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_63701x );   break;
179179      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco_63701x );      break;
180      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
181      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
180      case SNDINFO_PTR_STOP:                     /* Nothing */                              break;
181      case SNDINFO_PTR_RESET:                     /* Nothing */                              break;
182182
183183      /* --- the following bits of info are returned as NULL-terminated strings --- */
184      case SNDINFO_STR_NAME:                     info->s = "Namco 63701X";            break;
185      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco custom";            break;
186      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
187      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
188      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
184      case SNDINFO_STR_NAME:                     strcpy(info->s, "Namco 63701X");               break;
185      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco custom");               break;
186      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
187      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
188      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
189189   }
190190}
191191
src/emu/sound/pokey.c
r3957r3958
336336   chip->samplepos_whole++;                                 \
337337   /* store sum of output signals into the buffer */               \
338338   *buffer++ = (sum > 0x7fff) ? 0x7fff : sum;                     \
339   length--
339   samples--
340340
341341#if HEAVY_MACRO_USAGE
342342
r3957r3958
357357      sum += chip->volume[CHAN3];                              \
358358   if( chip->output[CHAN4] )                                  \
359359      sum += chip->volume[CHAN4];                              \
360    while( length > 0 )                                                 \
360    while( samples > 0 )                                                 \
361361   {                                                   \
362362      if( chip->counter[CHAN1] < chip->samplepos_whole )            \
363363      {                                                \
r3957r3958
486486      sum += chip->volume[CHAN3];                              \
487487   if( chip->output[CHAN4] )                                  \
488488        sum += chip->volume[CHAN4];                                     \
489   while( length > 0 )                                                 \
489   while( samples > 0 )                                                 \
490490   {                                                   \
491491      UINT32 event = chip->samplepos_whole;                      \
492492      UINT32 channel = SAMPLE;                              \
r3957r3958
524524#endif
525525
526526
527static void pokey_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
527static STREAM_UPDATE( pokey_update )
528528{
529529   struct POKEYregisters *chip = param;
530   stream_sample_t *buffer = _buffer[0];
530   stream_sample_t *buffer = outputs[0];
531531   PROCESS_POKEY(chip);
532532}
533533
r3957r3958
15291529      /* --- the following bits of info are returned as 64-bit signed integers --- */
15301530
15311531      /* --- the following bits of info are returned as pointers to data or functions --- */
1532      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( pokey );      break;
1533      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( pokey );            break;
1534      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
1535      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
1532      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( pokey );   break;
1533      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( pokey );         break;
1534      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
1535      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
15361536
15371537      /* --- the following bits of info are returned as NULL-terminated strings --- */
1538      case SNDINFO_STR_NAME:                     info->s = "POKEY";                  break;
1539      case SNDINFO_STR_CORE_FAMILY:               info->s = "Atari custom";            break;
1540      case SNDINFO_STR_CORE_VERSION:               info->s = "4.51";                  break;
1541      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1542      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1538      case SNDINFO_STR_NAME:                     strcpy(info->s, "POKEY");                  break;
1539      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Atari custom");            break;
1540      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "4.51");                  break;
1541      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
1542      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
15431543   }
15441544}
15451545
src/emu/sound/sp0250.c
r3957r3958
123123   stream_update(sp->stream);
124124}
125125
126static void sp0250_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
126static STREAM_UPDATE( sp0250_update )
127127{
128128   struct sp0250 *sp = param;
129   stream_sample_t *output = buffer[0];
129   stream_sample_t *output = outputs[0];
130130   int i;
131   for (i = 0; i < length; i++)
131   for (i = 0; i < samples; i++)
132132   {
133133      if (sp->playing)
134134      {
r3957r3958
241241      /* --- the following bits of info are returned as 64-bit signed integers --- */
242242
243243      /* --- the following bits of info are returned as pointers to data or functions --- */
244      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0250 );      break;
245      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sp0250 );            break;
246      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
247      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
244      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sp0250 );   break;
245      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sp0250 );         break;
246      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
247      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
248248
249249      /* --- the following bits of info are returned as NULL-terminated strings --- */
250      case SNDINFO_STR_NAME:                     info->s = "SP0250";                  break;
251      case SNDINFO_STR_CORE_FAMILY:               info->s = "GI speech";               break;
252      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
253      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
254      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
250      case SNDINFO_STR_NAME:                     strcpy(info->s, "SP0250");                  break;
251      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "GI speech");               break;
252      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                     break;
253      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
254      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
255255   }
256256}
257257
src/emu/sound/upd7759.h
r3957r3958
1313typedef struct _upd7759_interface upd7759_interface;
1414struct _upd7759_interface
1515{
16   void (*drqcallback)(int param);   /* drq callback (per chip, slave mode only) */
16   void (*drqcallback)(const device_config *device, int param);   /* drq callback (per chip, slave mode only) */
1717};
1818
1919void upd7759_set_bank_base(int which, offs_t base);
src/emu/sound/speaker.c
r3957r3958
2323
2424
2525
26static void speaker_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
26static STREAM_UPDATE( speaker_sound_update )
2727{
2828   struct speaker *sp = (struct speaker *) param;
29   stream_sample_t *buffer = _buffer[0];
29   stream_sample_t *buffer = outputs[0];
3030   int volume = sp->levels[sp->level];
3131
32    while( length-- > 0 )
32    while( samples-- > 0 )
3333      *buffer++ = volume;
3434}
3535
r3957r3958
8989      /* --- the following bits of info are returned as 64-bit signed integers --- */
9090
9191      /* --- the following bits of info are returned as pointers to data or functions --- */
92      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( speaker );      break;
93      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( speaker );         break;
94      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
95      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
92      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( speaker );   break;
93      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( speaker );      break;
94      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
95      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
9696
9797      /* --- the following bits of info are returned as NULL-terminated strings --- */
98      case SNDINFO_STR_NAME:                     info->s = "Speaker";               break;
99      case SNDINFO_STR_CORE_FAMILY:               info->s = "Speaker";               break;
100      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
101      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
102      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright The MESS Team"; break;
98      case SNDINFO_STR_NAME:                     strcpy(info->s, "Speaker");                  break;
99      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Speaker");                  break;
100      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
101      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
102      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright The MESS Team");    break;
103103   }
104104}
src/emu/sound/ay8910.c
r3957r3958
473473   }
474474}
475475
476static void ay8910_update(void *param,stream_sample_t **inputs, stream_sample_t **buffer,int length)
476static STREAM_UPDATE( ay8910_update )
477477{
478478   ay8910_context *psg = param;
479479   stream_sample_t *buf[NUM_CHANNELS];
480480   int chan;
481481
482   buf[0] = buffer[0];
482   buf[0] = outputs[0];
483483   buf[1] = NULL;
484484   buf[2] = NULL;
485485   if (psg->streams == NUM_CHANNELS)
486486   {
487      buf[1] = buffer[1];
488      buf[2] = buffer[2];
487      buf[1] = outputs[1];
488      buf[2] = outputs[2];
489489   }
490490
491491   /* hack to prevent us from hanging when starting filtered outputs */
r3957r3958
493493   {
494494      for (chan = 0; chan < NUM_CHANNELS; chan++)
495495         if (buf[chan] != NULL)
496            memset(buf[chan], 0, length * sizeof(*buf[chan]));
496            memset(buf[chan], 0, samples * sizeof(*buf[chan]));
497497   }
498498
499499   /* The 8910 has three outputs, each output is the mix of one of the three */
r3957r3958
504504   /* is 1, not 0, and can be modulated changing the volume. */
505505
506506   /* buffering loop */
507   while (length)
507   while (samples)
508508   {
509509      for (chan = 0; chan < NUM_CHANNELS; chan++)
510510      {
r3957r3958
601601                      + vol_enabled[2] * psg->vol_table[psg->Vol[2]]) / psg->step;
602602#endif
603603      }
604      length--;
604      samples--;
605605   }
606606}
607607
r3957r3958
867867   switch (state)
868868   {
869869      /* --- the following bits of info are returned as 64-bit signed integers --- */
870      case SNDINFO_INT_ALIAS:                     info->i = SOUND_AY8910;               break;
870      case SNDINFO_INT_ALIAS:                     info->i = SOUND_AY8910;                     break;
871871
872872      /* --- the following bits of info are returned as pointers to data or functions --- */
873      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ay8910 );      break;
874      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );            break;
875      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( ay8910 );            break;
873      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ay8910 );   break;
874      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );         break;
875      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( ay8910 );         break;
876876      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ay8910 );         break;
877877
878878      /* --- the following bits of info are returned as NULL-terminated strings --- */
879      case SNDINFO_STR_NAME:                     info->s = "AY-3-8910A";               break;
880      case SNDINFO_STR_CORE_FAMILY:               info->s = "PSG";                  break;
881      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
882      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
883      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
879      case SNDINFO_STR_NAME:                     strcpy(info->s, "AY-3-8910A");               break;
880      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "PSG");                     break;
881      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
882      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
883      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
884884   }
885885}
886886
r3957r3958
888888{
889889   switch (state)
890890   {
891      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );            break;
892      case SNDINFO_STR_NAME:                     info->s = "AY-3-8912A";               break;
893      default:                               SND_GET_INFO_CALL(ay8910);   break;
891      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );         break;
892      case SNDINFO_STR_NAME:                     strcpy(info->s, "AY-3-8912A");               break;
893      default:                               SND_GET_INFO_CALL(ay8910);                  break;
894894   }
895895}
896896
r3957r3958
898898{
899899   switch (state)
900900   {
901      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );            break;
902      case SNDINFO_STR_NAME:                     info->s = "AY-3-8913A";               break;
903      default:                               SND_GET_INFO_CALL(ay8910);   break;
901      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );         break;
902      case SNDINFO_STR_NAME:                     strcpy(info->s, "AY-3-8913A");               break;
903      default:                               SND_GET_INFO_CALL(ay8910);                  break;
904904   }
905905}
906906
r3957r3958
908908{
909909   switch (state)
910910   {
911      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );            break;
912      case SNDINFO_STR_NAME:                     info->s = "AY8930";                  break;
913      default:                               SND_GET_INFO_CALL(ay8910);   break;
911      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ay8910 );         break;
912      case SNDINFO_STR_NAME:                     strcpy(info->s, "AY8930");                  break;
913      default:                               SND_GET_INFO_CALL(ay8910);                  break;
914914   }
915915}
916916
r3957r3958
918918{
919919   switch (state)
920920   {
921      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );            break;
922      case SNDINFO_STR_NAME:                     info->s = "YM2149";                  break;
923      default:                               SND_GET_INFO_CALL(ay8910);   break;
921      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );         break;
922      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2149");                  break;
923      default:                               SND_GET_INFO_CALL(ay8910);                  break;
924924   }
925925}
926926
r3957r3958
928928{
929929   switch (state)
930930   {
931      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );            break;
932      case SNDINFO_STR_NAME:                     info->s = "YM3439";                  break;
933      default:                               SND_GET_INFO_CALL(ay8910);   break;
931      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );         break;
932      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM3439");                  break;
933      default:                               SND_GET_INFO_CALL(ay8910);                  break;
934934   }
935935}
936936
r3957r3958
938938{
939939   switch (state)
940940   {
941      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );            break;
942      case SNDINFO_STR_NAME:                     info->s = "YMZ284";                  break;
943      default:                               SND_GET_INFO_CALL(ay8910);   break;
941      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );         break;
942      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMZ284");                  break;
943      default:                               SND_GET_INFO_CALL(ay8910);                  break;
944944   }
945945}
946946
r3957r3958
948948{
949949   switch (state)
950950   {
951      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );            break;
952      case SNDINFO_STR_NAME:                     info->s = "YMZ294";                  break;
953      default:                               SND_GET_INFO_CALL(ay8910);   break;
951      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ym2149 );         break;
952      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMZ294");                  break;
953      default:                               SND_GET_INFO_CALL(ay8910);                  break;
954954   }
955955}
956956
src/emu/sound/cdda.c
r3957r3958
3232    cdda_update - stream update callback
3333-------------------------------------------------*/
3434
35static void cdda_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
35static STREAM_UPDATE( cdda_update )
3636{
3737   cdda_info *info = param;
38   get_audio_data(info, &outputs[0][0], &outputs[1][0], length);
38   get_audio_data(info, &outputs[0][0], &outputs[1][0], samples);
3939}
4040
4141
r3957r3958
316316      /* --- the following bits of info are returned as 64-bit signed integers --- */
317317
318318      /* --- the following bits of info are returned as pointers to data or functions --- */
319      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdda );         break;
320      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cdda );            break;
321      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
322      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
319      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( cdda );   break;
320      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cdda );      break;
321      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
322      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
323323
324324      /* --- the following bits of info are returned as NULL-terminated strings --- */
325      case SNDINFO_STR_NAME:                     info->s = "CD/DA";                  break;
326      case SNDINFO_STR_CORE_FAMILY:               info->s = "CD Audio";               break;
327      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
328      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
329      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
325      case SNDINFO_STR_NAME:                     strcpy(info->s, "CD/DA");               break;
326      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "CD Audio");            break;
327      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
328      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
329      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
330330   }
331331}
332332
src/emu/sound/tms36xx.c
r3957r3958
341341
342342
343343
344static void tms36xx_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
344static STREAM_UPDATE( tms36xx_sound_update )
345345{
346346   struct TMS36XX *tms = param;
347347   int samplerate = tms->samplerate;
348   stream_sample_t *buffer = _buffer[0];
348   stream_sample_t *buffer = outputs[0];
349349
350350    /* no tune played? */
351351   if( !tunes[tms->tune_num] || tms->voices == 0 )
352352   {
353      while (--length >= 0)
354         buffer[length] = 0;
353      while (--samples >= 0)
354         buffer[samples] = 0;
355355      return;
356356   }
357357
358   while( length-- > 0 )
358   while( samples-- > 0 )
359359   {
360360      int sum = 0;
361361
r3957r3958
544544      /* --- the following bits of info are returned as 64-bit signed integers --- */
545545
546546      /* --- the following bits of info are returned as pointers to data or functions --- */
547      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms36xx );      break;
548      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms36xx );         break;
549      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
550      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
547      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms36xx );   break;
548      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms36xx );      break;
549      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
550      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
551551
552552      /* --- the following bits of info are returned as NULL-terminated strings --- */
553      case SNDINFO_STR_NAME:                     info->s = "TMS36XX";               break;
554      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI PSG";                  break;
555      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
556      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
557      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
553      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS36XX");                  break;
554      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "TI PSG");                  break;
555      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
556      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
557      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
558558   }
559559}
560560
src/emu/sound/st0016.c
r3957r3958
4848   }
4949}
5050
51static void st0016_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
51static STREAM_UPDATE( st0016_update )
5252{
5353   struct st0016_info *info = param;
5454   UINT8 *sound_ram = *info->sound_ram;
r3957r3958
5959   INT16 sample;
6060   int sptr, eptr, freq, lsptr, leptr;
6161
62   memset(mix, 0, sizeof(mix[0])*length*2);
62   memset(mix, 0, sizeof(mix[0])*samples*2);
6363
6464   for (v = 0; v < 8; v++)
6565   {
r3957r3958
7575         lsptr = slot[0x06]<<16 | slot[0x05]<<8 | slot[0x04];
7676         leptr = slot[0x0a]<<16 | slot[0x09]<<8 | slot[0x08];
7777
78         for (snum = 0; snum < length; snum++)
78         for (snum = 0; snum < samples; snum++)
7979         {
8080            sample = sound_ram[(sptr + info->vpos[v])&0x1fffff]<<8;
8181
r3957r3958
117117   }
118118
119119   mixp = &mix[0];
120   for (i = 0; i < length; i++)
120   for (i = 0; i < samples; i++)
121121   {
122122      outputs[0][i] = (*mixp++)>>4;
123123      outputs[1][i] = (*mixp++)>>4;
r3957r3958
161161      /* --- the following bits of info are returned as 64-bit signed integers --- */
162162
163163      /* --- the following bits of info are returned as pointers to data or functions --- */
164      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( st0016 );      break;
165      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( st0016 );            break;
166      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
167      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
164      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( st0016 );   break;
165      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( st0016 );         break;
166      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
167      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
168168
169169      /* --- the following bits of info are returned as NULL-terminated strings --- */
170      case SNDINFO_STR_NAME:                     info->s = "ST0016";                  break;
171      case SNDINFO_STR_CORE_FAMILY:               info->s = "Seta custom";            break;
172      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
173      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
174      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
170      case SNDINFO_STR_NAME:                     strcpy(info->s, "ST0016");                  break;
171      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Seta custom");               break;
172      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
173      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
174      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
175175   }
176176}
177177
src/emu/sound/tiaintf.c
r3957r3958
1010};
1111
1212
13static void tia_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
13static STREAM_UPDATE( tia_update )
1414{
1515   struct tia_info *info = param;
16   tia_process(info->chip, buffer[0], length);
16   tia_process(info->chip, outputs[0], samples);
1717}
1818
1919
r3957r3958
6969      /* --- the following bits of info are returned as 64-bit signed integers --- */
7070
7171      /* --- the following bits of info are returned as pointers to data or functions --- */
72      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tia );         break;
73      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tia );            break;
74      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tia );               break;
75      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
72      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tia );   break;
73      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tia );      break;
74      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tia );         break;
75      case SNDINFO_PTR_RESET:                     /* Nothing */                        break;
7676
7777      /* --- the following bits of info are returned as NULL-terminated strings --- */
78      case SNDINFO_STR_NAME:                     info->s = "TIA";                  break;
79      case SNDINFO_STR_CORE_FAMILY:               info->s = "Atari custom";            break;
80      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
81      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
82      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
78      case SNDINFO_STR_NAME:                     strcpy(info->s, "TIA");                  break;
79      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Atari custom");         break;
80      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
81      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
82      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
8383   }
8484}
8585
src/emu/sound/c6280.c
r3957r3958
208208}
209209
210210
211static void c6280_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
211static STREAM_UPDATE( c6280_update )
212212{
213213    static const int scale_tab[] = {
214214        0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
r3957r3958
226226    rmal = scale_tab[rmal];
227227
228228    /* Clear buffer */
229    for(i = 0; i < length; i++)
229    for(i = 0; i < samples; i++)
230230    {
231        buffer[0][i] = 0;
232        buffer[1][i] = 0;
231        outputs[0][i] = 0;
232        outputs[1][i] = 0;
233233    }
234234
235235    for(ch = 0; ch < 6; ch++)
r3957r3958
259259            {
260260                /* Noise mode */
261261                UINT32 step = p->noise_freq_tab[(p->channel[ch].noise_control & 0x1F) ^ 0x1F];
262                for(i = 0; i < length; i += 1)
262                for(i = 0; i < samples; i += 1)
263263                {
264264                    static int data = 0;
265265                    p->channel[ch].noise_counter += step;
r3957r3958
268268                        data = (mame_rand(p->device->machine) & 1) ? 0x1F : 0;
269269                    }
270270                    p->channel[ch].noise_counter &= 0x7FF;
271                    buffer[0][i] += (INT16)(vll * (data - 16));
272                    buffer[1][i] += (INT16)(vlr * (data - 16));
271                    outputs[0][i] += (INT16)(vll * (data - 16));
272                    outputs[1][i] += (INT16)(vlr * (data - 16));
273273                }
274274            }
275275            else
276276            if(p->channel[ch].control & 0x40)
277277            {
278278                /* DDA mode */
279                for(i = 0; i < length; i++)
279                for(i = 0; i < samples; i++)
280280                {
281                    buffer[0][i] += (INT16)(vll * (p->channel[ch].dda - 16));
282                    buffer[1][i] += (INT16)(vlr * (p->channel[ch].dda - 16));
281                    outputs[0][i] += (INT16)(vll * (p->channel[ch].dda - 16));
282                    outputs[1][i] += (INT16)(vlr * (p->channel[ch].dda - 16));
283283                }
284284            }
285285            else
286286            {
287287                /* Waveform mode */
288288                UINT32 step = p->wave_freq_tab[p->channel[ch].frequency];
289                for(i = 0; i < length; i += 1)
289                for(i = 0; i < samples; i += 1)
290290                {
291291                    int offset;
292292                    INT16 data;
r3957r3958
294294                    p->channel[ch].counter += step;
295295                    p->channel[ch].counter &= 0x1FFFF;
296296                    data = p->channel[ch].waveform[offset];
297                    buffer[0][i] += (INT16)(vll * (data - 16));
298                    buffer[1][i] += (INT16)(vlr * (data - 16));
297                    outputs[0][i] += (INT16)(vll * (data - 16));
298                    outputs[1][i] += (INT16)(vlr * (data - 16));
299299                }
300300            }
301301        }
r3957r3958
350350      /* --- the following bits of info are returned as 64-bit signed integers --- */
351351
352352      /* --- the following bits of info are returned as pointers to data or functions --- */
353      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c6280 );      break;
354      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c6280 );            break;
355      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
356      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
353      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( c6280 );   break;
354      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( c6280 );         break;
355      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
356      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
357357
358358      /* --- the following bits of info are returned as NULL-terminated strings --- */
359      case SNDINFO_STR_NAME:                     info->s = "HuC6280";               break;
360      case SNDINFO_STR_CORE_FAMILY:               info->s = "????";                  break;
361      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
362      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
363      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
359      case SNDINFO_STR_NAME:                     strcpy(info->s, "HuC6280");                  break;
360      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "????");                  break;
361      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
362      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
363      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
364364   }
365365}
366366
src/emu/sound/discrete.c
r3957r3958
424424 *
425425 *************************************/
426426
427static void discrete_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
427static STREAM_UPDATE( discrete_stream_update )
428428{
429429   discrete_info *info = param;
430430   int samplenum, nodenum, outputnum;
r3957r3958
439439      info->input_stream_data[nodenum] = inputs[nodenum];
440440   }
441441
442   /* Now we must do length iterations of the node list, one output for each step */
443   for (samplenum = 0; samplenum < length; samplenum++)
442   /* Now we must do samples iterations of the node list, one output for each step */
443   for (samplenum = 0; samplenum < samples; samplenum++)
444444   {
445445      /* loop over all nodes */
446446      for (nodenum = 0; nodenum < info->node_count; nodenum++)
r3957r3958
463463      for (outputnum = 0; outputnum < info->discrete_outputs; outputnum++)
464464      {
465465         val = (*info->output_node[outputnum]->input[0]) * (*info->output_node[outputnum]->input[1]);
466         buffer[outputnum][samplenum] = val;
466         outputs[outputnum][samplenum] = val;
467467      }
468468
469469      /* Dump any csv logs */
r3957r3958
764764      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( discrete );         break;
765765
766766      /* --- the following bits of info are returned as NULL-terminated strings --- */
767      case SNDINFO_STR_NAME:                     info->s = "Discrete";               break;
768      case SNDINFO_STR_CORE_FAMILY:               info->s = "Analog";                  break;
769      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
770      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
771      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
767      case SNDINFO_STR_NAME:                     strcpy(info->s, "Discrete");                  break;
768      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Analog");                     break;
769      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                        break;
770      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
771      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
772772   }
773773}
774774
src/emu/sound/samples.c
r3957r3958
442442}
443443
444444
445static void sample_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
445static STREAM_UPDATE( sample_update_sound )
446446{
447447   struct sample_channel *chan = param;
448   stream_sample_t *buffer = _buffer[0];
448   stream_sample_t *buffer = outputs[0];
449449
450450   if (chan->source && !chan->paused)
451451   {
r3957r3958
456456      const INT16 *sample = chan->source;
457457      UINT32 sample_length = chan->source_length;
458458
459      while (length--)
459      while (samples--)
460460      {
461461         /* do a linear interp on the sample */
462462         INT32 sample1 = sample[pos];
r3957r3958
478478            {
479479               chan->source = NULL;
480480               chan->source_num = -1;
481               if (length > 0)
482                  memset(buffer, 0, length * sizeof(*buffer));
481               if (samples > 0)
482                  memset(buffer, 0, samples * sizeof(*buffer));
483483               break;
484484            }
485485         }
r3957r3958
490490      chan->frac = frac;
491491   }
492492   else
493      memset(buffer, 0, length * sizeof(*buffer));
493      memset(buffer, 0, samples * sizeof(*buffer));
494494}
495495
496496
r3957r3958
598598      /* --- the following bits of info are returned as 64-bit signed integers --- */
599599
600600      /* --- the following bits of info are returned as pointers to data or functions --- */
601        case SNDINFO_PTR_SET_INFO:                      info->set_info = SND_SET_INFO_NAME( samples );      break;
602        case SNDINFO_PTR_START:                         info->start = SND_START_NAME( samples );            break;
603        case SNDINFO_PTR_STOP:                          /* Nothing */                           break;
604        case SNDINFO_PTR_RESET:                         /* Nothing */                           break;
601        case SNDINFO_PTR_SET_INFO:                      info->set_info = SND_SET_INFO_NAME( samples );   break;
602        case SNDINFO_PTR_START:                         info->start = SND_START_NAME( samples );      break;
603        case SNDINFO_PTR_STOP:                          /* Nothing */                                 break;
604        case SNDINFO_PTR_RESET:                         /* Nothing */                                 break;
605605
606606      /* --- the following bits of info are returned as NULL-terminated strings --- */
607        case SNDINFO_STR_NAME:                          info->s = "Samples";                    break;
608        case SNDINFO_STR_CORE_FAMILY:                   info->s = "Big Hack";                   break;
609        case SNDINFO_STR_CORE_VERSION:                  info->s = "1.1";                        break;
610        case SNDINFO_STR_CORE_FILE:                     info->s = __FILE__;                     break;
611        case SNDINFO_STR_CORE_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
607        case SNDINFO_STR_NAME:                          strcpy(info->s, "Samples");                       break;
608        case SNDINFO_STR_CORE_FAMILY:                   strcpy(info->s, "Big Hack");                      break;
609        case SNDINFO_STR_CORE_VERSION:                  strcpy(info->s, "1.1");                           break;
610        case SNDINFO_STR_CORE_FILE:                     strcpy(info->s, __FILE__);                           break;
611        case SNDINFO_STR_CORE_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
612612   }
613613}
614614
src/emu/sound/msm5232.c
r3957r3958
703703#endif
704704
705705
706static void MSM5232_update_one(void *param, stream_sample_t **inputs, stream_sample_t** buffer, int samples)
706static STREAM_UPDATE( MSM5232_update_one )
707707{
708708   MSM5232 * chip = param;
709   stream_sample_t *buf1 = buffer[0];
710   stream_sample_t *buf2 = buffer[1];
711   stream_sample_t *buf3 = buffer[2];
712   stream_sample_t *buf4 = buffer[3];
713   stream_sample_t *buf5 = buffer[4];
714   stream_sample_t *buf6 = buffer[5];
715   stream_sample_t *buf7 = buffer[6];
716   stream_sample_t *buf8 = buffer[7];
717   stream_sample_t *bufsolo1 = buffer[8];
718   stream_sample_t *bufsolo2 = buffer[9];
719   stream_sample_t *bufnoise = buffer[10];
709   stream_sample_t *buf1 = outputs[0];
710   stream_sample_t *buf2 = outputs[1];
711   stream_sample_t *buf3 = outputs[2];
712   stream_sample_t *buf4 = outputs[3];
713   stream_sample_t *buf5 = outputs[4];
714   stream_sample_t *buf6 = outputs[5];
715   stream_sample_t *buf7 = outputs[6];
716   stream_sample_t *buf8 = outputs[7];
717   stream_sample_t *bufsolo1 = outputs[8];
718   stream_sample_t *bufsolo2 = outputs[9];
719   stream_sample_t *bufnoise = outputs[10];
720720   int i;
721721
722722   for (i=0; i<samples; i++)
r3957r3958
848848      /* --- the following bits of info are returned as 64-bit signed integers --- */
849849
850850      /* --- the following bits of info are returned as pointers to data or functions --- */
851      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5232 );      break;
852      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( msm5232 );         break;
853      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( msm5232 );            break;
851      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( msm5232 );   break;
852      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( msm5232 );      break;
853      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( msm5232 );         break;
854854      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( msm5232 );         break;
855855
856856      /* --- the following bits of info are returned as NULL-terminated strings --- */
857      case SNDINFO_STR_NAME:                     info->s = "MSM5232";               break;
858      case SNDINFO_STR_CORE_FAMILY:               info->s = "Oki Tone";               break;
859      case SNDINFO_STR_CORE_VERSION:               info->s = "1.1";                  break;
860      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
861      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
857      case SNDINFO_STR_NAME:                     strcpy(info->s, "MSM5232");                  break;
858      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Oki Tone");               break;
859      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.1");                     break;
860      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
861      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
862862   }
863863}
864864
src/emu/sound/scsp.c
r3957r3958
12121212}
12131213#endif
12141214
1215static void SCSP_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
1215static STREAM_UPDATE( SCSP_Update )
12161216{
12171217   struct _SCSP *SCSP = param;
1218   bufferl = buf[0];
1219   bufferr = buf[1];
1218   bufferl = outputs[0];
1219   bufferr = outputs[1];
12201220   length = samples;
12211221   SCSP_DoMasterSamples(SCSP, samples);
12221222}
r3957r3958
13871387      /* --- the following bits of info are returned as 64-bit signed integers --- */
13881388
13891389      /* --- the following bits of info are returned as pointers to data or functions --- */
1390      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( scsp );         break;
1391      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( scsp );            break;
1392      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
1393      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
1390      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( scsp );   break;
1391      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( scsp );      break;
1392      case SNDINFO_PTR_STOP:                     /* Nothing */                        break;
1393      case SNDINFO_PTR_RESET:                     /* Nothing */                        break;
13941394
13951395      /* --- the following bits of info are returned as NULL-terminated strings --- */
1396      case SNDINFO_STR_NAME:                     info->s = "SCSP";                  break;
1397      case SNDINFO_STR_CORE_FAMILY:               info->s = "Sega/Yamaha custom";         break;
1398      case SNDINFO_STR_CORE_VERSION:               info->s = "2.1.1";                  break;
1399      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1400      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1396      case SNDINFO_STR_NAME:                     strcpy(info->s, "SCSP");               break;
1397      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Sega/Yamaha custom");      break;
1398      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "2.1.1");               break;
1399      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
1400      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
14011401   }
14021402}
14031403
src/emu/sound/flt_rc.c
r3957r3958
1414const flt_rc_config flt_rc_ac_default = {FLT_RC_AC, 10000, 0, 0, CAP_U(1)};
1515
1616
17static void filter_rc_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
17static STREAM_UPDATE( filter_rc_update )
1818{
1919   stream_sample_t *src = inputs[0];
2020   stream_sample_t *dst = outputs[0];
r3957r3958
134134      /* --- the following bits of info are returned as pointers to data or functions --- */
135135      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( filter_rc );   break;
136136      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( filter_rc );         break;
137      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
138      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
137      case SNDINFO_PTR_STOP:                     /* Nothing */                              break;
138      case SNDINFO_PTR_RESET:                     /* Nothing */                              break;
139139
140140      /* --- the following bits of info are returned as NULL-terminated strings --- */
141      case SNDINFO_STR_NAME:                     info->s = "RC Filter";               break;
142      case SNDINFO_STR_CORE_FAMILY:               info->s = "Filters";               break;
143      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
144      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
145      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
141      case SNDINFO_STR_NAME:                     strcpy(info->s, "RC Filter");                  break;
142      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Filters");                     break;
143      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
144      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
145      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
146146   }
147147}
148148
src/emu/sound/2610intf.c
r3957r3958
106106}
107107
108108#if BUILD_YM2610
109static void ym2610_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
109static STREAM_UPDATE( ym2610_stream_update )
110110{
111111   struct ym2610_info *info = param;
112   ym2610_update_one(info->chip, buffers, length);
112   ym2610_update_one(info->chip, outputs, samples);
113113}
114114
115115
r3957r3958
181181#endif
182182
183183#if BUILD_YM2610B
184static void ym2610b_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
184static STREAM_UPDATE( ym2610b_stream_update )
185185{
186186   struct ym2610_info *info = param;
187   ym2610b_update_one(info->chip, buffers, length);
187   ym2610b_update_one(info->chip, outputs, samples);
188188}
189189
190190static SND_START( ym2610b )
r3957r3958
503503      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2610 );            break;
504504
505505      /* --- the following bits of info are returned as NULL-terminated strings --- */
506      case SNDINFO_STR_NAME:                     info->s = "YM2610";                  break;
507      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
508      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
509      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
510      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
506      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2610");                     break;
507      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
508      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
509      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
510      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
511511   }
512512}
513513#endif
r3957r3958
540540      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2610 );            break;
541541
542542      /* --- the following bits of info are returned as NULL-terminated strings --- */
543      case SNDINFO_STR_NAME:                     info->s = "YM2610B";               break;
544      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
545      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
546      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
547      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
543      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2610B");                     break;
544      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
545      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
546      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
547      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
548548   }
549549}
550550
src/emu/sound/beep.c
r3957r3958
3636 *
3737 *************************************/
3838
39static void beep_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
39static STREAM_UPDATE( beep_sound_update )
4040{
4141   struct beep_sound *bs = (struct beep_sound *) param;
42   stream_sample_t *buffer = _buffer[0];
42   stream_sample_t *buffer = outputs[0];
4343   INT16 signal = bs->signal;
4444   int clock = 0, rate = BEEP_RATE / 2;
4545
r3957r3958
5252   /* if we're not enabled, just fill with 0 */
5353   if ( !bs->enable || clock == 0 )
5454   {
55      memset( buffer, 0, length * sizeof(*buffer) );
55      memset( buffer, 0, samples * sizeof(*buffer) );
5656      return;
5757   }
5858
5959   /* fill in the sample */
60   while( length-- > 0 )
60   while( samples-- > 0 )
6161   {
6262      *buffer++ = signal;
6363      incr -= clock;
r3957r3958
182182      /* --- the following bits of info are returned as 64-bit signed integers --- */
183183
184184      /* --- the following bits of info are returned as pointers to data or functions --- */
185      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( beep );         break;
186      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( beep );            break;
187      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
188      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
185      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( beep );   break;
186      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( beep );      break;
187      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
188      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
189189
190190      /* --- the following bits of info are returned as NULL-terminated strings --- */
191      case SNDINFO_STR_NAME:                     info->s = "Beep";                  break;
192      case SNDINFO_STR_CORE_FAMILY:               info->s = "Beep";                  break;
193      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
194      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
195      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright The MESS Team"; break;
191      case SNDINFO_STR_NAME:                     strcpy(info->s, "Beep");               break;
192      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Beep");               break;
193      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
194      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
195      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright The MESS Team"); break;
196196   }
197197}
src/emu/sound/tms3615.c
r3957r3958
2020   int enable;          /* mask which tones to play */
2121};
2222
23static void tms3615_sound_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
23static STREAM_UPDATE( tms3615_sound_update )
2424{
2525   struct TMS3615 *tms = param;
2626   int samplerate = tms->samplerate;
27   stream_sample_t *buffer8 = _buffer[TMS3615_FOOTAGE_8];
28   stream_sample_t *buffer16 = _buffer[TMS3615_FOOTAGE_16];
27   stream_sample_t *buffer8 = outputs[TMS3615_FOOTAGE_8];
28   stream_sample_t *buffer16 = outputs[TMS3615_FOOTAGE_16];
2929
30   while( length-- > 0 )
30   while( samples-- > 0 )
3131   {
3232      int sum8 = 0, sum16 = 0, tone = 0;
3333
r3957r3958
110110      /* --- the following bits of info are returned as 64-bit signed integers --- */
111111
112112      /* --- the following bits of info are returned as pointers to data or functions --- */
113      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms3615 );      break;
114      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms3615 );         break;
115      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
116      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
113      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms3615 );   break;
114      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms3615 );      break;
115      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
116      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
117117
118118      /* --- the following bits of info are returned as NULL-terminated strings --- */
119      case SNDINFO_STR_NAME:                     info->s = "TMS3615";               break;
120      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI PSG";                  break;
121      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
122      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
123      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
119      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS3615");                  break;
120      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "TI PSG");                  break;
121      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
122      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
123      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
124124   }
125125}
src/emu/sound/ics2115.c
r3957r3958
8585}
8686
8787
88static void update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
88static STREAM_UPDATE( update )
8989{
9090   struct ics2115 *chip = param;
9191   int osc, i;
9292   int rec_irq = 0;
9393
94   memset(buffer[0], 0, length*sizeof(*buffer[0]));
95   memset(buffer[1], 0, length*sizeof(*buffer[0]));
94   memset(outputs[0], 0, samples*sizeof(*outputs[0]));
95   memset(outputs[1], 0, samples*sizeof(*outputs[0]));
9696
9797   for(osc = 0; osc < 32; osc++)
9898      if(chip->voice[osc].state & V_ON) {
r3957r3958
108108         if (ICS2115LOGERROR) logerror("ICS2115: KEYRUN %02d adr=%08x end=%08x delta=%08x\n",
109109                osc, adr, end, delta);
110110
111         for(i=0; i<length; i++) {
111         for(i=0; i<samples; i++) {
112112            INT32 v = chip->rom[badr|(adr >> 12)];
113113            if(conf & 1)
114114               v = chip->ulaw[v];
r3957r3958
116116               v = ((INT8)v) << 6;
117117
118118            v = (v*vol)>>(16+5);
119            buffer[0][i] += v;
120            buffer[1][i] += v;
119            outputs[0][i] += v;
120            outputs[1][i] += v;
121121            adr += delta;
122122            if(adr >= end) {
123123               if (ICS2115LOGERROR) logerror("ICS2115: KEYDONE %2d\n", osc);
r3957r3958
556556      /* --- the following bits of info are returned as 64-bit signed integers --- */
557557
558558      /* --- the following bits of info are returned as pointers to data or functions --- */
559      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ics2115 );      break;
560      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ics2115 );         break;
561      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
562      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ics2115 );         break;
559      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ics2115 );   break;
560      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ics2115 );      break;
561      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
562      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ics2115 );      break;
563563
564564      /* --- the following bits of info are returned as NULL-terminated strings --- */
565      case SNDINFO_STR_NAME:                     info->s = "ICS2115";               break;
566      case SNDINFO_STR_CORE_FAMILY:               info->s = "ICS";                  break;
567      case SNDINFO_STR_CORE_VERSION:               info->s = "1.01";                  break;
568      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
569      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
565      case SNDINFO_STR_NAME:                     strcpy(info->s, "ICS2115");                  break;
566      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "ICS");                     break;
567      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.01");                  break;
568      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
569      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
570570   }
571571}
572572
src/emu/sound/dac.c
r3957r3958
1818
1919
2020
21static void DAC_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
21static STREAM_UPDATE( DAC_update )
2222{
2323   struct dac_info *info = param;
24   stream_sample_t *buffer = _buffer[0];
24   stream_sample_t *buffer = outputs[0];
2525   INT16 out = info->output;
2626
27   while (length--) *(buffer++) = out;
27   while (samples--) *(buffer++) = out;
2828}
2929
3030
r3957r3958
171171      /* --- the following bits of info are returned as 64-bit signed integers --- */
172172
173173      /* --- the following bits of info are returned as pointers to data or functions --- */
174      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dac );         break;
175      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( dac );            break;
176      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
177      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
174      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dac );   break;
175      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( dac );      break;
176      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
177      case SNDINFO_PTR_RESET:                     /* nothing */                        break;
178178
179179      /* --- the following bits of info are returned as NULL-terminated strings --- */
180      case SNDINFO_STR_NAME:                     info->s = "DAC";                  break;
181      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI Speech";               break;
182      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
183      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
184      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
180      case SNDINFO_STR_NAME:                     strcpy(info->s, "DAC");                  break;
181      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "DAC");                  break;
182      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
183      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
184      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
185185   }
186186}
187187
src/emu/sound/s14001a.c
r3957r3958
532532   MAME glue code
533533 **************************************************************************/
534534
535static void s14001a_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
535static STREAM_UPDATE( s14001a_pcm_update )
536536{
537537   INT32 mix[48000];
538538   INT32 *mixp;
r3957r3958
542542   memset(mix, 0, sizeof(mix));
543543
544544   mixp = &mix[0];
545   for (i = 0; i < length; i++)
545   for (i = 0; i < samples; i++)
546546   {
547547      s14001a_clock(chip);
548548      if (chip->audioout == ALTFLAG) // input from test pins -> output
r3957r3958
639639      case SNDINFO_PTR_START:                  info->start = SND_START_NAME( s14001a );      break;
640640
641641      /* --- the following bits of info are returned as NULL-terminated strings --- */
642      case SNDINFO_STR_NAME:                  info->s = "S14001A";      break;
643      case SNDINFO_STR_CORE_FAMILY:            info->s = "TSI S14001A";   break;
644      case SNDINFO_STR_CORE_VERSION:            info->s = "1.31";         break;
645      case SNDINFO_STR_CORE_FILE:               info->s = __FILE__;         break;
646      case SNDINFO_STR_CORE_CREDITS:            info->s = "Copyright Jonathan Gevaryahu"; break;
642      case SNDINFO_STR_NAME:                  strcpy(info->s, "S14001A");                  break;
643      case SNDINFO_STR_CORE_FAMILY:            strcpy(info->s, "TSI S14001A");               break;
644      case SNDINFO_STR_CORE_VERSION:            strcpy(info->s, "1.31");                  break;
645      case SNDINFO_STR_CORE_FILE:               strcpy(info->s, __FILE__);                  break;
646      case SNDINFO_STR_CORE_CREDITS:            strcpy(info->s, "Copyright Jonathan Gevaryahu"); break;
647647   }
648648}
src/emu/sound/gaelco.c
r3957r3958
8383            Writes length bytes to the sound buffer
8484  ============================================================================*/
8585
86static void gaelco_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
86static STREAM_UPDATE( gaelco_update )
8787{
8888   struct GAELCOSND *info = param;
8989   int j, ch;
9090
9191    /* fill all data needed */
92   for(j = 0; j < length; j++){
92   for(j = 0; j < samples; j++){
9393      int output_l = 0, output_r = 0;
9494
9595      /* for each channel */
r3957r3958
175175#endif
176176
177177      /* now that we have computed all channels, save current data to the output buffer */
178      buffer[0][j] = output_l;
179      buffer[1][j] = output_r;
178      outputs[0][j] = output_l;
179      outputs[1][j] = output_r;
180180   }
181181
182182   if (wavraw)
183      wav_add_data_32lr(wavraw, buffer[0], buffer[1], length, 0);
183      wav_add_data_32lr(wavraw, outputs[0], outputs[1], samples, 0);
184184}
185185
186186/*============================================================================
r3957r3958
319319      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( gaelco_gae1 );   break;
320320      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( gaelco_gae1 );      break;
321321      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( gaelco );            break;
322      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
322      case SNDINFO_PTR_RESET:                     /* nothing */                              break;
323323
324324      /* --- the following bits of info are returned as NULL-terminated strings --- */
325      case SNDINFO_STR_NAME:                     info->s = "Gaelco GAE1";            break;
326      case SNDINFO_STR_CORE_FAMILY:               info->s = "Gaelco custom";            break;
327      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
328      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
329      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
325      case SNDINFO_STR_NAME:                     strcpy(info->s, "Gaelco GAE1");                  break;
326      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Gaelco custom");               break;
327      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
328      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
329      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
330330   }
331331}
332332
r3957r3958
355355      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( gaelco_cg1v );   break;
356356      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( gaelco_cg1v );      break;
357357      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( gaelco );            break;
358      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
358      case SNDINFO_PTR_RESET:                     /* nothing */                              break;
359359
360360      /* --- the following bits of info are returned as NULL-terminated strings --- */
361      case SNDINFO_STR_NAME:                     info->s = "Gaelco CG1V";            break;
362      case SNDINFO_STR_CORE_FAMILY:               info->s = "Gaelco custom";            break;
363      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
364      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
365      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
361      case SNDINFO_STR_NAME:                     strcpy(info->s, "Gaelco CG1V");                  break;
362      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Gaelco custom");               break;
363      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
364      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
365      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
366366   }
367367}
368368
src/emu/sound/bsmt2000.c
r3957r3958
8686
8787/* core implementation */
8888static void bsmt2000_reset(bsmt2000_chip *chip);
89static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
89static STREAM_UPDATE( bsmt2000_update );
9090
9191/* read/write access */
9292static void bsmt2000_reg_write(bsmt2000_chip *chip, offs_t offset, UINT16 data);
r3957r3958
183183    sample generation
184184-------------------------------------------------*/
185185
186static void bsmt2000_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
186static STREAM_UPDATE( bsmt2000_update )
187187{
188   stream_sample_t *left = buffer[0];
189   stream_sample_t *right = buffer[1];
188   stream_sample_t *left = outputs[0];
189   stream_sample_t *right = outputs[1];
190190   bsmt2000_chip *chip = param;
191191   bsmt2000_voice *voice;
192192   int samp, voicenum;
193193
194194   /* clear out the accumulator */
195   memset(left, 0, length * sizeof(left[0]));
196   memset(right, 0, length * sizeof(right[0]));
195   memset(left, 0, samples * sizeof(left[0]));
196   memset(right, 0, samples * sizeof(right[0]));
197197
198198   /* loop over voices */
199199   for (voicenum = 0; voicenum < chip->voices; voicenum++)
r3957r3958
211211         UINT16 frac = voice->fraction;
212212
213213         /* loop while we still have samples to generate */
214         for (samp = 0; samp < length; samp++)
214         for (samp = 0; samp < samples; samp++)
215215         {
216216#if ENABLE_INTERPOLATION
217217            INT32 sample = (base[pos] * (0x800 - frac) + (base[pos + 1] * frac)) >> 11;
r3957r3958
249249      UINT32 frac = voice->fraction;
250250
251251      /* loop while we still have samples to generate */
252      for (samp = 0; samp < length && pos < voice->loopend; samp++)
252      for (samp = 0; samp < samples && pos < voice->loopend; samp++)
253253      {
254254         /* apply volumes and add */
255255         left[samp] += (chip->adpcm_current * lvol) >> 8;
r3957r3958
304304   }
305305
306306   /* reduce the overall gain */
307   for (samp = 0; samp < length; samp++)
307   for (samp = 0; samp < samples; samp++)
308308   {
309309      left[samp] >>= 9;
310310      right[samp] >>= 9;
r3957r3958
504504      /* --- the following bits of info are returned as pointers to data or functions --- */
505505      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( bsmt2000 );      break;
506506      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( bsmt2000 );         break;
507      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
507      case SNDINFO_PTR_STOP:                     /* nothing */                              break;
508508      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( bsmt2000 );         break;
509509
510510      /* --- the following bits of info are returned as NULL-terminated strings --- */
511      case SNDINFO_STR_NAME:                     info->s = "BSMT2000";               break;
512      case SNDINFO_STR_CORE_FAMILY:               info->s = "Data East Wavetable";      break;
513      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
514      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
515      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
511      case SNDINFO_STR_NAME:                     strcpy(info->s, "BSMT2000");                  break;
512      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Data East Wavetable");            break;
513      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
514      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
515      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
516516   }
517517}
src/emu/sound/dmadac.c
r3957r3958
6262 *
6363 *************************************/
6464
65static void dmadac_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
65static STREAM_UPDATE( dmadac_update )
6666{
6767   struct dmadac_channel_data *ch = param;
68   stream_sample_t *output = _buffer[0];
68   stream_sample_t *output = outputs[0];
6969   INT16 *source = ch->buffer;
7070   UINT32 curout = ch->bufout;
7171   UINT32 curin = ch->bufin;
7272   int volume = ch->volume;
7373
7474   /* feed as much as we can */
75   while (curout != curin && length-- > 0)
75   while (curout != curin && samples-- > 0)
7676      *output++ = (source[curout++ % BUFFER_SIZE] * volume) >> 8;
7777
7878   /* fill the rest with silence */
79   while (length-- > 0)
79   while (samples-- > 0)
8080      *output++ = 0;
8181
8282   /* save the new output pointer */
r3957r3958
251251      /* --- the following bits of info are returned as 64-bit signed integers --- */
252252
253253      /* --- the following bits of info are returned as pointers to data or functions --- */
254      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dmadac );      break;
255      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( dmadac );            break;
256      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
257      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
254      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( dmadac );   break;
255      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( dmadac );         break;
256      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
257      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
258258
259259      /* --- the following bits of info are returned as NULL-terminated strings --- */
260      case SNDINFO_STR_NAME:                     info->s = "DMA-driven DAC";            break;
261      case SNDINFO_STR_CORE_FAMILY:               info->s = "DAC";                  break;
262      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
263      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
264      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
260      case SNDINFO_STR_NAME:                     strcpy(info->s, "DMA-driven DAC");            break;
261      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "DAC");                     break;
262      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
263      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
264      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
265265   }
266266}
267267
src/emu/sound/2608intf.c
r3957r3958
104104   stream_update(info->stream);
105105}
106106
107static void ym2608_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
107static STREAM_UPDATE( ym2608_stream_update )
108108{
109109   struct ym2608_info *info = param;
110   ym2608_update_one(info->chip, buffers, length);
110   ym2608_update_one(info->chip, outputs, samples);
111111}
112112
113113
r3957r3958
317317      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2608 );            break;
318318
319319      /* --- the following bits of info are returned as NULL-terminated strings --- */
320      case SNDINFO_STR_NAME:                     info->s = "YM2608";                  break;
321      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
322      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
323      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
324      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
320      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2608");                     break;
321      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
322      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
323      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
324      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
325325   }
326326}
src/emu/sound/okim6295.c
r3957r3958
251251
252252***********************************************************************************************/
253253
254static void okim6295_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
254static STREAM_UPDATE( okim6295_update )
255255{
256256   struct okim6295 *chip = param;
257257   int i;
r3957r3958
670670      /* --- the following bits of info are returned as pointers to data or functions --- */
671671      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( okim6295 );      break;
672672      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( okim6295 );         break;
673      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
673      case SNDINFO_PTR_STOP:                     /* nothing */                              break;
674674      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( okim6295 );         break;
675675
676676      /* --- the following bits of info are returned as NULL-terminated strings --- */
677      case SNDINFO_STR_NAME:                     info->s = "OKI6295";               break;
678      case SNDINFO_STR_CORE_FAMILY:               info->s = "OKI ADPCM";               break;
679      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
680      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
681      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
677      case SNDINFO_STR_NAME:                     strcpy(info->s, "OKI6295");                     break;
678      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "OKI ADPCM");                  break;
679      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
680      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
681      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
682682   }
683683}
684684
src/emu/sound/es5506.c
r3957r3958
769769
770770***********************************************************************************************/
771771
772static void es5506_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
772static STREAM_UPDATE( es5506_update )
773773{
774774   struct ES5506Chip *chip = param;
775775   INT32 *lsrc = chip->scratch, *rsrc = chip->scratch;
776   stream_sample_t *ldest = buffer[0];
777   stream_sample_t *rdest = buffer[1];
776   stream_sample_t *ldest = outputs[0];
777   stream_sample_t *rdest = outputs[1];
778778
779779#if MAKE_WAVS
780780   /* start the logging once we have a sample rate */
r3957r3958
786786#endif
787787
788788   /* loop until all samples are output */
789   while (length)
789   while (samples)
790790   {
791      int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
791      int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
792792      int samp;
793793
794794      /* determine left/right source data */
795795      lsrc = chip->scratch;
796      rsrc = chip->scratch + samples;
797      generate_samples(chip, lsrc, rsrc, samples);
796      rsrc = chip->scratch + length;
797      generate_samples(chip, lsrc, rsrc, length);
798798
799799      /* copy the data */
800      for (samp = 0; samp < samples; samp++)
800      for (samp = 0; samp < length; samp++)
801801      {
802802         *ldest++ = lsrc[samp] >> 4;
803803         *rdest++ = rsrc[samp] >> 4;
r3957r3958
806806#if MAKE_WAVS
807807      /* log the raw data */
808808      if (chip->wavraw)
809         wav_add_data_32lr(chip->wavraw, lsrc, rsrc, samples, 4);
809         wav_add_data_32lr(chip->wavraw, lsrc, rsrc, length, 4);
810810#endif
811811
812812      /* account for these samples */
813      length -= samples;
813      samples -= length;
814814   }
815815}
816816
r3957r3958
21672167      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( es5505 );            break;
21682168
21692169      /* --- the following bits of info are returned as NULL-terminated strings --- */
2170      case SNDINFO_STR_NAME:                     info->s = "ES5505";                  break;
2171      case SNDINFO_STR_CORE_FAMILY:               info->s = "Ensoniq Wavetable";         break;
2172      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
2173      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
2174      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
2170      case SNDINFO_STR_NAME:                     strcpy(info->s, "ES5505");                     break;
2171      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Ensoniq Wavetable");            break;
2172      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
2173      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
2174      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
21752175   }
21762176}
21772177
r3957r3958
22022202      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( es5506 );            break;
22032203
22042204      /* --- the following bits of info are returned as NULL-terminated strings --- */
2205      case SNDINFO_STR_NAME:                     info->s = "ES5506";                  break;
2206      case SNDINFO_STR_CORE_FAMILY:               info->s = "Ensoniq Wavetable";         break;
2207      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
2208      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
2209      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
2205      case SNDINFO_STR_NAME:                     strcpy(info->s, "ES5506");                     break;
2206      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Ensoniq Wavetable");            break;
2207      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
2208      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
2209      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
22102210   }
22112211}
22122212
src/emu/sound/ymf278b.c
r3957r3958
255255   }
256256}
257257
258static void ymf278b_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
258static STREAM_UPDATE( ymf278b_pcm_update )
259259{
260260   YMF278BChip *chip = param;
261261   int i, j;
r3957r3958
265265   INT32 *mixp;
266266   INT32 vl, vr;
267267
268   memset(mix, 0, sizeof(mix[0])*length*2);
268   memset(mix, 0, sizeof(mix[0])*samples*2);
269269
270270   rombase = chip->rom;
271271
r3957r3958
277277      {
278278         mixp = mix;
279279
280         for (j = 0; j < length; j++)
280         for (j = 0; j < samples; j++)
281281         {
282282            switch (slot->bits)
283283            {
r3957r3958
329329   mixp = mix;
330330   vl = chip->mix_level[chip->pcm_l];
331331   vr = chip->mix_level[chip->pcm_r];
332   for (i = 0; i < length; i++)
332   for (i = 0; i < samples; i++)
333333   {
334334      outputs[0][i] = (*mixp++ * vl) >> 16;
335335      outputs[1][i] = (*mixp++ * vr) >> 16;
r3957r3958
808808      /* --- the following bits of info are returned as 64-bit signed integers --- */
809809
810810      /* --- the following bits of info are returned as pointers to data or functions --- */
811      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf278b );      break;
812      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymf278b );         break;
813      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
814      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
811      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( ymf278b );   break;
812      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( ymf278b );      break;
813      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
814      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
815815
816816      /* --- the following bits of info are returned as NULL-terminated strings --- */
817      case SNDINFO_STR_NAME:                     info->s = "YMF278B";               break;
818      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
819      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
820      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
821      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
817      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMF278B");                  break;
818      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");               break;
819      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
820      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
821      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
822822   }
823823}
824824
src/emu/sound/sid6581.c
r3957r3958
2121
2222
2323
24static void sid_update(void *token,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
24static STREAM_UPDATE( sid_update )
2525{
26   SID6581 *sid = (SID6581 *) token;
27   sidEmuFillBuffer(sid, _buffer[0], length);
26   SID6581 *sid = (SID6581 *) param;
27   sidEmuFillBuffer(sid, outputs[0], samples);
2828}
2929
3030
r3957r3958
115115      /* --- the following bits of info are returned as 64-bit signed integers --- */
116116
117117      /* --- the following bits of info are returned as pointers to data or functions --- */
118      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sid6581 );      break;
119      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sid6581 );         break;
120      case SNDINFO_PTR_STOP:                     info->stop = NULL;                  break;
121      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( sid );            break;
118      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( sid6581 );   break;
119      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sid6581 );      break;
120      case SNDINFO_PTR_STOP:                     info->stop = NULL;                        break;
121      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( sid );         break;
122122
123123      /* --- the following bits of info are returned as NULL-terminated strings --- */
124      case SNDINFO_STR_NAME:                     info->s = "SID6581";               break;
125      case SNDINFO_STR_CORE_FAMILY:               info->s = "SID";                  break;
126      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
127      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
128      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright The MESS Team"; break;
124      case SNDINFO_STR_NAME:                     strcpy(info->s, "SID6581");                  break;
125      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "SID");                     break;
126      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
127      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
128      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright The MESS Team");    break;
129129   }
130130}
131131
r3957r3958
135135   switch (state)
136136   {
137137      /* --- the following bits of info are returned as pointers to data or functions --- */
138      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sid8580 );         break;
138      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( sid8580 );      break;
139139
140140      /* --- the following bits of info are returned as NULL-terminated strings --- */
141      case SNDINFO_STR_NAME:                     info->s = "SID8580";               break;
142      default:                              SND_GET_INFO_CALL(sid6581);   break;
141      case SNDINFO_STR_NAME:                     strcpy(info->s, "SID8580");                  break;
142      default:                              SND_GET_INFO_CALL(sid6581);                  break;
143143   }
144144}
145145
src/emu/sound/flt_vol.c
r3957r3958
1111
1212
1313
14static void filter_volume_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
14static STREAM_UPDATE( filter_volume_update )
1515{
1616   stream_sample_t *src = inputs[0];
1717   stream_sample_t *dst = outputs[0];
r3957r3958
6565
6666      /* --- the following bits of info are returned as pointers to data or functions --- */
6767      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( filter_volume );   break;
68      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( filter_volume );      break;
69      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
70      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
68      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( filter_volume );         break;
69      case SNDINFO_PTR_STOP:                     /* Nothing */                                 break;
70      case SNDINFO_PTR_RESET:                     /* Nothing */                                 break;
7171
7272      /* --- the following bits of info are returned as NULL-terminated strings --- */
73      case SNDINFO_STR_NAME:                     info->s = "Volume Filter";            break;
74      case SNDINFO_STR_CORE_FAMILY:               info->s = "Filters";               break;
75      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
76      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
77      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
73      case SNDINFO_STR_NAME:                     strcpy(info->s, "Volume Filter");                  break;
74      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Filters");                        break;
75      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                           break;
76      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                        break;
77      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
7878   }
7979}
8080
src/emu/sound/5220intf.c
r3957r3958
3131
3232
3333/* static function prototypes */
34static void tms5220_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
34static STREAM_UPDATE( tms5220_update );
3535
3636
3737
r3957r3958
195195
196196***********************************************************************************************/
197197
198static void tms5220_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
198static STREAM_UPDATE( tms5220_update )
199199{
200200   struct tms5220_info *info = param;
201201   INT16 sample_data[MAX_SAMPLE_CHUNK];
202   stream_sample_t *buffer = _buffer[0];
202   stream_sample_t *buffer = outputs[0];
203203
204204   /* loop while we still have samples to generate */
205   while (length)
205   while (samples)
206206   {
207      int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
207      int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
208208      int index;
209209
210210      /* generate the samples and copy to the target buffer */
211      tms5220_process(info->chip, sample_data, samples);
212      for (index = 0; index < samples; index++)
211      tms5220_process(info->chip, sample_data, length);
212      for (index = 0; index < length; index++)
213213         *buffer++ = sample_data[index];
214214
215215      /* account for the samples */
216      length -= samples;
216      samples -= length;
217217   }
218218}
219219
r3957r3958
254254   switch (state)
255255   {
256256      /* --- the following bits of info are returned as 64-bit signed integers --- */
257      case SNDINFO_INT_ALIAS:                     info->i = SOUND_TMS5220;            break;
257      case SNDINFO_INT_ALIAS:                     info->i = SOUND_TMS5220;                  break;
258258
259259      /* --- the following bits of info are returned as pointers to data or functions --- */
260      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms5220 );      break;
261      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5220 );         break;
262      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tms5220 );            break;
263      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( tms5220 );         break;
260      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms5220 );   break;
261      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5220 );      break;
262      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tms5220 );         break;
263      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( tms5220 );      break;
264264
265265      /* --- the following bits of info are returned as NULL-terminated strings --- */
266      case SNDINFO_STR_NAME:                     info->s = "TMS5220";               break;
267      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI Speech";               break;
268      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
269      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
270      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
266      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5220");                  break;
267      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "TI Speech");               break;
268      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
269      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
270      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
271271   }
272272}
273273
r3957r3958
276276{
277277   switch (state)
278278   {
279      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5200 );         break;
280      case SNDINFO_STR_NAME:                     info->s = "TMC0285";               break;
281      default:                               SND_GET_INFO_CALL( tms5220 );   break;
279      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5200 );      break;
280      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMC0285");                  break;
281      default:                               SND_GET_INFO_CALL( tms5220 );               break;
282282   }
283283}
284284#endif
r3957r3958
288288{
289289   switch (state)
290290   {
291      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5200 );         break;
292      case SNDINFO_STR_NAME:                     info->s = "TMS5200";               break;
293      default:                               SND_GET_INFO_CALL( tms5220 );   break;
291      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5200 );      break;
292      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5200");                  break;
293      default:                               SND_GET_INFO_CALL( tms5220 );               break;
294294   }
295295}
296296#endif
src/emu/sound/2151intf.c
r3957r3958
2222};
2323
2424
25static void ym2151_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
25static STREAM_UPDATE( ym2151_update )
2626{
2727   struct ym2151_info *info = param;
28   ym2151_update_one(info->chip, buffers, length);
28   ym2151_update_one(info->chip, outputs, samples);
2929}
3030
3131
r3957r3958
230230      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2151 );            break;
231231
232232      /* --- the following bits of info are returned as NULL-terminated strings --- */
233      case SNDINFO_STR_NAME:                     info->s = "YM2151";                  break;
234      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
235      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
236      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
237      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
233      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2151");                     break;
234      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
235      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
236      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
237      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
238238   }
239239}
src/emu/sound/psx.c
r3957r3958
111111   return v;
112112}
113113
114static void PSXSPU_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
114static STREAM_UPDATE( PSXSPU_update )
115115{
116116   struct psxinfo *chip = param;
117117   int v;
r3957r3958
136136      { 122, -60 }
137137   };
138138
139   memset( buffer[ 0 ], 0, length * sizeof( *buffer[ 0 ] ));
140   memset( buffer[ 1 ], 0, length * sizeof( *buffer[ 1 ] ));
139   memset( outputs[ 0 ], 0, samples * sizeof( *outputs[ 0 ] ));
140   memset( outputs[ 1 ], 0, samples * sizeof( *outputs[ 1 ] ));
141141
142142   for( n_channel = 0; n_channel < MAX_CHANNEL; n_channel++ )
143143   {
144144      voll = volume( chip->m_p_n_volumeleft[ n_channel ] );
145145      volr = volume( chip->m_p_n_volumeright[ n_channel ] );
146146
147      for( n_sample = 0; n_sample < length; n_sample++ )
147      for( n_sample = 0; n_sample < samples; n_sample++ )
148148      {
149149         if( chip->m_p_n_blockoffset[ n_channel ] >= ( SAMPLES_PER_BLOCK << PITCH_SHIFT ) )
150150         {
r3957r3958
207207         }
208208         v = chip->m_p_n_blockbuffer[ ( n_channel * SAMPLES_PER_BLOCK ) + ( chip->m_p_n_blockoffset[ n_channel ] >> PITCH_SHIFT ) ];
209209         chip->m_p_n_blockoffset[ n_channel ] += chip->m_p_n_pitch[ n_channel ];
210         buffer[ 0 ][ n_sample ] = limit( buffer[ 0 ][ n_sample ] + ( ( v * voll ) / 0x4000 ) );
211         buffer[ 1 ][ n_sample ] = limit( buffer[ 1 ][ n_sample ] + ( ( v * volr ) / 0x4000 ) );
210         outputs[ 0 ][ n_sample ] = limit( outputs[ 0 ][ n_sample ] + ( ( v * voll ) / 0x4000 ) );
211         outputs[ 1 ][ n_sample ] = limit( outputs[ 1 ][ n_sample ] + ( ( v * volr ) / 0x4000 ) );
212212      }
213213   }
214214}
215215
216static void spu_read( UINT32 n_address, INT32 n_size )
216static void spu_read( running_machine *machine, UINT32 n_address, INT32 n_size )
217217{
218218   struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
219   running_machine *machine = chip->device->machine;
220219   verboselog( machine, 1, "spu_read( %08x, %08x )\n", n_address, n_size );
221220
222221   while( n_size > 0 )
r3957r3958
233232   }
234233}
235234
236static void spu_write( UINT32 n_address, INT32 n_size )
235static void spu_write( running_machine *machine, UINT32 n_address, INT32 n_size )
237236{
238237   struct psxinfo *chip = sndti_token(SOUND_PSXSPU, 0);
239   running_machine *machine = chip->device->machine;
240238   verboselog( machine, 1, "spu_write( %08x, %08x )\n", n_address, n_size );
241239
242240   while( n_size > 0 )
r3957r3958
686684      /* --- the following bits of info are returned as 64-bit signed integers --- */
687685
688686      /* --- the following bits of info are returned as pointers to data or functions --- */
689      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( psxspu );      break;
690      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( psxspu );            break;
691      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
692      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
687      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( psxspu );   break;
688      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( psxspu );         break;
689      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
690      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
693691
694692      /* --- the following bits of info are returned as NULL-terminated strings --- */
695      case SNDINFO_STR_NAME:                     info->s = "SPU";                  break;
696      case SNDINFO_STR_CORE_FAMILY:               info->s = "Sony custom";            break;
697      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
698      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
699      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
693      case SNDINFO_STR_NAME:                     strcpy(info->s, "SPU");                     break;
694      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Sony custom");               break;
695      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
696      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
697      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
700698   }
701699}
702700
src/emu/sound/k053260.c
r3957r3958
100100#define MAXOUT 0x7fff
101101#define MINOUT -0x8000
102102
103static void k053260_update( void * param, stream_sample_t **inputs, stream_sample_t **buffer, int length ) {
103static STREAM_UPDATE( k053260_update ) {
104104   static const long dpcmcnv[] = { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1};
105105
106106   int i, j, lvol[4], rvol[4], play[4], loop[4], ppcm_data[4], ppcm[4];
r3957r3958
126126         delta[i] /= 2;
127127   }
128128
129      for ( j = 0; j < length; j++ ) {
129      for ( j = 0; j < samples; j++ ) {
130130
131131         dataL = dataR = 0;
132132
r3957r3958
187187            }
188188         }
189189
190         buffer[1][j] = limit( dataL, MAXOUT, MINOUT );
191         buffer[0][j] = limit( dataR, MAXOUT, MINOUT );
190         outputs[1][j] = limit( dataL, MAXOUT, MINOUT );
191         outputs[0][j] = limit( dataR, MAXOUT, MINOUT );
192192      }
193193
194194   /* update the regs now */
r3957r3958
482482      /* --- the following bits of info are returned as 64-bit signed integers --- */
483483
484484      /* --- the following bits of info are returned as pointers to data or functions --- */
485      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k053260 );      break;
486      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k053260 );         break;
487      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
488      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( k053260);   break;
485      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k053260 );   break;
486      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k053260 );      break;
487      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
488      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( k053260);         break;
489489
490490      /* --- the following bits of info are returned as NULL-terminated strings --- */
491      case SNDINFO_STR_NAME:                     info->s = "K053260";               break;
492      case SNDINFO_STR_CORE_FAMILY:               info->s = "Konami custom";            break;
493      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
494      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
495      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
491      case SNDINFO_STR_NAME:                     strcpy(info->s, "K053260");                  break;
492      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Konami custom");            break;
493      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
494      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
495      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
496496   }
497497}
498498
src/emu/sound/2413intf.c
r3957r3958
3636}
3737#endif
3838
39static void ym2413_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
39static STREAM_UPDATE( ym2413_stream_update )
4040{
4141   struct ym2413_info *info = param;
42   ym2413_update_one(info->chip, buffers, length);
42   ym2413_update_one(info->chip, outputs, samples);
4343}
4444
4545static void _stream_update(void *param, int interval)
r3957r3958
177177      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2413 );            break;
178178
179179      /* --- the following bits of info are returned as NULL-terminated strings --- */
180      case SNDINFO_STR_NAME:                     info->s = "YM2413";                  break;
181      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
182      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
183      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
184      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
180      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2413");                     break;
181      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
182      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
183      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
184      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
185185   }
186186}
src/emu/sound/psx.h
r3957r3958
1616WRITE32_HANDLER( psx_spu_delay_w );
1717READ32_HANDLER( psx_spu_delay_r );
1818
19typedef void ( *spu_handler )( UINT32, INT32 );
19typedef void ( *spu_handler )( running_machine *, UINT32, INT32 );
2020
2121typedef struct _psx_spu_interface psx_spu_interface;
2222struct _psx_spu_interface
src/emu/sound/segapcm.c
r3957r3958
1616   sound_stream * stream;
1717};
1818
19static void SEGAPCM_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
19static STREAM_UPDATE( SEGAPCM_update )
2020{
2121   struct segapcm *spcm = param;
2222   int ch;
2323
2424   /* clear the buffers */
25   memset(buffer[0], 0, length*sizeof(*buffer[0]));
26   memset(buffer[1], 0, length*sizeof(*buffer[1]));
25   memset(outputs[0], 0, samples*sizeof(*outputs[0]));
26   memset(outputs[1], 0, samples*sizeof(*outputs[1]));
2727
2828   /* loop over channels */
2929   for (ch = 0; ch < 16; ch++)
r3957r3958
4343         int i;
4444
4545         /* loop over samples on this channel */
46         for (i = 0; i < length; i++)
46         for (i = 0; i < samples; i++)
4747         {
4848            INT8 v = 0;
4949
r3957r3958
6363            v = rom[addr >> 8] - 0x80;
6464
6565            /* apply panning and advance */
66            buffer[0][i] += v * voll;
67            buffer[1][i] += v * volr;
66            outputs[0][i] += v * voll;
67            outputs[1][i] += v * volr;
6868            addr += delta;
6969         }
7070
r3957r3958
146146      /* --- the following bits of info are returned as 64-bit signed integers --- */
147147
148148      /* --- the following bits of info are returned as pointers to data or functions --- */
149      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( segapcm );      break;
150      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( segapcm );         break;
151      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
152      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
149      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( segapcm );   break;
150      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( segapcm );      break;
151      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
152      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
153153
154154      /* --- the following bits of info are returned as NULL-terminated strings --- */
155      case SNDINFO_STR_NAME:                     info->s = "Sega PCM";               break;
156      case SNDINFO_STR_CORE_FAMILY:               info->s = "Sega custom";            break;
157      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
158      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
159      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
155      case SNDINFO_STR_NAME:                     strcpy(info->s, "Sega PCM");               break;
156      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Sega custom");               break;
157      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
158      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
159      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
160160   }
161161}
src/emu/sound/vrender0.c
r3957r3958
2525
2626static void VR0_RenderAudio(struct _VR0Chip *VR0, int nsamples,stream_sample_t *l,stream_sample_t *r);
2727
28static void VR0_Update(void *param, stream_sample_t **inputs, stream_sample_t **buf, int samples)
28static STREAM_UPDATE( VR0_Update )
2929{
3030   struct _VR0Chip *VR0 = param;
31   VR0_RenderAudio(VR0, samples,buf[0],buf[1]);
31   VR0_RenderAudio(VR0, samples,outputs[0],outputs[1]);
3232}
3333
3434//Correct table thanks to Evoga
r3957r3958
258258      /* --- the following bits of info are returned as 64-bit signed integers --- */
259259
260260      /* --- the following bits of info are returned as pointers to data or functions --- */
261      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vrender0 );      break;
262      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( vrender0 );         break;
263      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
264      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
261      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vrender0 );   break;
262      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( vrender0 );      break;
263      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
264      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
265265
266266      /* --- the following bits of info are returned as NULL-terminated strings --- */
267      case SNDINFO_STR_NAME:                     info->s = "VRender0";               break;
268      case SNDINFO_STR_CORE_FAMILY:               info->s = "???";                  break;
269      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
270      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
271      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
267      case SNDINFO_STR_NAME:                     strcpy(info->s, "VRender0");               break;
268      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "???");                     break;
269      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
270      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
271      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
272272   }
273273}
274274
src/emu/sound/multipcm.c
r3957r3958
413413   }
414414}
415415
416static void MultiPCM_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length )
416static STREAM_UPDATE( MultiPCM_update )
417417{
418418   struct _MultiPCM *ptChip = param;
419419   stream_sample_t  *datap[2];
420420   int i,sl;
421421
422   datap[0] = buffer[0];
423   datap[1] = buffer[1];
422   datap[0] = outputs[0];
423   datap[1] = outputs[1];
424424
425   memset(datap[0], 0, sizeof(*datap[0])*length);
426   memset(datap[1], 0, sizeof(*datap[1])*length);
425   memset(datap[0], 0, sizeof(*datap[0])*samples);
426   memset(datap[1], 0, sizeof(*datap[1])*samples);
427427
428428
429   for(i=0;i<length;++i)
429   for(i=0;i<samples;++i)
430430   {
431431      signed int smpl=0;
432432      signed int smpr=0;
r3957r3958
709709      /* --- the following bits of info are returned as 64-bit signed integers --- */
710710
711711      /* --- the following bits of info are returned as pointers to data or functions --- */
712      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( multipcm );      break;
713      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( multipcm );         break;
714      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
715      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
712      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( multipcm );   break;
713      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( multipcm );      break;
714      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
715      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
716716
717717      /* --- the following bits of info are returned as NULL-terminated strings --- */
718      case SNDINFO_STR_NAME:                     info->s = "Sega/Yamaha 315-5560";               break;
719      case SNDINFO_STR_CORE_FAMILY:               info->s = "Sega custom";            break;
720      case SNDINFO_STR_CORE_VERSION:               info->s = "2.0";                  break;
721      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
722      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
718      case SNDINFO_STR_NAME:                     strcpy(info->s, "Sega/Yamaha 315-5560");      break;
719      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Sega custom");               break;
720      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "2.0");                     break;
721      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
722      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
723723   }
724724}
725725
src/emu/sound/namco.c
r3957r3958
160160
161161
162162/* generate sound to the mix buffer in mono */
163static void namco_update_mono(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
163static STREAM_UPDATE( namco_update_mono )
164164{
165165   struct namco_sound *chip = param;
166   stream_sample_t *buffer = _buffer[0];
166   stream_sample_t *buffer = outputs[0];
167167   sound_channel *voice;
168168
169169   /* zap the contents of the buffer */
170   memset(buffer, 0, length * sizeof(*buffer));
170   memset(buffer, 0, samples * sizeof(*buffer));
171171
172172   /* if no sound, we're done */
173173   if (chip->sound_enable == 0)
r3957r3958
194194            int i;
195195
196196            /* add our contribution */
197            for (i = 0; i < length; i++)
197            for (i = 0; i < samples; i++)
198198            {
199199               int cnt;
200200
r3957r3958
235235            const INT16 *w = &chip->waveform[v][voice->waveform_select * 32];
236236
237237            /* generate sound into buffer and update the counter for this voice */
238            voice->counter = namco_update_one(chip, mix, length, w, voice->counter, voice->frequency);
238            voice->counter = namco_update_one(chip, mix, samples, w, voice->counter, voice->frequency);
239239         }
240240      }
241241   }
r3957r3958
243243
244244
245245/* generate sound to the mix buffer in stereo */
246static void namco_update_stereo(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
246static STREAM_UPDATE( namco_update_stereo )
247247{
248248   struct namco_sound *chip = param;
249249   sound_channel *voice;
250250
251251   /* zap the contents of the buffers */
252   memset(buffer[0], 0, length * sizeof(*buffer[0]));
253   memset(buffer[1], 0, length * sizeof(*buffer[1]));
252   memset(outputs[0], 0, samples * sizeof(*outputs[0]));
253   memset(outputs[1], 0, samples * sizeof(*outputs[1]));
254254
255255   /* if no sound, we're done */
256256   if (chip->sound_enable == 0)
r3957r3958
259259   /* loop over each voice and add its contribution */
260260   for (voice = chip->channel_list; voice < chip->last_channel; voice++)
261261   {
262      stream_sample_t *lmix = buffer[0];
263      stream_sample_t *rmix = buffer[1];
262      stream_sample_t *lmix = outputs[0];
263      stream_sample_t *rmix = outputs[1];
264264      int lv = voice->volume[0];
265265      int rv = voice->volume[1];
266266
r3957r3958
280280            int i;
281281
282282            /* add our contribution */
283            for (i = 0; i < length; i++)
283            for (i = 0; i < samples; i++)
284284            {
285285               int cnt;
286286
r3957r3958
333333               const INT16 *lw = &chip->waveform[lv][voice->waveform_select * 32];
334334
335335               /* generate sound into the buffer */
336               c = namco_update_one(chip, lmix, length, lw, voice->counter, voice->frequency);
336               c = namco_update_one(chip, lmix, samples, lw, voice->counter, voice->frequency);
337337            }
338338
339339            /* only update if we have non-zero right volume */
r3957r3958
342342               const INT16 *rw = &chip->waveform[rv][voice->waveform_select * 32];
343343
344344               /* generate sound into the buffer */
345               c = namco_update_one(chip, rmix, length, rw, voice->counter, voice->frequency);
345               c = namco_update_one(chip, rmix, samples, rw, voice->counter, voice->frequency);
346346            }
347347
348348            /* update the counter for this voice */
r3957r3958
820820      /* --- the following bits of info are returned as 64-bit signed integers --- */
821821
822822      /* --- the following bits of info are returned as pointers to data or functions --- */
823      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco );      break;
824      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco );            break;
825      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
826      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
823      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco );   break;
824      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco );         break;
825      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
826      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
827827
828828      /* --- the following bits of info are returned as NULL-terminated strings --- */
829      case SNDINFO_STR_NAME:                     info->s = "Namco";                  break;
830      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco custom";            break;
831      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
832      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
833      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
829      case SNDINFO_STR_NAME:                     strcpy(info->s, "Namco");                  break;
830      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco custom");            break;
831      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
832      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
833      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
834834   }
835835}
836836
r3957r3958
856856      /* --- the following bits of info are returned as pointers to data or functions --- */
857857      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_15xx );   break;
858858      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco );            break;
859      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
860      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
859      case SNDINFO_PTR_STOP:                     /* Nothing */                              break;
860      case SNDINFO_PTR_RESET:                     /* Nothing */                              break;
861861
862862      /* --- the following bits of info are returned as NULL-terminated strings --- */
863      case SNDINFO_STR_NAME:                     info->s = "Namco 15XX";               break;
864      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco custom";            break;
865      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
866      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
867      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
863      case SNDINFO_STR_NAME:                     strcpy(info->s, "Namco 15XX");                  break;
864      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco custom");               break;
865      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
866      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
867      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
868868   }
869869}
870870
r3957r3958
890890      /* --- the following bits of info are returned as pointers to data or functions --- */
891891      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( namco_cus30 );   break;
892892      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( namco );            break;
893      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
894      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
893      case SNDINFO_PTR_STOP:                     /* Nothing */                              break;
894      case SNDINFO_PTR_RESET:                     /* Nothing */                              break;
895895
896896      /* --- the following bits of info are returned as NULL-terminated strings --- */
897      case SNDINFO_STR_NAME:                     info->s = "Namco CUS30";            break;
898      case SNDINFO_STR_CORE_FAMILY:               info->s = "Namco custom";            break;
899      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
900      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
901      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
897      case SNDINFO_STR_NAME:                     strcpy(info->s, "Namco CUS30");                  break;
898      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Namco custom");               break;
899      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
900      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
901      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
902902   }
903903}
904904
src/emu/sound/sn76477.c
r3957r3958
19591959 *
19601960 *****************************************************************************/
19611961
1962static void SN76477_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
1962static STREAM_UPDATE( SN76477_update )
19631963{
19641964   double one_shot_cap_charging_step;
19651965   double one_shot_cap_discharging_step;
r3957r3958
19791979   double center_to_peak_voltage_out;
19801980
19811981   struct SN76477 *sn = param;
1982   stream_sample_t *buffer = _buffer[0];
1982   stream_sample_t *buffer = outputs[0];
19831983
19841984
19851985#if TEST_MODE
r3957r3958
20172017   center_to_peak_voltage_out = compute_center_to_peak_voltage_out(sn);
20182018
20192019
2020   /* process 'length' number of samples */
2021   while (length--)
2020   /* process 'samples' number of samples */
2021   while (samples--)
20222022   {
20232023      /* update the one-shot cap voltage */
20242024      if (!sn->one_shot_cap_voltage_ext)
r3957r3958
24762476   {
24772477   case SNDINFO_PTR_START:         info->start = SND_START_NAME( sn76477 ); break;
24782478   case SNDINFO_PTR_STOP:         info->stop = SND_STOP_NAME( sn76477 ); break;
2479   case SNDINFO_STR_NAME:         info->s = "SN76477"; break;
2480   case SNDINFO_STR_CORE_FAMILY:   info->s = "Analog"; break;
2481   case SNDINFO_STR_CORE_VERSION:   info->s = "2.1"; break;
2482   case SNDINFO_STR_CORE_FILE:      info->s = __FILE__; break;
2483   case SNDINFO_STR_CORE_CREDITS:   info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
2479   case SNDINFO_STR_NAME:         strcpy(info->s, "SN76477"); break;
2480   case SNDINFO_STR_CORE_FAMILY:   strcpy(info->s, "Analog"); break;
2481   case SNDINFO_STR_CORE_VERSION:   strcpy(info->s, "2.1"); break;
2482   case SNDINFO_STR_CORE_FILE:      strcpy(info->s, __FILE__); break;
2483   case SNDINFO_STR_CORE_CREDITS:   strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
24842484   }
24852485}
24862486
src/emu/sound/vlm5030.c
r3957r3958
287287}
288288
289289/* decode and buffering data */
290static void vlm5030_update_callback(void *param,stream_sample_t **inputs, stream_sample_t **_buffer, int length)
290static STREAM_UPDATE( vlm5030_update_callback )
291291{
292292   struct vlm5030_info *chip = param;
293293   int buf_count=0;
294294   int interp_effect;
295295   int i;
296296   int u[11];
297   stream_sample_t *buffer = _buffer[0];
297   stream_sample_t *buffer = outputs[0];
298298
299299   /* running */
300300   if( chip->phase == PH_RUN || chip->phase == PH_STOP )
301301   {
302302      /* playing speech */
303      while (length > 0)
303      while (samples > 0)
304304      {
305305         int current_val;
306306
r3957r3958
401401         if (chip->pitch_count >= chip->current_pitch )
402402            chip->pitch_count = 0;
403403         /* size */
404         length--;
404         samples--;
405405      }
406406/*      return;*/
407407   }
r3957r3958
410410   switch( chip->phase )
411411   {
412412   case PH_SETUP:
413      if( chip->sample_count <= length)
413      if( chip->sample_count <= samples)
414414      {
415415         chip->sample_count = 0;
416416         /* logerror("VLM5030 BSY=H\n" ); */
r3957r3958
419419      }
420420      else
421421      {
422         chip->sample_count -= length;
422         chip->sample_count -= samples;
423423      }
424424      break;
425425   case PH_END:
426      if( chip->sample_count <= length)
426      if( chip->sample_count <= samples)
427427      {
428428         chip->sample_count = 0;
429429         /* logerror("VLM5030 BSY=L\n" ); */
r3957r3958
432432      }
433433      else
434434      {
435         chip->sample_count -= length;
435         chip->sample_count -= samples;
436436      }
437437   }
438438   /* silent buffering */
439   while (length > 0)
439   while (samples > 0)
440440   {
441441      buffer[buf_count++] = 0x00;
442      length--;
442      samples--;
443443   }
444444}
445445
r3957r3958
714714      /* --- the following bits of info are returned as 64-bit signed integers --- */
715715
716716      /* --- the following bits of info are returned as pointers to data or functions --- */
717      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vlm5030 );      break;
718      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( vlm5030 );         break;
719      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
720      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( vlm5030 );break;
717      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( vlm5030 );   break;
718      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( vlm5030 );      break;
719      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
720      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( vlm5030 );      break;
721721
722722      /* --- the following bits of info are returned as NULL-terminated strings --- */
723      case SNDINFO_STR_NAME:                     info->s = "VLM5030";               break;
724      case SNDINFO_STR_CORE_FAMILY:               info->s = "VLM speech";               break;
725      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
726      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
727      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
723      case SNDINFO_STR_NAME:                     strcpy(info->s, "VLM5030");                  break;
724      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "VLM speech");               break;
725      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
726      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
727      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
728728   }
729729}
730730
src/emu/sound/5110intf.c
r3957r3958
3333
3434
3535/* static function prototypes */
36static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
36static STREAM_UPDATE( tms5110_update );
3737
38static int speech_rom_read_bit(void)
38static int speech_rom_read_bit(const device_config *device)
3939{
4040   struct tms5110_info *info = sndti_token(SOUND_TMS5110, 0);
4141
r3957r3958
242242
243243******************************************************************************/
244244
245static void tms5110_update(void *param, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
245static STREAM_UPDATE( tms5110_update )
246246{
247247   struct tms5110_info *info = param;
248248   INT16 sample_data[MAX_SAMPLE_CHUNK];
249   stream_sample_t *buffer = _buffer[0];
249   stream_sample_t *buffer = outputs[0];
250250
251251   /* loop while we still have samples to generate */
252   while (length)
252   while (samples)
253253   {
254      int samples = (length > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : length;
254      int length = (samples > MAX_SAMPLE_CHUNK) ? MAX_SAMPLE_CHUNK : samples;
255255      int index;
256256
257257      /* generate the samples and copy to the target buffer */
258      tms5110_process(info->chip, sample_data, samples);
259      for (index = 0; index < samples; index++)
258      tms5110_process(info->chip, sample_data, length);
259      for (index = 0; index < length; index++)
260260         *buffer++ = sample_data[index];
261261
262262      /* account for the samples */
263      length -= samples;
263      samples -= length;
264264   }
265265}
266266
r3957r3958
298298   switch (state)
299299   {
300300      /* --- the following bits of info are returned as 64-bit signed integers --- */
301      case SNDINFO_INT_ALIAS:                     info->i = SOUND_TMS5110;            break;
301      case SNDINFO_INT_ALIAS:                     info->i = SOUND_TMS5110;                  break;
302302
303303      /* --- the following bits of info are returned as pointers to data or functions --- */
304      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms5110 );      break;
305      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5110 );         break;
306      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tms5110 );            break;
307      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( tms5110 );         break;
304      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( tms5110 );   break;
305      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5110 );      break;
306      case SNDINFO_PTR_STOP:                     info->stop = SND_STOP_NAME( tms5110 );         break;
307      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( tms5110 );      break;
308308
309309      /* --- the following bits of info are returned as NULL-terminated strings --- */
310      case SNDINFO_STR_NAME:                     info->s = "TMS5110";               break;
311      case SNDINFO_STR_CORE_FAMILY:               info->s = "TI Speech";               break;
312      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
313      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
314      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
310      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5110");                  break;
311      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "TI Speech");               break;
312      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
313      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
314      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
315315   }
316316}
317317
r3957r3958
319319{
320320   switch (state)
321321   {
322      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5100 );         break;
323      case SNDINFO_STR_NAME:                     info->s = "TMS5100";               break;
324      default:                               SND_GET_INFO_CALL(tms5110);   break;
322      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5100 );      break;
323      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5100");                  break;
324      default:                               SND_GET_INFO_CALL(tms5110);                  break;
325325   }
326326}
327327
r3957r3958
329329{
330330   switch (state)
331331   {
332      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5110a );         break;
333      case SNDINFO_STR_NAME:                     info->s = "TMS5100A";               break;
334      default:                               SND_GET_INFO_CALL(tms5110);   break;
332      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tms5110a );      break;
333      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5100A");               break;
334      default:                               SND_GET_INFO_CALL(tms5110);                  break;
335335   }
336336}
337337
r3957r3958
339339{
340340   switch (state)
341341   {
342      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cd2801 );            break;
343      case SNDINFO_STR_NAME:                     info->s = "CD2801";                  break;
344      default:                               SND_GET_INFO_CALL(tms5110);   break;
342      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cd2801 );         break;
343      case SNDINFO_STR_NAME:                     strcpy(info->s, "CD2801");                  break;
344      default:                               SND_GET_INFO_CALL(tms5110);                  break;
345345   }
346346}
347347
r3957r3958
349349{
350350   switch (state)
351351   {
352      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tmc0281 );         break;
353      case SNDINFO_STR_NAME:                     info->s = "TMS5100";               break;
354      default:                               SND_GET_INFO_CALL(tms5110);   break;
352      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( tmc0281 );      break;
353      case SNDINFO_STR_NAME:                     strcpy(info->s, "TMS5100");                  break;
354      default:                               SND_GET_INFO_CALL(tms5110);                  break;
355355   }
356356}
357357
r3957r3958
359359{
360360   switch (state)
361361   {
362      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cd2802 );            break;
363      case SNDINFO_STR_NAME:                     info->s = "CD2802";                  break;
364      default:                               SND_GET_INFO_CALL(tms5110);   break;
362      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( cd2802 );         break;
363      case SNDINFO_STR_NAME:                     strcpy(info->s, "CD2802");                  break;
364      default:                               SND_GET_INFO_CALL(tms5110);                  break;
365365   }
366366}
367367
r3957r3958
369369{
370370   switch (state)
371371   {
372      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( m58817 );            break;
373      case SNDINFO_STR_NAME:                     info->s = "M58817";                  break;
374      default:                               SND_GET_INFO_CALL(tms5110);   break;
372      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( m58817 );         break;
373      case SNDINFO_STR_NAME:                     strcpy(info->s, "M58817");                  break;
374      default:                               SND_GET_INFO_CALL(tms5110);                  break;
375375   }
376376}
377377
src/emu/sound/2203intf.c
r3957r3958
9191   }
9292}
9393
94static void ym2203_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
94static STREAM_UPDATE( ym2203_stream_update )
9595{
9696   struct ym2203_info *info = param;
97   ym2203_update_one(info->chip, buffer[0], length);
97   ym2203_update_one(info->chip, outputs[0], samples);
9898}
9999
100100
r3957r3958
349349      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ym2203 );            break;
350350
351351      /* --- the following bits of info are returned as NULL-terminated strings --- */
352      case SNDINFO_STR_NAME:                     info->s = "YM2203";                  break;
353      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
354      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
355      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
356      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
352      case SNDINFO_STR_NAME:                     strcpy(info->s, "YM2203");                     break;
353      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
354      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
355      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
356      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
357357   }
358358}
src/emu/sound/k007232.c
r3957r3958
216216/*    Konami PCM update                         */
217217/************************************************/
218218
219static void KDAC_A_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int buffer_len)
219static STREAM_UPDATE( KDAC_A_update )
220220{
221221  struct kdacApcm *info = param;
222222  int i;
223223
224  memset(buffer[0],0,buffer_len * sizeof(*buffer[0]));
225  memset(buffer[1],0,buffer_len * sizeof(*buffer[1]));
224  memset(outputs[0],0,samples * sizeof(*outputs[0]));
225  memset(outputs[1],0,samples * sizeof(*outputs[1]));
226226
227227  for( i = 0; i < KDAC_A_PCM_MAX; i++ )
228228    {
r3957r3958
242242     volB = (volB + cen) < 0x1fe ? (volB + cen) : 0x1fe;
243243#endif
244244
245     for( j = 0; j < buffer_len; j++ )
245     for( j = 0; j < samples; j++ )
246246       {
247247         old_addr = addr;
248248         addr = info->start[i] + ((info->addr[i]>>BASE_SHIFT)&0x000fffff);
r3957r3958
282282
283283         out = (info->pcmbuf[i][addr] & 0x7f) - 0x40;
284284
285         buffer[0][j] += out * volA;
286         buffer[1][j] += out * volB;
285         outputs[0][j] += out * volA;
286         outputs[1][j] += out * volB;
287287       }
288288   }
289289    }
r3957r3958
494494      /* --- the following bits of info are returned as 64-bit signed integers --- */
495495
496496      /* --- the following bits of info are returned as pointers to data or functions --- */
497      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k007232 );      break;
498      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k007232 );         break;
499      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
500      case SNDINFO_PTR_RESET:                     /* nothing */                     break;
497      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( k007232 );   break;
498      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( k007232 );      break;
499      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
500      case SNDINFO_PTR_RESET:                     /* nothing */                           break;
501501
502502      /* --- the following bits of info are returned as NULL-terminated strings --- */
503      case SNDINFO_STR_NAME:                     info->s = "K007232";               break;
504      case SNDINFO_STR_CORE_FAMILY:               info->s = "Konami custom";            break;
505      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
506      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
507      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
503      case SNDINFO_STR_NAME:                     strcpy(info->s, "K007232");                  break;
504      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Konami custom");            break;
505      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
506      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
507      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
508508   }
509509}
510510
src/emu/sound/5110intf.h
r3957r3958
1010typedef struct _tms5110_interface tms5110_interface;
1111struct _tms5110_interface
1212{
13   int (*M0_callback)(void);   /* function to be called when chip requests another bit */
13   int (*M0_callback)(const device_config *device);   /* function to be called when chip requests another bit */
1414   void (*load_address)(int addr);   /* speech ROM load address callback */
1515};
1616
src/emu/sound/okim6258.c
r3957r3958
120120
121121***********************************************************************************************/
122122
123static void okim6258_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
123static STREAM_UPDATE( okim6258_update )
124124{
125125   struct okim6258 *chip = param;
126126   stream_sample_t *buffer = outputs[0];
r3957r3958
478478
479479      /* --- the following bits of info are returned as pointers to data or functions --- */
480480      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME(okim6258); break;
481      case SNDINFO_PTR_START:                     info->start = SND_START_NAME(okim6258);   break;
482      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
483      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME(okim6258);   break;
481      case SNDINFO_PTR_START:                     info->start = SND_START_NAME(okim6258);      break;
482      case SNDINFO_PTR_STOP:                     /* nothing */                        break;
483      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME(okim6258);      break;
484484
485485      /* --- the following bits of info are returned as NULL-terminated strings --- */
486      case SNDINFO_STR_NAME:                     info->s = "OKI6258";               break;
487      case SNDINFO_STR_CORE_FAMILY:               info->s = "OKI ADPCM";               break;
488      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
489      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
490      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
486      case SNDINFO_STR_NAME:                     strcpy(info->s, "OKI6258");               break;
487      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "OKI ADPCM");            break;
488      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
489      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
490      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
491491   }
492492}
493493
src/emu/sound/es5503.c
r3957r3958
141141   stream_update(chip->stream);
142142}
143143
144static void es5503_pcm_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
144static STREAM_UPDATE( es5503_pcm_update )
145145{
146146   INT32 mix[48000*2];
147147   INT32 *mixp;
r3957r3958
169169         int resshift = resshifts[pOsc->resolution] - pOsc->wavetblsize;
170170         UINT32 sizemask = accmasks[pOsc->wavetblsize];
171171
172         for (snum = 0; snum < length; snum++)
172         for (snum = 0; snum < samples; snum++)
173173         {
174174            ramptr = (acc >> resshift) & sizemask;
175175            altram = acc >> resshift;
r3957r3958
216216   }
217217
218218   mixp = &mix[0];
219   for (i = 0; i < length; i++)
219   for (i = 0; i < samples; i++)
220220   {
221221      outputs[0][i] = (*mixp++)>>1;
222222      outputs[1][i] = (*mixp++)>>1;
r3957r3958
534534      /* --- the following bits of info are returned as 64-bit signed integers --- */
535535
536536      /* --- the following bits of info are returned as pointers to data or functions --- */
537      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es5503 );      break;
538      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( es5503 );            break;
539      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
540      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
537      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es5503 );   break;
538      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( es5503 );         break;
539      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
540      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
541541
542542      /* --- the following bits of info are returned as NULL-terminated strings --- */
543      case SNDINFO_STR_NAME:                     info->s = "ES5503";                  break;
544      case SNDINFO_STR_CORE_FAMILY:               info->s = "Ensoniq ES550x";               break;
545      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
546      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
547      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright R. Belmont"; break;
543      case SNDINFO_STR_NAME:                     strcpy(info->s, "ES5503");                  break;
544      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Ensoniq ES550x");            break;
545      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
546      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
547      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright R. Belmont");       break;
548548   }
549549}
550550
src/emu/sound/nile.c
r3957r3958
131131//  printf("v%02d: %04x to reg %02d (PC=%x)\n", v, nile_sound_regs[offset], r, cpu_get_pc(space->cpu));
132132}
133133
134static void nile_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int length)
134static STREAM_UPDATE( nile_update )
135135{
136136   struct nile_info *info = param;
137137   UINT8 *sound_ram = info->sound_ram;
r3957r3958
144144
145145   lsptr=leptr=0;
146146
147   memset(mix, 0, sizeof(mix[0])*length*2);
147   memset(mix, 0, sizeof(mix[0])*samples*2);
148148
149149   for (v = 0; v < NILE_VOICES; v++)
150150   {
r3957r3958
161161         lsptr = slot[NILE_REG_LSPTR_HI]<<16 | slot[NILE_REG_LSPTR_LO];
162162         leptr = slot[NILE_REG_LEPTR_HI]<<16 | slot[NILE_REG_LEPTR_LO];
163163
164         for (snum = 0; snum < length; snum++)
164         for (snum = 0; snum < samples; snum++)
165165         {
166166            sample = sound_ram[sptr + info->vpos[v]]<<8;
167167
r3957r3958
209209      }
210210   }
211211   mixp = &mix[0];
212   for (i = 0; i < length; i++)
212   for (i = 0; i < samples; i++)
213213   {
214214      outputs[0][i] = (*mixp++)>>4;
215215      outputs[1][i] = (*mixp++)>>4;
r3957r3958
252252      /* --- the following bits of info are returned as 64-bit signed integers --- */
253253
254254      /* --- the following bits of info are returned as pointers to data or functions --- */
255      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nile );      break;
256      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( nile );            break;
257      case SNDINFO_PTR_STOP:                     /* Nothing */                     break;
258      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
255      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nile );   break;
256      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( nile );      break;
257      case SNDINFO_PTR_STOP:                     /* Nothing */                        break;
258      case SNDINFO_PTR_RESET:                     /* Nothing */                        break;
259259
260260      /* --- the following bits of info are returned as NULL-terminated strings --- */
261      case SNDINFO_STR_NAME:                     info->s = "NiLe";                  break;
262      case SNDINFO_STR_CORE_FAMILY:               info->s = "Seta custom";            break;
263      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
264      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
265      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
261      case SNDINFO_STR_NAME:                     strcpy(info->s, "NiLe");               break;
262      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Seta custom");            break;
263      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                  break;
264      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);               break;
265      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
266266   }
267267}
268268
src/emu/sound/es8712.c
r3957r3958
165165
166166***********************************************************************************************/
167167
168static void es8712_update(void *param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
168static STREAM_UPDATE( es8712_update )
169169{
170170   stream_sample_t *buffer = outputs[0];
171171   struct es8712 *chip = param;
r3957r3958
452452      /* --- the following bits of info are returned as 64-bit signed integers --- */
453453
454454      /* --- the following bits of info are returned as pointers to data or functions --- */
455      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es8712 );      break;
456      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( es8712 );            break;
457      case SNDINFO_PTR_STOP:                     /* nothing */                     break;
458      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( es8712 );            break;
455      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( es8712 );   break;
456      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( es8712 );         break;
457      case SNDINFO_PTR_STOP:                     /* nothing */                           break;
458      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( es8712 );         break;
459459
460460      /* --- the following bits of info are returned as NULL-terminated strings --- */
461      case SNDINFO_STR_NAME:                     info->s = "ES8712";                  break;
462      case SNDINFO_STR_CORE_FAMILY:               info->s = "Excellent Systems ADPCM";         break;
463      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
464      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
465      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
461      case SNDINFO_STR_NAME:                     strcpy(info->s, "ES8712");                  break;
462      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Excellent Systems ADPCM");      break;
463      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
464      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                  break;
465      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
466466   }
467467}
468468
src/emu/sound/nes_apu.c
r3957r3958
4848#include "cpuexec.h"
4949#include "streams.h"
5050#include "nes_apu.h"
51#include "driver.h"
5152#include "cpu/m6502/m6502.h"
5253
5354#include "nes_defs.h"
r3957r3958
659660WRITE8_HANDLER( nes_psg_1_w ) {apu_write(1,offset,data);}
660661
661662/* UPDATE APU SYSTEM */
662static void nes_psg_update_sound(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
663static STREAM_UPDATE( nes_psg_update_sound )
663664{
664665  struct nesapu_info *info = param;
665  apu_update(info, buffer[0], length);
666  apu_update(info, outputs[0], samples);
666667}
667668
668669
r3957r3958
775776      /* --- the following bits of info are returned as 64-bit signed integers --- */
776777
777778      /* --- the following bits of info are returned as pointers to data or functions --- */
778      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nesapu );       break;
779      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( nesapu );      break;
780      case SNDINFO_PTR_STOP:                     /* Nothing */            break;
781      case SNDINFO_PTR_RESET:                     /* Nothing */            break;
779      case SNDINFO_PTR_SET_INFO:                  info->set_info = SND_SET_INFO_NAME( nesapu );   break;
780      case SNDINFO_PTR_START:                     info->start = SND_START_NAME( nesapu );         break;
781      case SNDINFO_PTR_STOP:                     /* Nothing */                           break;
782      case SNDINFO_PTR_RESET:                     /* Nothing */                           break;
782783
783784      /* --- the following bits of info are returned as NULL-terminated strings --- */
784      case SNDINFO_STR_NAME:                  info->s = "N2A03";            break;
785      case SNDINFO_STR_CORE_FAMILY:               info->s = "Nintendo custom";         break;
786      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";            break;
787      case SNDINFO_STR_CORE_FILE:               info->s = __FILE__;                  break;
788      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team";  break;
785      case SNDINFO_STR_NAME:                     strcpy(info->s, "N2A03");                  break;
786      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Nintendo custom");            break;
787      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                     break;
788      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
789      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team");  break;
789790   }
790791}
791792
src/emu/sound/262intf.c
r3957r3958
5454   }
5555}
5656
57static void ymf262_stream_update(void *param, stream_sample_t **inputs, stream_sample_t **buffers, int length)
57static STREAM_UPDATE( ymf262_stream_update )
5858{
5959   struct ymf262_info *info = param;
60   ymf262_update_one(info->chip, buffers, length);
60   ymf262_update_one(info->chip, outputs, samples);
6161}
6262
6363static void _stream_update(void *param, int interval)
r3957r3958
181181      case SNDINFO_PTR_RESET:                     info->reset = SND_RESET_NAME( ymf262 );            break;
182182
183183      /* --- the following bits of info are returned as NULL-terminated strings --- */
184      case SNDINFO_STR_NAME:                     info->s = "YMF262";                  break;
185      case SNDINFO_STR_CORE_FAMILY:               info->s = "Yamaha FM";               break;
186      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
187      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
188      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
184      case SNDINFO_STR_NAME:                     strcpy(info->s, "YMF262");                     break;
185      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Yamaha FM");                  break;
186      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");                        break;
187      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);                     break;
188      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
189189   }
190190}
191191
src/emu/ui.c
r3957r3958
983983astring *game_info_astring(running_machine *machine, astring *string)
984984{
985985   int scrcount = video_screen_count(machine->config);
986   int cpunum, sndnum;
986   const device_config *scandevice;
987   const device_config *device;
988   int sndnum;
987989   int count;
988990
989991   /* print description, manufacturer, and CPU: */
990992   astring_printf(string, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer);
991993
992994   /* loop over all CPUs */
993   for (cpunum = 0; cpunum < MAX_CPU && machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum += count)
995   for (device = machine->cpu[0]; device != NULL; device = scandevice)
994996   {
995      cpu_type type = machine->config->cpu[cpunum].type;
996      int clock = machine->config->cpu[cpunum].clock;
997
998997      /* count how many identical CPUs we have */
999      for (count = 1; cpunum + count < MAX_CPU; count++)
1000         if (machine->config->cpu[cpunum + count].type != type ||
1001              machine->config->cpu[cpunum + count].clock != clock)
1002             break;
998      count = 1;
999      for (scandevice = device->typenext; scandevice != NULL; scandevice = scandevice->typenext)
1000      {
1001         if (cpu_get_type(device) != cpu_get_type(scandevice) || device->clock != scandevice->clock)
1002            break;
1003         count++;
1004      }
10031005
10041006      /* if more than one, prepend a #x in front of the CPU name */
10051007      if (count > 1)
10061008         astring_catprintf(string, "%d" UTF8_MULTIPLY, count);
1007      astring_catc(string, cputype_get_name(type));
1009      astring_catc(string, cpu_get_name(device));
10081010
10091011      /* display clock in kHz or MHz */
1010      if (clock >= 1000000)
1011         astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
1012      if (device->clock >= 1000000)
1013         astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", device->clock / 1000000, device->clock % 1000000);
10121014      else
1013         astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
1015         astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", device->clock / 1000, device->clock % 1000);
10141016   }
10151017
10161018   /* loop over all sound chips */
src/emu/debugger.c
r3957r3958
2222
2323
2424/***************************************************************************
25    TYPE DEFINITIONS
26***************************************************************************/
27
28typedef struct _machine_entry machine_entry;
29struct _machine_entry
30{
31   machine_entry *      next;
32   running_machine *   machine;
33};
34
35
36
37/***************************************************************************
38    GLOBAL VARIABLES
39***************************************************************************/
40
41static machine_entry *machine_list;
42static int atexit_registered;
43
44
45
46/***************************************************************************
2547    FUNCTION PROTOTYPES
2648***************************************************************************/
2749
28static void debugger_flush_traces(void);
50static void debugger_exit(running_machine *machine);
2951
3052
3153
r3957r3958
4264   /* only if debugging is enabled */
4365   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
4466   {
67      machine_entry *entry;
68
69      /* initialize the submodules */
4570      debug_cpu_init(machine);
4671      debug_command_init(machine);
4772      debug_console_init(machine);
4873      debug_view_init(machine);
4974      debug_comment_init(machine);
50      atexit(debugger_flush_traces);
75
76      /* allocate a new entry for our global list */
77      add_exit_callback(machine, debugger_exit);
78      entry = malloc_or_die(sizeof(*entry));
79      entry->next = machine_list;
80      entry->machine = machine;
81      machine_list = entry;
82
83      /* register an atexit handler if we haven't yet */
84      if (!atexit_registered)
85         atexit(debugger_flush_all_traces_on_abnormal_exit);
86      atexit_registered = TRUE;
87
88      /* listen in on the errorlog */
5189      add_logerror_callback(machine, debug_errorlog_write_line);
5290   }
5391}
r3957r3958
65103
66104
67105/*-------------------------------------------------
68    debugger_flush_traces - flush any traces in
69    the event of an aborted execution
106    debugger_exit - remove ourself from the
107    global list of active machines for cleanup
70108-------------------------------------------------*/
71109
72static void debugger_flush_traces(void)
110static void debugger_exit(running_machine *machine)
73111{
74   extern running_machine *Machine;
75   if (Machine != NULL)
76      debug_cpu_flush_traces(Machine);
112   machine_entry **entryptr;
113
114   /* remove this machine from the list; it came down cleanly */
115   for (entryptr = &machine_list; *entryptr != NULL; entryptr = &(*entryptr)->next)
116      if ((*entryptr)->machine == machine)
117      {
118         machine_entry *deleteme = *entryptr;
119         *entryptr = deleteme->next;
120         free(deleteme);
121         break;
122      }
77123}
124
125
126/*-------------------------------------------------
127    debugger_flush_all_traces_on_abnormal_exit -
128    flush any traces in the event of an aborted
129    execution
130-------------------------------------------------*/
131
132void debugger_flush_all_traces_on_abnormal_exit(void)
133{
134   /* clear out the machine list and flush traces on each one */
135   while (machine_list != NULL)
136   {
137      machine_entry *deleteme = machine_list;
138      debug_cpu_flush_traces(deleteme->machine);
139      machine_list = deleteme->next;
140      free(deleteme);
141   }
142}
src/emu/sndintrf.c
r3957r3958
578578
579579static DEVICE_GET_INFO( sndclass )
580580{
581   sndintrf_data *snddata = device->classtoken;
581   sndintrf_data *snddata = device->inline_config;
582582   (*snddata->intf.get_info)(device, state, (sndinfo *)info);
583583}
584584
r3957r3958
595595   info->device->static_config = config;
596596   info->device->region = memory_region(info->device->machine, info->device->tag);
597597   info->device->regionbytes = memory_region_length(info->device->machine, info->device->tag);
598   info->device->classtoken = info;
599598
599   /* hack: stash the info pointer in the inline_config */
600   info->device->inline_config = info;
601
600602   /* fill in the type and interface */
601603   info->intf = snd_type_header[sndtype];
602604   info->tag = tag;
r3957r3958
754756
755757const char *sndnum_get_info_string(int sndnum, UINT32 state)
756758{
759   extern char *get_temp_string_buffer(void);
757760   sndinfo info;
758761
759762   VERIFY_SNDNUM(sndnum_get_info_string);
760   info.s = NULL;
763   info.s = get_temp_string_buffer();
761764   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
762765   return info.s;
763766}
r3957r3958
863866
864867const char *sndti_get_info_string(sound_type sndtype, int sndindex, UINT32 state)
865868{
869   extern char *get_temp_string_buffer(void);
866870   sndinfo info;
867871   int sndnum;
868872
869873   VERIFY_SNDTI(sndti_get_info_string);
870874   sndnum = sound_matrix[sndtype][sndindex] - 1;
871   info.s = NULL;
875   info.s = get_temp_string_buffer();
872876   (*sound[sndnum].intf.get_info)(sound[sndnum].device, state, &info);
873877   return info.s;
874878}
r3957r3958
987991
988992const char *sndtype_get_info_string(sound_type sndtype, UINT32 state)
989993{
994   extern char *get_temp_string_buffer(void);
990995   snd_class_header *classheader = &snd_type_header[sndtype];
991996   sndinfo info;
992997
993998   VERIFY_SNDTYPE(sndtype_get_info_string);
994   info.s = NULL;
999   info.s = get_temp_string_buffer();
9951000   (*classheader->get_info)(NULL, state, &info);
9961001   return info.s;
9971002}
r3957r3958
10311036      case SNDINFO_PTR_RESET:                     /* Nothing */                     break;
10321037
10331038      /* --- the following bits of info are returned as NULL-terminated strings --- */
1034      case SNDINFO_STR_NAME:                     info->s = "Dummy";                  break;
1035      case SNDINFO_STR_CORE_FAMILY:               info->s = "Dummy";                  break;
1036      case SNDINFO_STR_CORE_VERSION:               info->s = "1.0";                  break;
1037      case SNDINFO_STR_CORE_FILE:                  info->s = __FILE__;                  break;
1038      case SNDINFO_STR_CORE_CREDITS:               info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1039      case SNDINFO_STR_NAME:                     strcpy(info->s, "Dummy");            break;
1040      case SNDINFO_STR_CORE_FAMILY:               strcpy(info->s, "Dummy");            break;
1041      case SNDINFO_STR_CORE_VERSION:               strcpy(info->s, "1.0");               break;
1042      case SNDINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
1043      case SNDINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
10391044   }
10401045}
src/emu/sound.c
r3957r3958
118118static TIMER_CALLBACK( sound_update );
119119static void start_sound_chips(running_machine *machine);
120120static void route_sound(running_machine *machine);
121static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length);
121static STREAM_UPDATE( mixer_update );
122122static STATE_POSTLOAD( mixer_postload );
123123
124124
r3957r3958
770770    mixer_update - mix all inputs to one output
771771-------------------------------------------------*/
772772
773static void mixer_update(void *param, stream_sample_t **inputs, stream_sample_t **buffer, int length)
773static STREAM_UPDATE( mixer_update )
774774{
775775   speaker_info *speaker = param;
776776   int numinputs = speaker->inputs;
777777   int pos;
778778
779   VPRINTF(("Mixer_update(%d)\n", length));
779   VPRINTF(("Mixer_update(%d)\n", samples));
780780
781781   /* loop over samples */
782   for (pos = 0; pos < length; pos++)
782   for (pos = 0; pos < samples; pos++)
783783   {
784784      INT32 sample = inputs[0][pos];
785785      int inp;
r3957r3958
787787      /* add up all the inputs */
788788      for (inp = 1; inp < numinputs; inp++)
789789         sample += inputs[inp][pos];
790      buffer[0][pos] = sample;
790      outputs[0][pos] = sample;
791791   }
792792}
793793
r3957r3958
878878      case DEVINFO_FCT_RESET:                     /* Nothing */                     break;
879879
880880      /* --- the following bits of info are returned as NULL-terminated strings --- */
881      case DEVINFO_STR_NAME:                     info->s = "Speaker";               break;
882      case DEVINFO_STR_FAMILY:                  info->s = "Sound";                  break;
883      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
884      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
885      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
881      case DEVINFO_STR_NAME:                     strcpy(info->s, "Speaker");            break;
882      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Sound");            break;
883      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");               break;
884      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);            break;
885      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
886886   }
887887}
888888
src/emu/debugger.h
r3957r3958
3030/* redraw the current video display */
3131void debugger_refresh_display(running_machine *machine);
3232
33/* OSD can call this to safely flush all traces in the event of a crash */
34void debugger_flush_all_traces_on_abnormal_exit(void);
3335
3436
37
3538/***************************************************************************
3639    CPU CORE INLINE FUNCTIONS
3740***************************************************************************/
src/emu/sndintrf.h
r3957r3958
235235   INT64   i;                                 /* generic integers */
236236   void *   p;                                 /* generic pointers */
237237   genf *  f;                                 /* generic function pointers */
238   const char *s;                              /* generic strings */
238   char *   s;                                 /* generic strings */
239239
240240   snd_set_info_func   set_info;                  /* SNDINFO_PTR_SET_INFO */
241241   snd_start_func      start;                     /* SNDINFO_PTR_START */
src/emu/clifront.c
r3957r3958
337337{
338338   /* since print_mame_xml expands the machine driver, we need to set things up */
339339   init_resource_tracking();
340   cpuintrf_init(NULL);
341340   sndintrf_init(NULL);
342341
343342   print_mame_xml(stdout, drivers, gamename);
r3957r3958
559558
560559   /* since we expand the machine driver, we need to set things up */
561560   init_resource_tracking();
562   cpuintrf_init(NULL);
563561   sndintrf_init(NULL);
564562
565563   /* iterate over drivers */
src/emu/timer.c
r3957r3958
12901290      case DEVINFO_FCT_RESET:               /* Nothing */                     break;
12911291
12921292      /* --- the following bits of info are returned as NULL-terminated strings --- */
1293      case DEVINFO_STR_NAME:               info->s = "Generic";               break;
1294      case DEVINFO_STR_FAMILY:            info->s = "Timer";                  break;
1295      case DEVINFO_STR_VERSION:            info->s = "1.0";                  break;
1296      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
1297      case DEVINFO_STR_CREDITS:            info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
1293      case DEVINFO_STR_NAME:               strcpy(info->s, "Generic");            break;
1294      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Timer");            break;
1295      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");               break;
1296      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
1297      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
12981298   }
12991299}
src/emu/mconfig.c
r3957r3958
2323    FUNCTION PROTOTYPES
2424***************************************************************************/
2525
26static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const char *tagprefix, int depth);
26static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const device_config *owner, int depth);
2727
2828
2929
r3957r3958
5858
5959void machine_config_free(machine_config *config)
6060{
61   int cpunum, soundnum;
61   int soundnum;
6262
6363   /* release the device list */
6464   while (config->devicelist != NULL)
6565      device_list_remove(&config->devicelist, config->devicelist->type, config->devicelist->tag);
6666
6767   /* release the strings */
68   for (cpunum = 0; cpunum < ARRAY_LENGTH(config->cputag); cpunum++)
69      if (config->cputag[cpunum] != NULL)
70         astring_free(config->cputag[cpunum]);
7168   for (soundnum = 0; soundnum < ARRAY_LENGTH(config->soundtag); soundnum++)
7269      if (config->soundtag[soundnum] != NULL)
7370         astring_free(config->soundtag[soundnum]);
r3957r3958
7875
7976
8077/*-------------------------------------------------
81    cpu_add - add a CPU during machine driver
82    expansion
83-------------------------------------------------*/
84
85static cpu_config *cpu_add(machine_config *machine, const char *tag, cpu_type type, int cpuclock)
86{
87   int cpunum;
88
89   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
90      if (machine->cpu[cpunum].type == CPU_DUMMY)
91      {
92         if (machine->cputag[cpunum] == NULL)
93            machine->cputag[cpunum] = astring_alloc();
94         astring_cpyc(machine->cputag[cpunum], tag);
95         machine->cpu[cpunum].tag = astring_c(machine->cputag[cpunum]);
96         machine->cpu[cpunum].type = type;
97         machine->cpu[cpunum].clock = cpuclock;
98         return &machine->cpu[cpunum];
99      }
100
101   fatalerror("Out of CPU's!\n");
102   return NULL;
103}
104
105
106/*-------------------------------------------------
107    cpu_find - find a tagged CPU during machine
108    driver expansion
109-------------------------------------------------*/
110
111static cpu_config *cpu_find(machine_config *machine, const char *tag)
112{
113   int cpunum;
114
115   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
116      if (machine->cpu[cpunum].tag && strcmp(machine->cpu[cpunum].tag, tag) == 0)
117         return &machine->cpu[cpunum];
118
119   fatalerror("Can't find CPU '%s'!\n", tag);
120   return NULL;
121}
122
123
124/*-------------------------------------------------
125    cpu_remove - remove a tagged CPU during
126    machine driver expansion
127-------------------------------------------------*/
128
129static void cpu_remove(machine_config *machine, const char *tag)
130{
131   int cpunum;
132
133   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
134      if (machine->cpu[cpunum].tag && strcmp(machine->cpu[cpunum].tag, tag) == 0)
135      {
136         if (machine->cputag[cpunum] != NULL)
137            astring_free(machine->cputag[cpunum]);
138         memmove(&machine->cpu[cpunum], &machine->cpu[cpunum + 1], sizeof(machine->cpu[0]) * (MAX_CPU - cpunum - 1));
139         memmove(&machine->cputag[cpunum], &machine->cputag[cpunum + 1], sizeof(machine->cputag[0]) * (MAX_CPU - cpunum - 1));
140         memset(&machine->cpu[MAX_CPU - 1], 0, sizeof(machine->cpu[0]));
141         memset(&machine->cputag[MAX_CPU - 1], 0, sizeof(machine->cputag[0]));
142         return;
143      }
144
145   fatalerror("Can't find CPU '%s'!\n", tag);
146}
147
148
149/*-------------------------------------------------
15078    sound_add - add a sound system during
15179    machine driver expansion
15280-------------------------------------------------*/
r3957r3958
222150    machine config
223151-------------------------------------------------*/
224152
225static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const char *tagprefix, int depth)
153static void machine_config_detokenize(machine_config *config, const machine_config_token *tokens, const device_config *owner, int depth)
226154{
227155   UINT32 entrytype = MCONFIG_TOKEN_INVALID;
228156   astring *tempstring = astring_alloc();
229157   device_config *device = NULL;
230158   sound_config *sound = NULL;
231   cpu_config *cpu = NULL;
232159
233160   /* loop over tokens until we hit the end */
234161   while (entrytype != MCONFIG_TOKEN_END)
r3957r3958
249176
250177         /* including */
251178         case MCONFIG_TOKEN_INCLUDE:
252            machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr), tagprefix, depth + 1);
179            machine_config_detokenize(config, TOKEN_GET_PTR(tokens, tokenptr), owner, depth + 1);
253180            break;
254181
255182         /* device management */
256183         case MCONFIG_TOKEN_DEVICE_ADD:
184            TOKEN_UNGET_UINT32(tokens);
185            TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, clock, 32);
257186            devtype = TOKEN_GET_PTR(tokens, devtype);
258187            tag = TOKEN_GET_STRING(tokens);
259            device = device_list_add(&config->devicelist, devtype, device_build_tag(tempstring, tagprefix, tag));
188            device = device_list_add(&config->devicelist, owner, devtype, device_build_tag(tempstring, owner, tag), clock);
260189            break;
261190
262191         case MCONFIG_TOKEN_DEVICE_REMOVE:
263192            devtype = TOKEN_GET_PTR(tokens, devtype);
264193            tag = TOKEN_GET_STRING(tokens);
265            device_list_remove(&config->devicelist, devtype, device_build_tag(tempstring, tagprefix, tag));
194            device_list_remove(&config->devicelist, devtype, device_build_tag(tempstring, owner, tag));
266195            device = NULL;
267196            break;
268197
269198         case MCONFIG_TOKEN_DEVICE_MODIFY:
270199            devtype = TOKEN_GET_PTR(tokens, devtype);
271200            tag = TOKEN_GET_STRING(tokens);
272            device = (device_config *)device_list_find_by_tag(config->devicelist, devtype, device_build_tag(tempstring, tagprefix, tag));
201            device = (device_config *)device_list_find_by_tag(config->devicelist, devtype, device_build_tag(tempstring, owner, tag));
273202            if (device == NULL)
274203               fatalerror("Unable to find device: type=%s tag=%s\n", devtype_get_name(devtype), astring_c(tempstring));
275204            break;
276205
206         case MCONFIG_TOKEN_DEVICE_CLOCK:
207            assert(device != NULL);
208            TOKEN_UNGET_UINT32(tokens);
209            TOKEN_GET_UINT64_UNPACK2(tokens, entrytype, 8, device->clock, 32);
210            break;
211
277212         case MCONFIG_TOKEN_DEVICE_CONFIG:
278213            assert(device != NULL);
279214            device->static_config = TOKEN_GET_PTR(tokens, voidptr);
r3957r3958
331266            break;
332267
333268
334         /* add/modify/remove/replace CPUs */
335         case MCONFIG_TOKEN_CPU_ADD:
336            TOKEN_UNGET_UINT32(tokens);
337            TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
338            tag = TOKEN_GET_STRING(tokens);
339            cpu = cpu_add(config, device_build_tag(tempstring, tagprefix, tag), type, clock);
340            break;
341
342         case MCONFIG_TOKEN_CPU_MODIFY:
343            tag = TOKEN_GET_STRING(tokens);
344            cpu = cpu_find(config, device_build_tag(tempstring, tagprefix, tag));
345            break;
346
347         case MCONFIG_TOKEN_CPU_REMOVE:
348            tag = TOKEN_GET_STRING(tokens);
349            cpu_remove(config, device_build_tag(tempstring, tagprefix, tag));
350            cpu = NULL;
351            break;
352
353         case MCONFIG_TOKEN_CPU_REPLACE:
354            TOKEN_UNGET_UINT32(tokens);
355            TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
356            tag = TOKEN_GET_STRING(tokens);
357            cpu = cpu_find(config, device_build_tag(tempstring, tagprefix, tag));
358            if (cpu == NULL)
359               fatalerror("Unable to find CPU: tag=%s\n", astring_c(tempstring));
360            cpu->type = type;
361            cpu->clock = clock;
362            break;
363
364         /* CPU parameters */
365         case MCONFIG_TOKEN_cpu_get_flags:
366            assert(cpu != NULL);
367            TOKEN_UNGET_UINT32(tokens);
368            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, cpu->flags, 24);
369            break;
370
371         case MCONFIG_TOKEN_CPU_CONFIG:
372            assert(cpu != NULL);
373            cpu->reset_param = TOKEN_GET_PTR(tokens, voidptr);
374            break;
375
376         case MCONFIG_TOKEN_CPU_PROGRAM_MAP:
377            assert(cpu != NULL);
378            cpu->address_map[ADDRESS_SPACE_PROGRAM][0] = TOKEN_GET_PTR(tokens, addrmap);
379            cpu->address_map[ADDRESS_SPACE_PROGRAM][1] = TOKEN_GET_PTR(tokens, addrmap);
380            break;
381
382         case MCONFIG_TOKEN_CPU_DATA_MAP:
383            assert(cpu != NULL);
384            cpu->address_map[ADDRESS_SPACE_DATA][0] = TOKEN_GET_PTR(tokens, addrmap);
385            cpu->address_map[ADDRESS_SPACE_DATA][1] = TOKEN_GET_PTR(tokens, addrmap);
386            break;
387
388         case MCONFIG_TOKEN_CPU_IO_MAP:
389            assert(cpu != NULL);
390            cpu->address_map[ADDRESS_SPACE_IO][0] = TOKEN_GET_PTR(tokens, addrmap);
391            cpu->address_map[ADDRESS_SPACE_IO][1] = TOKEN_GET_PTR(tokens, addrmap);
392            break;
393
394         case MCONFIG_TOKEN_CPU_VBLANK_INT:
395            assert(cpu != NULL);
396            TOKEN_UNGET_UINT32(tokens);
397            TOKEN_GET_UINT32_UNPACK1(tokens, entrytype, 8);
398            cpu->vblank_interrupt_screen = TOKEN_GET_STRING(tokens);
399            cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
400            cpu->vblank_interrupts_per_frame = 1;
401            break;
402
403         case MCONFIG_TOKEN_CPU_VBLANK_INT_HACK:
404            assert(cpu != NULL);
405            TOKEN_UNGET_UINT32(tokens);
406            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, cpu->vblank_interrupts_per_frame, 24);
407            cpu->vblank_interrupt = TOKEN_GET_PTR(tokens, interrupt);
408            break;
409
410         case MCONFIG_TOKEN_CPU_PERIODIC_INT:
411            assert(cpu != NULL);
412            TOKEN_UNGET_UINT32(tokens);
413            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, data32, 24);
414            cpu->timed_interrupt_period = HZ_TO_ATTOSECONDS(data32);
415            cpu->timed_interrupt = TOKEN_GET_PTR(tokens, interrupt);
416            break;
417
418269         /* core parameters */
419270         case MCONFIG_TOKEN_DRIVER_DATA:
420271            TOKEN_UNGET_UINT32(tokens);
421272            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->driver_data_size, 24);
422273            break;
423274
424         case MCONFIG_TOKEN_INTERLEAVE:
425            TOKEN_UNGET_UINT32(tokens);
426            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->cpu_slices_per_frame, 24);
275         case MCONFIG_TOKEN_QUANTUM_TIME:
276            TOKEN_EXTRACT_UINT64(tokens, data64);
277            config->minimum_quantum = UINT64_ATTOTIME_TO_ATTOTIME(data64);
427278            break;
428279
280         case MCONFIG_TOKEN_QUANTUM_PERFECT_CPU:
281            config->perfect_cpu_quantum = TOKEN_GET_STRING(tokens);
282            break;
283
429284         case MCONFIG_TOKEN_WATCHDOG_VBLANK:
430285            TOKEN_UNGET_UINT32(tokens);
431286            TOKEN_GET_UINT32_UNPACK2(tokens, entrytype, 8, config->watchdog_vblank_count, 24);
r3957r3958
507362            TOKEN_UNGET_UINT32(tokens);
508363            TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
509364            tag = TOKEN_GET_STRING(tokens);
510            sound = sound_add(config, device_build_tag(tempstring, tagprefix, tag), type, clock);
365            sound = sound_add(config, device_build_tag(tempstring, owner, tag), type, clock);
511366            break;
512367
513368         case MCONFIG_TOKEN_SOUND_REMOVE:
r3957r3958
516371
517372         case MCONFIG_TOKEN_SOUND_MODIFY:
518373            tag = TOKEN_GET_STRING(tokens);
519            sound = sound_find(config, device_build_tag(tempstring, tagprefix, tag));
374            sound = sound_find(config, device_build_tag(tempstring, owner, tag));
520375            if (sound == NULL)
521376               fatalerror("Unable to find sound: tag=%s\n", astring_c(tempstring));
522377            sound->routes = 0;
r3957r3958
531386            TOKEN_UNGET_UINT32(tokens);
532387            TOKEN_GET_UINT64_UNPACK3(tokens, entrytype, 8, type, 24, clock, 32);
533388            tag = TOKEN_GET_STRING(tokens);
534            sound = sound_find(config, device_build_tag(tempstring, tagprefix, tag));
389            sound = sound_find(config, device_build_tag(tempstring, owner, tag));
535390            if (sound == NULL)
536391               fatalerror("Unable to find sound: tag=%s\n", astring_c(tempstring));
537392            sound->type = type;
r3957r3958
563418      {
564419         tokens = device_get_info_ptr(device, DEVINFO_PTR_MACHINE_CONFIG);
565420         if (tokens != NULL)
566            machine_config_detokenize(config, tokens, device->tag, depth + 1);
421            machine_config_detokenize(config, tokens, device, depth + 1);
567422      }
568423
569424   astring_free(tempstring);
src/emu/timer.h
r3957r3958
104104***************************************************************************/
105105
106106#define MDRV_TIMER_ADD(_tag, _callback) \
107   MDRV_DEVICE_ADD(_tag, TIMER) \
107   MDRV_DEVICE_ADD(_tag, TIMER, 0) \
108108   MDRV_DEVICE_CONFIG_DATA32(timer_config, type, TIMER_TYPE_GENERIC) \
109109   MDRV_DEVICE_CONFIG_DATAPTR(timer_config, callback, _callback) \
110110
111111#define MDRV_TIMER_ADD_PERIODIC(_tag, _callback, _period) \
112   MDRV_DEVICE_ADD(_tag, TIMER) \
112   MDRV_DEVICE_ADD(_tag, TIMER, 0) \
113113   MDRV_DEVICE_CONFIG_DATA32(timer_config, type, TIMER_TYPE_PERIODIC) \
114114   MDRV_DEVICE_CONFIG_DATAPTR(timer_config, callback, _callback) \
115115   MDRV_DEVICE_CONFIG_DATA64(timer_config, period, UINT64_ATTOTIME_IN_##_period)
116116
117117#define MDRV_TIMER_ADD_SCANLINE(_tag, _callback, _screen, _first_vpos, _increment) \
118   MDRV_DEVICE_ADD(_tag, TIMER) \
118   MDRV_DEVICE_ADD(_tag, TIMER, 0) \
119119   MDRV_DEVICE_CONFIG_DATA32(timer_config, type, TIMER_TYPE_SCANLINE) \
120120   MDRV_DEVICE_CONFIG_DATAPTR(timer_config, callback, _callback) \
121121   MDRV_DEVICE_CONFIG_DATAPTR(timer_config, screen, _screen) \
src/emu/validity.c
r3957r3958
714714{
715715   const game_driver *driver = drivers[drivnum];
716716   cpu_validity_check_func cpu_validity_check;
717   const device_config *device;
717718   int error = FALSE;
718   int cpunum;
719719
720720   /* loop over all the CPUs */
721   for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
721   for (device = cpu_first(config); device != NULL; device = cpu_next(device))
722722   {
723      const cpu_config *cpu = &config->cpu[cpunum];
724      int spacenum, checknum;
723      const cpu_config *cpuconfig = device->inline_config;
724      int spacenum;
725725
726      /* skip empty entries */
727      if (cpu->type == CPU_DUMMY)
728         continue;
729
730      /* check for valid tag */
731      if (cpu->tag == NULL)
732      {
733         mame_printf_error("%s: %s has NULL CPU tag\n", driver->source_file, driver->name);
734         error = TRUE;
735      }
736
737      /* check for duplicate tags */
738      else
739      {
740         for (checknum = 0; checknum < cpunum; checknum++)
741            if (config->cpu[checknum].tag != NULL && strcmp(cpu->tag, config->cpu[checknum].tag) == 0)
742            {
743               mame_printf_error("%s: %s has multiple CPUs tagged as '%s'\n", driver->source_file, driver->name, cpu->tag);
744               error = TRUE;
745            }
746      }
747
748      /* validate the CPU tag */
749      error |= validate_tag(driver, "CPU", cpu->tag);
750
751      /* checks to see if this driver is using a dummy CPU */
752      if (cpu->type == CPU_DUMMY)
753      {
754         mame_printf_error("%s: %s uses non-present CPU\n", driver->source_file, driver->name);
755         error = TRUE;
756         continue;
757      }
758
759726      /* check the CPU for incompleteness */
760      if (cputype_get_info_fct(cpu->type, CPUINFO_PTR_RESET) == NULL ||
761         cputype_get_info_fct(cpu->type, CPUINFO_PTR_EXECUTE) == NULL)
727      if (device_get_info_fct(device, CPUINFO_FCT_RESET) == NULL ||
728         device_get_info_fct(device, CPUINFO_FCT_EXECUTE) == NULL)
762729      {
763730         mame_printf_error("%s: %s uses an incomplete CPU\n", driver->source_file, driver->name);
764731         error = TRUE;
r3957r3958
766733      }
767734
768735      /* check for CPU-specific validity check */
769      cpu_validity_check = (cpu_validity_check_func) cputype_get_info_fct(cpu->type, CPUINFO_PTR_VALIDITY_CHECK);
770      if (cpu_validity_check != NULL)
771      {
772         if ((*cpu_validity_check)(driver, config->cpu[cpunum].reset_param))
773            error = TRUE;
774      }
736      cpu_validity_check = (cpu_validity_check_func) device_get_info_fct(device, CPUINFO_FCT_VALIDITY_CHECK);
737      if (cpu_validity_check != NULL && (*cpu_validity_check)(driver, device->static_config))
738         error = TRUE;
775739
776740      /* loop over all address spaces */
777741      for (spacenum = 0; spacenum < ADDRESS_SPACES; spacenum++)
778742      {
779743#define SPACE_SHIFT(a)      ((addr_shift < 0) ? ((a) << -addr_shift) : ((a) >> addr_shift))
780744#define SPACE_SHIFT_END(a)   ((addr_shift < 0) ? (((a) << -addr_shift) | ((1 << -addr_shift) - 1)) : ((a) >> addr_shift))
781         int databus_width = cputype_get_databus_width(cpu->type, spacenum);
782         int addr_shift = cputype_get_addrbus_shift(cpu->type, spacenum);
745         int databus_width = cpu_get_databus_width(device, spacenum);
746         int addr_shift = cpu_get_addrbus_shift(device, spacenum);
783747         int alignunit = databus_width/8;
784748         address_map_entry *entry;
785749         address_map *map;
786750
787751         /* check to see that the same map is not used twice */
788         if (cpu->address_map[spacenum][0] != NULL && cpu->address_map[spacenum][0] == cpu->address_map[spacenum][1])
752         if (cpuconfig->address_map[spacenum] != NULL && cpuconfig->address_map[spacenum] == cpuconfig->address_map2[spacenum])
789753         {
790            mame_printf_error("%s: %s uses identical memory maps for CPU #%d spacenum %d\n", driver->source_file, driver->name, cpunum, spacenum);
754            mame_printf_error("%s: %s uses identical memory maps for CPU '%s' spacenum %d\n", driver->source_file, driver->name, device->tag, spacenum);
791755            error = TRUE;
792756         }
793757
794758         /* construct the maps */
795         map = address_map_alloc(config, driver, cpunum, spacenum);
759         map = address_map_alloc(device, driver, spacenum);
796760
797761         /* if this is an empty map, just skip it */
798762         if (map->entrylist == NULL)
r3957r3958
804768         /* validate the global map parameters */
805769         if (map->spacenum != spacenum)
806770         {
807            mame_printf_error("%s: %s CPU #%d space %d has address space %d handlers!\n", driver->source_file, driver->name, cpunum, spacenum, map->spacenum);
771            mame_printf_error("%s: %s CPU '%s' space %d has address space %d handlers!\n", driver->source_file, driver->name, device->tag, spacenum, map->spacenum);
808772            error = TRUE;
809773         }
810774         if (map->databits != databus_width)
811775         {
812            mame_printf_error("%s: %s cpu #%d uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, cpunum, address_space_names[spacenum], databus_width, map->databits);
776            mame_printf_error("%s: %s cpu '%s' uses wrong memory handlers for %s space! (width = %d, memory = %08x)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], databus_width, map->databits);
813777            error = TRUE;
814778         }
815779
r3957r3958
836800            /* if this is a program space, auto-assign implicit ROM entries */
837801            if ((FPTR)entry->read.generic == STATIC_ROM && entry->region == NULL)
838802            {
839               entry->region = config->cpu[cpunum].tag;
803               entry->region = device->tag;
840804               entry->rgnoffs = entry->addrstart;
841805            }
842806
r3957r3958
851815                  /* stop if we hit an empty */
852816                  if (rgninfo->entries[rgnnum].tag == NULL)
853817                  {
854                     mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X references non-existant region \"%s\"\n", driver->source_file, driver->name, cpunum, spacenum, entry->addrstart, entry->addrend, entry->region);
818                     mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X references non-existant region \"%s\"\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region);
855819                     error = TRUE;
856820                     break;
857821                  }
r3957r3958
862826                     offs_t length = rgninfo->entries[rgnnum].length;
863827                     if (entry->rgnoffs + (byteend - bytestart + 1) > length)
864828                     {
865                        mame_printf_error("%s: %s CPU %d space %d memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", driver->source_file, driver->name, cpunum, spacenum, entry->addrstart, entry->addrend, entry->region, length);
829                        mame_printf_error("%s: %s CPU '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->addrstart, entry->addrend, entry->region, length);
866830                        error = TRUE;
867831                     }
868832                     break;
r3957r3958
873837            /* make sure all devices exist */
874838            if (entry->read_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->read_devtype, entry->read_devtag) == NULL)
875839            {
876               mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_get_name(entry->read_devtype), entry->read_devtag);
840               mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->read_devtype), entry->read_devtag);
877841               error = TRUE;
878842            }
879843            if (entry->write_devtype != NULL && device_list_find_by_tag(config->devicelist, entry->write_devtype, entry->write_devtag) == NULL)
880844            {
881               mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, cpunum, spacenum, devtype_get_name(entry->write_devtype), entry->write_devtag);
845               mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant device type %s, tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], devtype_get_name(entry->write_devtype), entry->write_devtag);
882846               error = TRUE;
883847            }
884848
885849            /* make sure ports exist */
886850            if (entry->read_porttag != NULL && input_port_by_tag(portlist, entry->read_porttag) == NULL)
887851            {
888               mame_printf_error("%s: %s CPU %d space %d memory map entry references nonexistant port tag %s\n", driver->source_file, driver->name, cpunum, spacenum, entry->read_porttag);
852               mame_printf_error("%s: %s CPU '%s' %s space memory map entry references nonexistant port tag %s\n", driver->source_file, driver->name, device->tag, address_space_names[spacenum], entry->read_porttag);
889853               error = TRUE;
890854            }
891855         }
r3957r3958
894858         address_map_free(map);
895859
896860         /* validate the interrupts */
897         if (cpu->vblank_interrupt != NULL)
861         if (cpuconfig->vblank_interrupt != NULL)
898862         {
899863            if (video_screen_count(config) == 0)
900864            {
901               mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt, but the driver is screenless !\n", driver->source_file, driver->name, cpunum);
865               mame_printf_error("%s: %s cpu '%s' has a VBLANK interrupt, but the driver is screenless !\n", driver->source_file, driver->name, device->tag);
902866               error = TRUE;
903867            }
904            else if (cpu->vblank_interrupts_per_frame == 0)
868            else if (cpuconfig->vblank_interrupt_screen != NULL && cpuconfig->vblank_interrupts_per_frame != 0)
905869            {
906               mame_printf_error("%s: %s cpu #%d has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, cpunum);
870               mame_printf_error("%s: %s cpu '%s' has a new VBLANK interrupt handler with >1 interrupts!\n", driver->source_file, driver->name, device->tag);
907871               error = TRUE;
908872            }
909            else if (cpu->vblank_interrupts_per_frame == 1)
873            else if (cpuconfig->vblank_interrupt_screen != NULL && device_list_find_by_tag(config->devicelist, VIDEO_SCREEN, cpuconfig->vblank_interrupt_screen) == NULL)
910874            {
911               if (cpu->vblank_interrupt_screen == NULL)
912               {
913                  mame_printf_error("%s: %s cpu #%d has a valid VBLANK interrupt handler with no screen tag supplied!\n", driver->source_file, driver->name, cpunum);
914                  error = TRUE;
915               }
916               else if (device_list_index(config->devicelist, VIDEO_SCREEN, cpu->vblank_interrupt_screen) == -1)
917               {
918                  mame_printf_error("%s: %s cpu #%d VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, cpunum, cpu->vblank_interrupt_screen);
919                  error = TRUE;
920               }
875               mame_printf_error("%s: %s cpu '%s' VBLANK interrupt with a non-existant screen tag (%s)!\n", driver->source_file, driver->name, device->tag, cpuconfig->vblank_interrupt_screen);
876               error = TRUE;
921877            }
878            else if (cpuconfig->vblank_interrupt_screen == NULL && cpuconfig->vblank_interrupts_per_frame == 0)
879            {
880               mame_printf_error("%s: %s cpu '%s' has a VBLANK interrupt handler with 0 interrupts!\n", driver->source_file, driver->name, device->tag);
881               error = TRUE;
882            }
922883         }
923         else if (cpu->vblank_interrupts_per_frame != 0)
884         else if (cpuconfig->vblank_interrupts_per_frame != 0)
924885         {
925            mame_printf_error("%s: %s cpu #%d has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, cpunum);
886            mame_printf_error("%s: %s cpu '%s' has no VBLANK interrupt handler but a non-0 interrupt count is given!\n", driver->source_file, driver->name, device->tag);
926887            error = TRUE;
927888         }
928889
929         if ((cpu->timed_interrupt != NULL) && (cpu->timed_interrupt_period == 0))
890         if (cpuconfig->timed_interrupt != NULL && cpuconfig->timed_interrupt_period == 0)
930891         {
931            mame_printf_error("%s: %s cpu #%d has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, cpunum);
892            mame_printf_error("%s: %s cpu '%s' has a timer interrupt handler with 0 period!\n", driver->source_file, driver->name, device->tag);
932893            error = TRUE;
933894         }
934         else if ((cpu->timed_interrupt == NULL) && (cpu->timed_interrupt_period != 0))
895         else if (cpuconfig->timed_interrupt == NULL && cpuconfig->timed_interrupt_period != 0)
935896         {
936            mame_printf_error("%s: %s cpu #%d has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, cpunum);
897            mame_printf_error("%s: %s cpu '%s' has a no timer interrupt handler but has a non-0 period given!\n", driver->source_file, driver->name, device->tag);
937898            error = TRUE;
938899         }
939900      }
r3957r3958
16591620   error = validate_inlines() || error;
16601621
16611622   /* make sure the CPU and sound interfaces are up and running */
1662   cpuintrf_init(NULL);
16631623   sndintrf_init(NULL);
16641624
16651625   init_resource_tracking();
src/emu/mconfig.h
r3957r3958
3636
3737   MCONFIG_TOKEN_DEVICE_ADD,
3838   MCONFIG_TOKEN_DEVICE_REMOVE,
39   MCONFIG_TOKEN_DEVICE_REPLACE,
3940   MCONFIG_TOKEN_DEVICE_MODIFY,
41   MCONFIG_TOKEN_DEVICE_CLOCK,
4042   MCONFIG_TOKEN_DEVICE_CONFIG,
4143   MCONFIG_TOKEN_DEVICE_CONFIG_DATA32,
4244   MCONFIG_TOKEN_DEVICE_CONFIG_DATA64,
4345   MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP32,
4446   MCONFIG_TOKEN_DEVICE_CONFIG_DATAFP64,
4547
46   MCONFIG_TOKEN_CPU_ADD,
47   MCONFIG_TOKEN_CPU_MODIFY,
48   MCONFIG_TOKEN_CPU_REMOVE,
49   MCONFIG_TOKEN_CPU_REPLACE,
50   MCONFIG_TOKEN_cpu_get_flags,
51   MCONFIG_TOKEN_CPU_CONFIG,
52   MCONFIG_TOKEN_CPU_PROGRAM_MAP,
53   MCONFIG_TOKEN_CPU_DATA_MAP,
54   MCONFIG_TOKEN_CPU_IO_MAP,
55   MCONFIG_TOKEN_CPU_VBLANK_INT,
56   MCONFIG_TOKEN_CPU_VBLANK_INT_HACK,
57   MCONFIG_TOKEN_CPU_PERIODIC_INT,
58
5948   MCONFIG_TOKEN_DRIVER_DATA,
60   MCONFIG_TOKEN_INTERLEAVE,
49   MCONFIG_TOKEN_QUANTUM_TIME,
50   MCONFIG_TOKEN_QUANTUM_PERFECT_CPU,
6151   MCONFIG_TOKEN_WATCHDOG_VBLANK,
6252   MCONFIG_TOKEN_WATCHDOG_TIME,
6353
r3957r3958
124114{
125115   UINT32               driver_data_size;      /* amount of memory needed for driver_data */
126116
127   cpu_config            cpu[MAX_CPU];         /* array of CPUs in the system */
128   astring *            cputag[MAX_CPU];      /* allocated strings for each CPU tag */
129   UINT32               cpu_slices_per_frame;   /* number of times to interleave execution per frame */
117   attotime            minimum_quantum;      /* minimum scheduling quantum */
118   const char *         perfect_cpu_quantum;   /* tag of CPU to use for "perfect" scheduling */
130119   INT32               watchdog_vblank_count;   /* number of VBLANKs until the watchdog kills us */
131120   attotime            watchdog_time;         /* length of time until the watchdog kills us */
132121
r3957r3958
171160   const gfx_decode_entry *gfxdecode;
172161   const addrmap_token *addrmap;
173162   device_type devtype;
174   void (*interrupt)(const device_config *device);
175163   driver_init_func driver_init;
176164   nvram_handler_func nvram_handler;
177165   memcard_handler_func memcard_handler;
r3957r3958
210198
211199
212200/* add/remove/config devices */
213#define MDRV_DEVICE_ADD(_tag, _type) \
214   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_ADD, 8), \
201#define MDRV_DEVICE_ADD(_tag, _type, _clock) \
202   TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_ADD, 8, _clock, 32), \
215203   TOKEN_PTR(devtype, _type), \
216204   TOKEN_STRING(_tag),
217205
r3957r3958
229217   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_DEVICE_CONFIG, 8), \
230218   TOKEN_PTR(voidptr, &(_config)),
231219
220#define MDRV_DEVICE_CLOCK(_clock) \
221   TOKEN_UINT64_PACK2(MCONFIG_TOKEN_DEVICE_CLOCK, 8, _clock, 32),
222
232223#define structsizeof(_struct, _field) sizeof(((_struct *)NULL)->_field)
233224
234225#define MDRV_DEVICE_CONFIG_DATA32_EXPLICIT(_size, _offset, _val) \
r3957r3958
278269#endif
279270
280271
281/* add/modify/remove/replace CPUs */
282#define MDRV_CPU_ADD(_tag, _type, _clock) \
283   TOKEN_UINT64_PACK3(MCONFIG_TOKEN_CPU_ADD, 8, CPU_##_type, 24, _clock, 32), \
284   TOKEN_STRING(_tag),
285
286#define MDRV_CPU_MODIFY(_tag) \
287   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_MODIFY, 8), \
288   TOKEN_STRING(_tag),
289
290#define MDRV_CPU_REMOVE(_tag) \
291   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_REMOVE, 8), \
292   TOKEN_STRING(_tag),
293
294#define MDRV_CPU_REPLACE(_tag, _type, _clock) \
295   TOKEN_UINT64_PACK3(MCONFIG_TOKEN_CPU_REPLACE, 8, CPU_##_type, 24, _clock, 32), \
296   TOKEN_STRING(_tag),
297
298
299/* CPU parameters */
300#define MDRV_CPU_FLAGS(_flags) \
301   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_cpu_get_flags, 8, _flags, 24),
302
303#define MDRV_CPU_CONFIG(_config) \
304   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_CONFIG, 8), \
305   TOKEN_PTR(voidptr, &(_config)),
306
307#define MDRV_CPU_PROGRAM_MAP(_map1, _map2) \
308   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_PROGRAM_MAP, 8), \
309   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
310   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
311
312#define MDRV_CPU_DATA_MAP(_map1, _map2)   \
313   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_DATA_MAP, 8), \
314   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
315   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
316
317#define MDRV_CPU_IO_MAP(_map1, _map2) \
318   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_IO_MAP, 8), \
319   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map1)), \
320   TOKEN_PTR(voidptr, ADDRESS_MAP_NAME(_map2)), \
321
322#define MDRV_CPU_VBLANK_INT(_tag, _func) \
323   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_CPU_VBLANK_INT, 8), \
324   TOKEN_STRING(_tag), \
325   TOKEN_PTR(interrupt, _func),
326
327#define MDRV_CPU_PERIODIC_INT(_func, _rate)   \
328   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_CPU_PERIODIC_INT, 8, _rate, 24), \
329   TOKEN_PTR(interrupt, _func),
330
331
332272/* core parameters */
333273#define MDRV_DRIVER_DATA(_struct) \
334274   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_DRIVER_DATA, 8, sizeof(_struct), 24),
335275
336#define MDRV_INTERLEAVE(_interleave) \
337   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_INTERLEAVE, 8, _interleave, 24),
276#define MDRV_QUANTUM_TIME(_time) \
277   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_TIME, 8), \
278   TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time),
338279
280#define MDRV_QUANTUM_PERFECT_CPU(_cputag) \
281   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_QUANTUM_PERFECT_CPU, 8), \
282   TOKEN_STRING(_cputag),
283
339284#define MDRV_WATCHDOG_VBLANK_INIT(_count) \
340285   TOKEN_UINT32_PACK2(MCONFIG_TOKEN_WATCHDOG_VBLANK, 8, _count, 24),
341286
342287#define MDRV_WATCHDOG_TIME_INIT(_time) \
343288   TOKEN_UINT32_PACK1(MCONFIG_TOKEN_WATCHDOG_TIME, 8), \
344   TOKEN_UINT64(_time),
289   TOKEN_UINT64(UINT64_ATTOTIME_IN_##_time),
345290
346291
347292/* core functions */
r3957r3958
402347
403348/* add/remove speakers */
404349#define MDRV_SPEAKER_ADD(_tag, _x, _y, _z) \
405   MDRV_DEVICE_ADD(_tag, SPEAKER_OUTPUT) \
350   MDRV_DEVICE_ADD(_tag, SPEAKER_OUTPUT, 0) \
406351   MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, x, _x, 24) \
407352   MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, y, _y, 24) \
408353   MDRV_DEVICE_CONFIG_DATAFP32(speaker_config, z, _z, 24)
src/emu/romload.c
r3957r3958
11731173   const device_config *device = cputag_get_cpu(machine, rgntag);
11741174   if (device != NULL)
11751175   {
1176      int cputype = ((const cpu_config *)device->inline_config)->type;
11771176      int buswidth;
11781177
11791178      /* set the endianness */
11801179      startflags &= ~ROMREGION_ENDIANMASK;
1181      if (cputype_get_endianness(cputype) == ENDIANNESS_LITTLE)
1180      if (cpu_get_endianness(device) == ENDIANNESS_LITTLE)
11821181         startflags |= ROMREGION_LE;
11831182      else
11841183         startflags |= ROMREGION_BE;
11851184
11861185      /* set the width */
11871186      startflags &= ~ROMREGION_WIDTHMASK;
1188      buswidth = cputype_get_databus_width(cputype, ADDRESS_SPACE_PROGRAM);
1187      buswidth = cpu_get_databus_width(device, ADDRESS_SPACE_PROGRAM);
11891188      if (buswidth <= 8)
11901189         startflags |= ROMREGION_8BIT;
11911190      else if (buswidth <= 16)
src/lib/util/corefile.c
r3957r3958
287287      file->zdata = malloc(sizeof(*file->zdata));
288288      if (file->zdata == NULL)
289289         return FILERR_OUT_OF_MEMORY;
290      memset(file->zdata, 0, sizeof(file->zdata));
290      memset(file->zdata, 0, sizeof(*file->zdata));
291291
292292      /* initialize the stream and compressor */
293293      if ((file->openflags & OPEN_FLAG_WRITE) != 0)
src/mess/uimess.c
r3957r3958
177177   }
178178
179179   /* determine if we should disable the rest of the UI */
180   ui_disabled = ui_mess_use_new_ui(machine)
180   ui_disabled = ui_mess_use_new_ui()
181181      || ((machine->gamedrv->flags & GAME_COMPUTER) && !machine->ui_mess_data->active);
182182
183183
184184   /* is ScrLk UI toggling applicable here? */
185   if (!ui_mess_use_new_ui(machine) && (machine->gamedrv->flags & GAME_COMPUTER))
185   if (!ui_mess_use_new_ui() && (machine->gamedrv->flags & GAME_COMPUTER))
186186   {
187187      /* are we toggling the UI with ScrLk? */
188188      if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI))
r3957r3958
323323   is in use
324324-------------------------------------------------*/
325325
326int ui_mess_use_new_ui(running_machine *machine)
326int ui_mess_use_new_ui(void)
327327{
328328#if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32)
329329   if (options_get_bool(mame_options(), "newui"))
src/mess/uimess.h
r3957r3958
3333int ui_mess_handler_ingame(running_machine *machine);
3434
3535/* returns whether the "new UI" is active or not */
36int ui_mess_use_new_ui(running_machine *machine);
36int ui_mess_use_new_ui(void);
3737
3838/* image info screen */
3939void ui_mess_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state);
src/mess/tools/messtest/main.c
r3957r3958
9494
9595   /* since the cpuintrf and sndintrf structures are filled dynamically now, we
9696    * have to init first */
97   cpuintrf_init(NULL);
9897   sndintrf_init(NULL);
9998
10099   /* register options */
src/mess/tools/messtest/testmess.c
r3957r3958
720720   else
721721   {
722722      /* perform a legacy lookup by device type */
723      device = image_from_devtype_and_index(ident->type, ident->slot);
723      device = image_from_devtype_and_index(machine, ident->type, ident->slot);
724724   }
725725
726726   /* did the image slot lookup fail? */
r3957r3958
10701070      for (cpunum = 0; (cpunum < ARRAY_LENGTH(machine->cpu)) && (machine->cpu[cpunum] != NULL); cpunum++)
10711071      {
10721072         runtime_hash *= 57;
1073         runtime_hash ^= cpu_get_reg(machine->cpu[cpunum], REG_PC);   /* TODO - Add more registers? */
1073         runtime_hash ^= cpu_get_reg(machine->cpu[cpunum], REG_GENPC);   /* TODO - Add more registers? */
10741074      }
10751075   }
10761076
src/mess/audio/wswan.c
r3957r3958
99**************************************************************************************/
1010
1111#include "driver.h"
12#include "deprecat.h"
1312#include "includes/wswan.h"
1413#include "streams.h"
1514
r3957r3958
141140   }
142141}
143142
144static void wswan_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
143static STREAM_UPDATE( wswan_sh_update )
145144{
146145   stream_sample_t sample, left, right;
147146
r3957r3958
189188            if ( snd.sweep_count >= snd.sweep_time ) {
190189               snd.sweep_count = 0;
191190               snd.audio3.freq += snd.sweep_step;
192               snd.audio3.period = Machine->sample_rate / ( 3072000  / ( ( 2048 - snd.audio3.freq ) << 5 ) );
191               snd.audio3.period = device->machine->sample_rate / ( 3072000  / ( ( 2048 - snd.audio3.freq ) << 5 ) );
193192            }
194193         }
195194         left += snd.audio3.vol_left * sample;
src/mess/audio/mac.c
r3957r3958
99#include "driver.h"
1010#include "includes/mac.h"
1111#include "streams.h"
12#include "deprecat.h"
1312
1413
1514static sound_stream *mac_stream;
r3957r3958
3635/* Stream updater                   */
3736/************************************/
3837
39static void mac_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
38static STREAM_UPDATE( mac_sound_update )
4039{
4140   INT16 last_val = 0;
4241   stream_sample_t *buffer = outputs[0];
4342
4443   /* if we're not enabled, just fill with 0 */
45   if (Machine->sample_rate == 0)
44   if (device->machine->sample_rate == 0)
4645   {
4746      memset(buffer, 0, samples * sizeof(*buffer));
4847      return;
src/mess/audio/lmc1992.c
r3957r3958
187187      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
188188
189189      /* --- the following bits of info are returned as NULL-terminated strings --- */
190      case DEVINFO_STR_NAME:                     info->s = "LMC1992";                  break;
191      case DEVINFO_STR_FAMILY:                  info->s = "LMC1992";                  break;
192      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
193      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
194      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
190      case DEVINFO_STR_NAME:                     strcpy(info->s, "LMC1992");                  break;
191      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "LMC1992");                  break;
192      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
193      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
194      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
195195   }
196196}
src/mess/audio/gmaster.c
r3957r3958
1616static /*bool*/int level;
1717static sound_stream *mixer_channel;
1818
19int gmaster_io_callback(int ioline, int state)
19int gmaster_io_callback(const device_config *device, int ioline, int state)
2020{
2121    switch (ioline) {
2222    case UPD7810_TO:
r3957r3958
3333/************************************/
3434/* Sound handler update             */
3535/************************************/
36static void gmaster_update (void* param, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
36static STREAM_UPDATE( gmaster_update )
3737{
3838    int i;
3939    stream_sample_t *buffer=outputs[0];
src/mess/audio/vic6560.c
r3957r3958
99
1010#include "driver.h"
1111#include "streams.h"
12#include "deprecat.h"
1312
1413#include "video/vic6560.h"
1514
r3957r3958
146145/************************************/
147146/* Sound handler update             */
148147/************************************/
149static void vic6560_update (void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
148static STREAM_UPDATE( vic6560_update )
150149{
151150   int i, v;
152151   stream_sample_t *buffer = outputs[0];
r3957r3958
164163         if (tone1pos >= tone1samples)
165164         {
166165            tone1pos = 0;
167            tone1samples = Machine->sample_rate / TONE1_FREQUENCY;
166            tone1samples = device->machine->sample_rate / TONE1_FREQUENCY;
168167            if (tone1samples == 0)
169168               tone1samples = 1;
170169         }
r3957r3958
180179         if (tone2pos >= tone2samples)
181180         {
182181            tone2pos = 0;
183            tone2samples = Machine->sample_rate / TONE2_FREQUENCY;
182            tone2samples = device->machine->sample_rate / TONE2_FREQUENCY;
184183            if (tone2samples == 0)
185184               tone2samples = 1;
186185         }
r3957r3958
196195         if (tone3pos >= tone3samples)
197196         {
198197            tone3pos = 0;
199            tone3samples = Machine->sample_rate / TONE3_FREQUENCY;
198            tone3samples = device->machine->sample_rate / TONE3_FREQUENCY;
200199            if (tone3samples == 0)
201200               tone3samples = 1;
202201         }
src/mess/audio/lmc1992.h
r3957r3958
2929#define LMC1992      DEVICE_GET_INFO_NAME(lmc1992)
3030
3131#define MDRV_LMC1992_ADD(_tag)      \
32   MDRV_DEVICE_ADD(_tag, LMC1992)
32   MDRV_DEVICE_ADD(_tag, LMC1992, 0)
3333
3434/* interface */
3535typedef struct _lmc1992_interface lmc1992_interface;
src/mess/audio/kaypro.c
r3957r3958
99#include "includes/kaypro.h"
1010#include "sound/custom.h"
1111#include "streams.h"
12#include "deprecat.h"
1312
1413#ifdef UNUSED_FUNCTION
1514static   sound_stream  *channel;
r3957r3958
2726#endif
2827
2928#ifdef UNUSED_FUNCTION
30static void kaypro_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
29static STREAM_UPDATE( kaypro_sound_update )
3130{
3231   stream_sample_t *buffer = outputs[0];
3332
r3957r3958
3534   {
3635      if ((bell_counter -= BELL_FREQ) < 0)
3736      {
38         bell_counter += Machine->sample_rate;
37         bell_counter += device->machine->sample_rate;
3938         bell_signal = -(bell_signal * 127) / 128;
4039      }
4140      if ((click_counter -= CLICK_FREQ) < 0)
4241      {
43         click_counter += Machine->sample_rate;
42         click_counter += device->machine->sample_rate;
4443         click_signal = -(click_signal * 3) / 4;
4544      }
4645      *buffer++ = bell_signal + click_signal;
src/mess/audio/mea8000.c
r3957r3958
726726      case DEVINFO_FCT_RESET:            info->reset = DEVICE_RESET_NAME(mea8000);   break;
727727
728728      /* --- the following bits of info are returned as NULL-terminated strings --- */
729      case DEVINFO_STR_NAME:            info->s = "Philips / Signetics MEA 8000 speech synthesizer";      break;
730      case DEVINFO_STR_FAMILY:         info->s = "MEA8000";            break;
731      case DEVINFO_STR_VERSION:         info->s = "1.00";            break;
732      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;            break;
733      case DEVINFO_STR_CREDITS:         info->s = "Copyright the MAME and MESS Teams";  break;
729      case DEVINFO_STR_NAME:            strcpy(info->s, "Philips / Signetics MEA 8000 speech synthesizer");      break;
730      case DEVINFO_STR_FAMILY:         strcpy(info->s, "MEA8000");            break;
731      case DEVINFO_STR_VERSION:         strcpy(info->s, "1.00");            break;
732      case DEVINFO_STR_SOURCE_FILE:      strcpy(info->s, __FILE__);            break;
733      case DEVINFO_STR_CREDITS:         strcpy(info->s, "Copyright the MAME and MESS Teams");  break;
734734   }
735735}
src/mess/audio/vc4000.c
r3957r3958
4141/* Sound handler update             */
4242/************************************/
4343
44static void vc4000_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
44static STREAM_UPDATE( vc4000_update )
4545{
4646   int i;
4747   stream_sample_t *buffer = outputs[0];
src/mess/audio/channelf.c
r3957r3958
3636
3737
3838
39static void channelf_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
39static STREAM_UPDATE( channelf_sh_update )
4040{
4141   UINT32 mask = 0, target = 0;
4242   stream_sample_t *buffer = outputs[0];
src/mess/audio/dave.c
r3957r3958
177177   }
178178}
179179
180static void dave_update_sound(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
180static STREAM_UPDATE( dave_update_sound )
181181{
182182   stream_sample_t *buffer1, *buffer2;
183183   /* 0 = channel 0 left volume, 1 = channel 0 right volume,
src/mess/audio/mea8000.h
r3957r3958
2525
2626
2727#define MDRV_MEA8000_ADD(_tag, _intrf)         \
28  MDRV_DEVICE_ADD(_tag, MEA8000)         \
28  MDRV_DEVICE_ADD(_tag, MEA8000, 0)         \
2929  MDRV_DEVICE_CONFIG(_intrf)
3030
3131#define MDRV_MEA8000_REMOVE(_tag)      \
src/mess/audio/special.c
r3957r3958
1515#include "includes/special.h"
1616
1717static CUSTOM_START( specimx_sh_start );
18static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples);
18static STREAM_UPDATE( specimx_sh_update );
1919
2020static sound_stream *mixer_channel;
2121static int specimx_input[3];
r3957r3958
3434   return (void *) ~0;
3535}
3636
37static void specimx_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
37static STREAM_UPDATE( specimx_sh_update )
3838{
3939   INT16 channel_0_signal;
4040   INT16 channel_1_signal;
src/mess/audio/arcadia.c
r3957r3958
4444/* Sound handler update             */
4545/************************************/
4646
47static void arcadia_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
47static STREAM_UPDATE( arcadia_update )
4848{
4949   int i;
5050   stream_sample_t *buffer = outputs[0];
src/mess/audio/gb.c
r3957r3958
155155
156156static UINT8 snd_regs[0x30];
157157
158static void gameboy_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples);
158static STREAM_UPDATE( gameboy_update );
159159
160160
161161READ8_HANDLER( gb_wave_r )
r3957r3958
388388
389389
390390
391static void gameboy_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
391static STREAM_UPDATE( gameboy_update )
392392{
393393   stream_sample_t sample, left, right, mode4_mask;
394394
src/mess/audio/cdp1863.c
r3957r3958
185185      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1863);   break;
186186
187187      /* --- the following bits of info are returned as NULL-terminated strings --- */
188      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1863";               break;
189      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
190      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
191      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
192      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
188      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1863");               break;
189      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
190      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
191      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
192      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
193193   }
194194}
src/mess/audio/lynx.c
r3957r3958
33******************************************************************************/
44
55#include "driver.h"
6#include "deprecat.h"
76#include "streams.h"
87#include "includes/lynx.h"
98
r3957r3958
258257/************************************/
259258/* Sound handler update             */
260259/************************************/
261static void lynx_update (void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
260static STREAM_UPDATE( lynx_update )
262261{
263262   int i, j;
264263   LYNX_AUDIO *channel;
r3957r3958
270269      *buffer = 0;
271270      for (channel=lynx_audio, j=0; j<ARRAY_LENGTH(lynx_audio); j++, channel++)
272271      {
273         lynx_audio_execute(Machine, channel);
272         lynx_audio_execute(device->machine, channel);
274273         v=channel->reg.n.output;
275274         *buffer+=v*15;
276275      }
277276   }
278277}
279278
280static void lynx2_update (void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
279static STREAM_UPDATE( lynx2_update )
281280{
282281   stream_sample_t *left=outputs[0], *right=outputs[1];
283282   int i, j;
r3957r3958
290289      *right= 0;
291290      for (channel=lynx_audio, j=0; j<ARRAY_LENGTH(lynx_audio); j++, channel++)
292291      {
293         lynx_audio_execute(Machine, channel);
292         lynx_audio_execute(device->machine, channel);
294293         v=channel->reg.n.output;
295294         if (!(master_enable&(0x10<<j)))
296295         {
src/mess/audio/svision.c
r3957r3958
66
77#include "driver.h"
88#include "streams.h"
9#include "deprecat.h"
109#include "includes/svision.h"
1110
1211
r3957r3958
109108/************************************/
110109/* Sound handler update             */
111110/************************************/
112static void svision_update (void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
111static STREAM_UPDATE( svision_update )
113112{
114113   stream_sample_t *left=outputs[0], *right=outputs[1];
115114   int i, j;
r3957r3958
191190         UINT16 addr = svision_dma.start + (unsigned) svision_dma.pos / 2;
192191         if (addr >= 0x8000 && addr < 0xc000)
193192         {
194            sample = memory_region(Machine, "user1")[(addr & 0x3fff) | svision_dma.ca14to16];
193            sample = memory_region(device->machine, "user1")[(addr & 0x3fff) | svision_dma.ca14to16];
195194         }
196195         else
197196         {
198            sample = memory_read_byte(cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM), addr);
197            sample = memory_read_byte(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), addr);
199198         }
200199         if (((unsigned)svision_dma.pos) & 1)
201200            s = (sample & 0xf);
r3957r3958
211210         {
212211            svision_dma.finished = TRUE;
213212            svision_dma.on = FALSE;
214            svision_irq( Machine );
213            svision_irq( device->machine );
215214         }
216215      }
217216   }
src/mess/audio/ted7360.c
r3957r3958
104104/************************************/
105105/* Sound handler update             */
106106/************************************/
107static void ted7360_update (void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
107static STREAM_UPDATE( ted7360_update )
108108{
109109   int i, v, a;
110110   stream_sample_t *buffer = outputs[0];
src/mess/audio/dai.c
r3957r3958
1414#include "machine/8255ppi.h"
1515#include "includes/dai.h"
1616#include "streams.h"
17#include "deprecat.h"
1817
1918static CUSTOM_START( dai_sh_start );
20static void dai_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples);
19static STREAM_UPDATE( dai_sh_update );
2120
2221static sound_stream *mixer_channel;
2322
r3957r3958
6261   return (void *) ~0;
6362}
6463
65static void dai_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
64static STREAM_UPDATE( dai_sh_update )
6665{
6766   INT16 channel_0_signal;
6867   INT16 channel_1_signal;
r3957r3958
9493
9594      /* noise channel */
9695
97      *sample_left += mame_rand(Machine)&0x01 ? dai_noise_volume_table[dai_noise_volume] : -dai_noise_volume_table[dai_noise_volume];
96      *sample_left += mame_rand(device->machine)&0x01 ? dai_noise_volume_table[dai_noise_volume] : -dai_noise_volume_table[dai_noise_volume];
9897
9998      sample_left++;
10099      sample_right++;
src/mess/video/i8275.c
r3957r3958
608608      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(i8275);      break;
609609
610610      /* --- the following bits of info are returned as NULL-terminated strings --- */
611      case DEVINFO_STR_NAME:                     info->s = "Intel 8275";                  break;
612      case DEVINFO_STR_FAMILY:                  info->s = "Intel 8275";                  break;
613      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
614      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
615      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
611      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8275");            break;
612      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8275");            break;
613      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
614      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
615      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
616616   }
617617}
src/mess/video/i8275.h
r3957r3958
6666***************************************************************************/
6767
6868#define MDRV_I8275_ADD(_tag, _intrf) \
69   MDRV_DEVICE_ADD(_tag, I8275) \
69   MDRV_DEVICE_ADD(_tag, I8275, 0) \
7070   MDRV_DEVICE_CONFIG(_intrf)
7171
7272#endif
src/mess/video/cdp1862.c
r3957r3958
188188      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1862);   break;
189189
190190      /* --- the following bits of info are returned as NULL-terminated strings --- */
191      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1862";               break;
192      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
193      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
194      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
195      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
191      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1862");               break;
192      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
193      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
194      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
195      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
196196   }
197197}
src/mess/video/cdp1862.h
r3957r3958
3333struct _cdp1862_interface
3434{
3535   const char *screen_tag;      /* screen we are acting on */
36   int clock;               /* the clock (pin 14) of the chip */
3736
3837   double res_r;            /* red output resistor value */
3938   double res_g;            /* green output resistor value */
src/mess/video/tmc600.c
r3957r3958
111111
112112static CDP1869_INTERFACE( tmc600_cdp1869_intf )
113113{
114   SCREEN_TAG,
115   "main",
116   CDP1869_DOT_CLK_PAL,
117   CDP1869_COLOR_CLK_PAL,
118114   CDP1869_PAL,
119115   tmc600_page_ram_r,
120116   tmc600_page_ram_w,
r3957r3958
172168   MDRV_VIDEO_UPDATE(tmc600)
173169   MDRV_SCREEN_RAW_PARAMS(CDP1869_DOT_CLK_PAL, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL)
174170
175   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
176   MDRV_DEVICE_CONFIG(tmc600_cdp1869_intf)
171   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL, CDP1869_COLOR_CLK_PAL, "main", tmc600_cdp1869_intf)
177172MACHINE_DRIVER_END
src/mess/video/abc800.c
r3957r3958
121121
122122static const mc6845_interface abc800m_mc6845_interface = {
123123   SCREEN_TAG,
124   ABC800_CCLK,
125124   ABC800_CHAR_WIDTH,
126125   NULL,
127126   abc800m_update_row,
r3957r3958
292291/* Machine Drivers */
293292
294293MACHINE_DRIVER_START( abc800m_video )
295   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
296   MDRV_DEVICE_CONFIG(abc800m_mc6845_interface)
294   MDRV_MC6845_ADD(MC6845_TAG, MC6845, ABC800_CCLK, abc800m_mc6845_interface)
297295
298296   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
299297   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
src/mess/video/vectrex.c
r3957r3958
186186   vectrex_configuration(screen->machine);
187187
188188   /* start black */
189   vector_add_point(vectrex_points[display_start].x,
189   vector_add_point(screen->machine,
190                vectrex_points[display_start].x,
190191                vectrex_points[display_start].y,
191192                vectrex_points[display_start].col,
192193                0);
193194
194195   for (i = display_start; i != display_end; i = (i + 1) % NVECT)
195196   {
196      vector_add_point(vectrex_points[i].x,
197      vector_add_point(screen->machine,
198                   vectrex_points[i].x,
197199                   vectrex_points[i].y,
198200                   vectrex_points[i].col,
199201                   vectrex_points[i].intensity);
src/mess/video/crtc_ega.c
r3957r3958
734734      assert(crtc_ega->intf->hpixels_per_column > 0);
735735
736736      /* copy the initial parameters */
737      crtc_ega->clock = crtc_ega->intf->clock;
737      crtc_ega->clock = crtc_ega->clock;
738738      crtc_ega->hpixels_per_column = crtc_ega->intf->hpixels_per_column;
739739
740740      /* get the screen device */
r3957r3958
864864      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(crtc_ega);   break;
865865
866866      /* --- the following bits of info are returned as NULL-terminated strings --- */
867      case DEVINFO_STR_NAME:                     info->s = "IBM EGA CRTC";               break;
868      case DEVINFO_STR_FAMILY:                  info->s = "EGA CRTC";                  break;
869      case DEVINFO_STR_VERSION:                  info->s = "1.00";                     break;
870      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
871      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team"; break;
867      case DEVINFO_STR_NAME:                     strcpy(info->s, "IBM EGA CRTC");               break;
868      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "EGA CRTC");                  break;
869      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.00");                     break;
870      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
871      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team"); break;
872872   }
873873}
874874
src/mess/video/crtc_ega.h
r3957r3958
1010
1111#define CRTC_EGA   DEVICE_GET_INFO_NAME(crtc_ega)
1212
13#define MDRV_CRTC_EGA_ADD(_tag, _clock, _intrf) \
14   MDRV_DEVICE_ADD(_tag, CRTC_EGA, _clock) \
15   MDRV_DEVICE_CONFIG(_intrf)
1316
1417/* callback definitions */
1518typedef void * (*crtc_ega_begin_update_func)(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect);
r3957r3958
4346struct _crtc_ega_interface
4447{
4548   const char *screen_tag;      /* screen we are acting on */
46   int clock;               /* the clock of the chip */
4749   int hpixels_per_column;      /* number of pixels per video memory address */
4850
4951   /* if specified, this gets called before any pixel update,
src/mess/video/zx8301.c
r3957r3958
299299      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(zx8301);   break;
300300
301301      /* --- the following bits of info are returned as NULL-terminated strings --- */
302      case DEVINFO_STR_NAME:                     info->s = "Sinclair ZX8301";            break;
303      case DEVINFO_STR_FAMILY:                  info->s = "Sinclair ZX83";               break;
304      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
305      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
306      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
302      case DEVINFO_STR_NAME:                     strcpy(info->s, "Sinclair ZX8301");            break;
303      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Sinclair ZX83");               break;
304      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
305      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
306      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
307307   }
308308}
src/mess/video/zx8301.h
r3957r3958
4646
4747#define ZX8301 DEVICE_GET_INFO_NAME( zx8301 )
4848
49#define MDRV_ZX8301_ADD(_tag, _clock, _config) \
50   MDRV_DEVICE_ADD(_tag, ZX8301, _clock) \
51   MDRV_DEVICE_CONFIG(_config)
52
4953/* interface */
5054typedef struct _zx8301_interface zx8301_interface;
5155struct _zx8301_interface
5256{
5357   const char *screen_tag;      /* screen we are acting on */
54   int clock;               /* the clock (pin 7) of the chip */
5558
5659   /* this gets called for every change of the VSYNC pin (pin 11) */
5760   zx8301_on_vsync_changed_func   on_vsync_changed;
src/mess/video/pc_mda.c
r3957r3958
6666static const mc6845_interface mc6845_mda_intf =
6767{
6868   MDA_SCREEN_NAME,   /* screen number */
69   MDA_CLOCK/9 /*?*/,   /* clock */
7069   9,               /* number of pixels per video memory address */
7170   NULL,            /* begin_update */
7271   mda_update_row,      /* update_row */
r3957r3958
8483
8584   MDRV_PALETTE_INIT(pc_mda)
8685
87   MDRV_DEVICE_ADD( MDA_MC6845_NAME, MC6845)
88   MDRV_DEVICE_CONFIG( mc6845_mda_intf )
86   MDRV_MC6845_ADD( MDA_MC6845_NAME, MC6845, MDA_CLOCK/9, mc6845_mda_intf)
8987
9088   MDRV_VIDEO_START( pc_mda )
9189   MDRV_VIDEO_UPDATE( mc6845_mda)
r3957r3958
424422static const mc6845_interface mc6845_hercules_intf =
425423{
426424   HERCULES_SCREEN_NAME,   /* screen number */
427   MDA_CLOCK/9 /*?*/,      /* clock */
428425   9,                  /* number of pixels per video memory address */
429426   NULL,               /* begin_update */
430427   mda_update_row,         /* update_row */
r3957r3958
442439
443440   MDRV_PALETTE_INIT(pc_mda)
444441
445   MDRV_DEVICE_ADD( HERCULES_MC6845_NAME, MC6845)
446   MDRV_DEVICE_CONFIG( mc6845_hercules_intf )
442   MDRV_MC6845_ADD( HERCULES_MC6845_NAME, MC6845, MDA_CLOCK/9, mc6845_hercules_intf)
447443
448444   MDRV_VIDEO_START( pc_hercules )
449445   MDRV_VIDEO_UPDATE( mc6845_hercules )
src/mess/video/pc_t1t.c
r3957r3958
3232
3333static const mc6845_interface mc6845_t1000_intf = {
3434   T1000_SCREEN_NAME,      /* screen number */
35   XTAL_14_31818MHz/8,      /* clock, needs verification */
3635   8,                  /* numbers of pixels per video memory address */
3736   NULL,               /* begin_update */
3837   t1000_update_row,      /* update_row */
r3957r3958
5049   MDRV_PALETTE_LENGTH( 16 )
5150   MDRV_PALETTE_INIT(pcjr)
5251
53   MDRV_DEVICE_ADD(T1000_MC6845_NAME, MC6845)
54   MDRV_DEVICE_CONFIG( mc6845_t1000_intf )
52   MDRV_MC6845_ADD(T1000_MC6845_NAME, MC6845, XTAL_14_31818MHz/8, mc6845_t1000_intf)
5553
5654   MDRV_VIDEO_START(pc_t1t)
5755   MDRV_VIDEO_UPDATE( mc6845_t1000 )
r3957r3958
6058
6159static const mc6845_interface mc6845_pcjr_intf = {
6260   T1000_SCREEN_NAME,      /* screen number */
63   XTAL_14_31818MHz/16,   /* clock, needs verification */
6461   8,                  /* numbers of pixels per video memory address */
6562   NULL,               /* begin_update */
6663   t1000_update_row,      /* update_row */
r3957r3958
7875   MDRV_PALETTE_LENGTH( 16 )
7976   MDRV_PALETTE_INIT(pcjr)
8077
81   MDRV_DEVICE_ADD(T1000_MC6845_NAME, MC6845)
82   MDRV_DEVICE_CONFIG( mc6845_pcjr_intf )
78   MDRV_MC6845_ADD(T1000_MC6845_NAME, MC6845, XTAL_14_31818MHz/16, mc6845_pcjr_intf)
8379
8480   MDRV_VIDEO_START(pc_pcjr)
8581   MDRV_VIDEO_UPDATE( mc6845_t1000 )
src/mess/video/tmc1800.c
r3957r3958
2727static CDP1861_INTERFACE( tmc1800_cdp1861_intf )
2828{
2929   SCREEN_TAG,
30   XTAL_1_75MHz,
3130   tmc1800_int_w,
3231   tmc1800_dmao_w,
3332   tmc1800_efx_w
r3957r3958
6463static CDP1864_INTERFACE( tmc2000_cdp1864_intf )
6564{
6665   SCREEN_TAG,
67   XTAL_1_75MHz,
6866   CDP1864_INTERLACED,
6967   tmc2000_int_w,
7068   tmc2000_dmao_w,
r3957r3958
106104static CDP1864_INTERFACE( oscnano_cdp1864_intf )
107105{
108106   SCREEN_TAG,
109   XTAL_1_75MHz,
110107   CDP1864_INTERLACED,
111108   oscnano_int_w,
112109   oscnano_dmao_w,
r3957r3958
148145   MDRV_PALETTE_INIT(black_and_white)
149146   MDRV_VIDEO_UPDATE(tmc1800)
150147
151   MDRV_DEVICE_ADD(CDP1861_TAG, CDP1861)
152   MDRV_DEVICE_CONFIG(tmc1800_cdp1861_intf)
148   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_1_75MHz, tmc1800_cdp1861_intf)
153149MACHINE_DRIVER_END
154150
155151MACHINE_DRIVER_START( osc1000b_video )
r3957r3958
173169   MDRV_PALETTE_LENGTH(8+8)
174170   MDRV_VIDEO_UPDATE(tmc2000)
175171
176   MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
177   MDRV_DEVICE_CONFIG(tmc2000_cdp1864_intf)
172   MDRV_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000_cdp1864_intf)
178173MACHINE_DRIVER_END
179174
180175MACHINE_DRIVER_START( oscnano_video )
r3957r3958
185180   MDRV_PALETTE_LENGTH(8+8)
186181   MDRV_VIDEO_UPDATE(oscnano)
187182
188   MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
189   MDRV_DEVICE_CONFIG(oscnano_cdp1864_intf)
183   MDRV_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, oscnano_cdp1864_intf)
190184MACHINE_DRIVER_END
src/mess/video/pc_aga.c
r3957r3958
3434
3535static const mc6845_interface mc6845_aga_intf = {
3636   AGA_SCREEN_NAME,   /* screen number */
37   XTAL_14_31818MHz/8,   /* clock */
3837   8,               /* numbers of pixels per video memory address */
3938   NULL,            /* begin_update */
4039   aga_update_row,      /* update_row */
r3957r3958
7372
7473   MDRV_PALETTE_INIT( pc_aga )
7574
76   MDRV_DEVICE_ADD( AGA_MC6845_NAME, MC6845 )
77   MDRV_DEVICE_CONFIG( mc6845_aga_intf )
75   MDRV_MC6845_ADD( AGA_MC6845_NAME, MC6845, XTAL_14_31818MHz/8, mc6845_aga_intf )
7876
7977   MDRV_VIDEO_START( pc_aga )
8078   MDRV_VIDEO_UPDATE( mc6845_aga )
src/mess/video/pc_cga.c
r3957r3958
194194static const mc6845_interface mc6845_cga_intf =
195195{
196196   CGA_SCREEN_NAME,   /* screen number */
197   XTAL_14_31818MHz/8,   /* clock */
198197   8,               /* numbers of pixels per video memory address */
199198   NULL,            /* begin_update */
200199   cga_update_row,      /* update_row */
r3957r3958
213212
214213   MDRV_PALETTE_INIT(pc_cga)
215214
216   MDRV_DEVICE_ADD(CGA_MC6845_NAME, MC6845)
217   MDRV_DEVICE_CONFIG( mc6845_cga_intf )
215   MDRV_MC6845_ADD(CGA_MC6845_NAME, MC6845, XTAL_14_31818MHz/8, mc6845_cga_intf)
218216
219217   MDRV_VIDEO_START( pc_cga )
220218   MDRV_VIDEO_UPDATE( mc6845_cga )
src/mess/video/pc_ega.c
r3957r3958
534534static const crtc_ega_interface crtc_ega_ega_intf =
535535{
536536   EGA_SCREEN_NAME,   /* screen number */
537   16257000/8,         /* clock */
538537   8,               /* numbers of pixels per video memory address */
539538   NULL,            /* begin_update */
540539   ega_update_row,      /* update_row */
r3957r3958
554553
555554   MDRV_PALETTE_INIT(pc_ega)
556555
557   MDRV_DEVICE_ADD(EGA_CRTC_NAME, CRTC_EGA)
558   MDRV_DEVICE_CONFIG( crtc_ega_ega_intf )
556   MDRV_CRTC_EGA_ADD(EGA_CRTC_NAME, 16257000/8, crtc_ega_ega_intf)
559557
560558   MDRV_VIDEO_START( pc_ega )
561559   MDRV_VIDEO_UPDATE( pc_ega )
src/mess/video/msm6255.c
r3957r3958
409409      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(msm6255);   break;
410410
411411      /* --- the following bits of info are returned as NULL-terminated strings --- */
412      case DEVINFO_STR_NAME:                     info->s = "OKI MSM6255";               break;
413      case DEVINFO_STR_FAMILY:                  info->s = "OKI MSM6255";               break;
414      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
415      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
416      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
412      case DEVINFO_STR_NAME:                     strcpy(info->s, "OKI MSM6255");            break;
413      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "OKI MSM6255");            break;
414      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
415      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
416      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
417417   }
418418}
src/mess/video/msm6255.h
r3957r3958
1616#define MSM6255      DEVICE_GET_INFO_NAME(msm6255)
1717
1818#define MDRV_MSM6255_ADD(_tag, _intrf) \
19   MDRV_DEVICE_ADD(_tag, MSM6255) \
19   MDRV_DEVICE_ADD(_tag, MSM6255, 0) \
2020   MDRV_DEVICE_CONFIG(_intrf)
2121
2222#define MDRV_MSM6255_REMOVE(_tag) \
src/mess/video/cdp1864.c
r3957r3958
442442      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1864);   break;
443443
444444      /* --- the following bits of info are returned as NULL-terminated strings --- */
445      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1861";               break;
446      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
447      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
448      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
449      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
445      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1861");               break;
446      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
447      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
448      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
449      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
450450   }
451451}
src/mess/video/cdp1864.h
r3957r3958
7171
7272#define CDP1864      DEVICE_GET_INFO_NAME(cdp1864)
7373
74#define MDRV_CDP1864_ADD(_tag, _clock, _config) \
75   MDRV_DEVICE_ADD(_tag, CDP1864, _clock) \
76   MDRV_DEVICE_CONFIG(_config)
77
7478typedef enum _cdp1864_format cdp1864_format;
7579enum _cdp1864_format {
7680   CDP1864_NON_INTERLACED = 0,
r3957r3958
8286struct _cdp1864_interface
8387{
8488   const char *screen_tag;      /* screen we are acting on */
85   int clock;               /* the clock (pin 2) of the chip */
8689
8790   cdp1864_format interlace;   /* interlace */
8891
src/mess/video/comx35.c
r3957r3958
7070
7171static CDP1869_INTERFACE( comx35p_cdp1869_intf )
7272{
73   SCREEN_TAG,
74   CDP1802_TAG,
75   CDP1869_DOT_CLK_PAL,
76   CDP1869_COLOR_CLK_PAL,
7773   CDP1869_PAL,
7874   comx35_pageram_r,
7975   comx35_pageram_w,
r3957r3958
8581
8682static CDP1869_INTERFACE( comx35n_cdp1869_intf )
8783{
88   SCREEN_TAG,
89   CDP1802_TAG,
90   CDP1869_DOT_CLK_NTSC,
91   CDP1869_COLOR_CLK_NTSC,
9284   CDP1869_NTSC,
9385   comx35_pageram_r,
9486   comx35_pageram_w,
r3957r3958
195187static const mc6845_interface comx35_mc6845_interface =
196188{
197189   MC6845_SCREEN_TAG,
198   XTAL_14_31818MHz,
199190   8,
200191   NULL,
201192   comx35_update_row,
r3957r3958
215206   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
216207   MDRV_SCREEN_REFRESH_RATE(50)
217208
218   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
219   MDRV_DEVICE_CONFIG(comx35_mc6845_interface)
209   MDRV_MC6845_ADD(MC6845_TAG, MC6845, XTAL_14_31818MHz, comx35_mc6845_interface)
220210MACHINE_DRIVER_END
221211
222212MACHINE_DRIVER_START( comx35p_video )
r3957r3958
232222   MDRV_VIDEO_START(comx35)
233223   MDRV_VIDEO_UPDATE(comx35)
234224
235   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
236   MDRV_DEVICE_CONFIG(comx35p_cdp1869_intf)
225   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL, CDP1869_COLOR_CLK_PAL, CDP1802_TAG, comx35p_cdp1869_intf)
237226
238227   MDRV_IMPORT_FROM(comx35_80_video)
239228MACHINE_DRIVER_END
r3957r3958
251240   MDRV_VIDEO_START(comx35)
252241   MDRV_VIDEO_UPDATE(comx35)
253242
254   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
255   MDRV_DEVICE_CONFIG(comx35n_cdp1869_intf)
243   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_NTSC, CDP1869_COLOR_CLK_NTSC, CDP1802_TAG, comx35n_cdp1869_intf)
256244
257245   MDRV_IMPORT_FROM(comx35_80_video)
258246MACHINE_DRIVER_END
src/mess/video/abc802.c
r3957r3958
202202
203203static const mc6845_interface abc802_mc6845_interface = {
204204   SCREEN_TAG,
205   ABC800_CCLK,
206205   ABC800_CHAR_WIDTH,
207206   NULL,
208207   abc802_update_row,
r3957r3958
258257
259258MACHINE_DRIVER_START( abc802_video )
260259   // device interface
261   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
262   MDRV_DEVICE_CONFIG(abc802_mc6845_interface)
260   MDRV_MC6845_ADD(MC6845_TAG, MC6845, ABC800_CCLK, abc802_mc6845_interface)
263261
264262   // video hardware
265263   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
src/mess/video/odyssey2.c
r3957r3958
578578   odyssey2_sh_start
579579};
580580
581void odyssey2_sh_update( void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples )
581STREAM_UPDATE( odyssey2_sh_update )
582582{
583583   static UINT32 signal;
584584   static UINT16 count = 0;
r3957r3958
622622         /* Throw an interrupt if enabled */
623623         if( o2_vdc.s.control & 0x4 )
624624         {
625            cpu_set_input_line(Machine->cpu[0], 1, HOLD_LINE); /* Is this right? */
625            cpu_set_input_line(device->machine->cpu[0], 1, HOLD_LINE); /* Is this right? */
626626         }
627627
628628         /* Adjust volume */
src/mess/video/abc806.c
r3957r3958
378378
379379static const mc6845_interface abc806_mc6845_interface = {
380380   SCREEN_TAG,
381   ABC800_CCLK,
382381   ABC800_CHAR_WIDTH,
383382   NULL,
384383   abc806_update_row,
r3957r3958
503502
504503MACHINE_DRIVER_START( abc806_video )
505504   /* device interface */
506   MDRV_DEVICE_ADD(MC6845_TAG, MC6845)
507   MDRV_DEVICE_CONFIG(abc806_mc6845_interface)
505   MDRV_MC6845_ADD(MC6845_TAG, MC6845, ABC800_CCLK, abc806_mc6845_interface)
508506
509507   /* video hardware */
510508   MDRV_SCREEN_ADD(SCREEN_TAG, RASTER)
src/mess/video/pecom.c
r3957r3958
8080
8181static CDP1869_INTERFACE( pecom_cdp1869_intf )
8282{
83   SCREEN_TAG,
84   "main",
85   CDP1869_DOT_CLK_PAL,
86   CDP1869_COLOR_CLK_PAL,
8783   CDP1869_PAL,
8884   pecom_page_ram_r,
8985   pecom_page_ram_w,
r3957r3958
132128   MDRV_VIDEO_UPDATE(pecom)
133129   MDRV_SCREEN_RAW_PARAMS(CDP1869_DOT_CLK_PAL, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL)
134130
135   MDRV_DEVICE_ADD(CDP1869_TAG, CDP1869_VIDEO)
136   MDRV_DEVICE_CONFIG(pecom_cdp1869_intf)
131   MDRV_CDP1869_ADD(CDP1869_TAG, SCREEN_TAG, CDP1869_DOT_CLK_PAL, CDP1869_COLOR_CLK_PAL, "main", pecom_cdp1869_intf)
137132MACHINE_DRIVER_END
src/mess/video/dl1416.c
r3957r3958
179179      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME( dl1416 );            break;
180180
181181      /* --- the following bits of info are returned as NULL-terminated strings --- */
182      case DEVINFO_STR_NAME:               info->s = "DL1416";                  break;
183      case DEVINFO_STR_FAMILY:            info->s = "DL1416";                  break;
184      case DEVINFO_STR_VERSION:            info->s = "1.1";                  break;
185      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                  break;
186      case DEVINFO_STR_CREDITS:            info->s = "Copyright MESS Team";      break;
182      case DEVINFO_STR_NAME:               strcpy(info->s, "DL1416");                  break;
183      case DEVINFO_STR_FAMILY:            strcpy(info->s, "DL1416");                  break;
184      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.1");                  break;
185      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                  break;
186      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright MESS Team");      break;
187187   }
188188}
189189
src/mess/video/saa5050.c
r3957r3958
249249   MDRV_SCREEN_ADD("main", RASTER)
250250   MDRV_SCREEN_REFRESH_RATE(50)
251251   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(SAA5050_VBLANK))
252   MDRV_INTERLEAVE(1)
252   MDRV_QUANTUM_TIME(HZ(60))
253253
254254   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
255255   MDRV_SCREEN_SIZE(40 * 6, 24 * 10)
src/mess/video/dl1416.h
r3957r3958
4646***************************************************************************/
4747
4848#define MDRV_DL1416_ADD(_tag, _type, _update) \
49   MDRV_DEVICE_ADD(_tag, DL1416) \
49   MDRV_DEVICE_ADD(_tag, DL1416, 0) \
5050   MDRV_DEVICE_CONFIG_DATA32(dl1416_interface, type, _type) \
5151   MDRV_DEVICE_CONFIG_DATAPTR(dl1416_interface, update, _update)
5252
src/mess/video/cdp1861.c
r3957r3958
261261      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1861);   break;
262262
263263      /* --- the following bits of info are returned as NULL-terminated strings --- */
264      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1861";               break;
265      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
266      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
267      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
268      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
264      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1861");               break;
265      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
266      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
267      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
268      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
269269   }
270270}
src/mess/video/cdp1861.h
r3957r3958
5959
6060#define CDP1861      DEVICE_GET_INFO_NAME(cdp1861)
6161
62#define MDRV_CDP1861_ADD(_tag, _clock, _config) \
63   MDRV_DEVICE_ADD(_tag, CDP1861, _clock) \
64   MDRV_DEVICE_CONFIG(_config)
65
6266/* interface */
6367typedef struct _cdp1861_interface cdp1861_interface;
6468struct _cdp1861_interface
6569{
6670   const char *screen_tag;      /* screen we are acting on */
67   int clock;               /* the clock (pin 1) of the chip */
6871
6972   /* this gets called for every change of the INT pin (pin 3) */
7073   cdp1861_on_int_changed_func      on_int_changed;
src/mess/includes/hp48.h
r3957r3958
7272#define HP48_PORT DEVICE_GET_INFO_NAME( hp48_port )
7373
7474#define MDRV_HP48_PORT_ADD(_tag, _intrf) \
75   MDRV_DEVICE_ADD(_tag, HP48_PORT) \
75   MDRV_DEVICE_ADD(_tag, HP48_PORT, 0) \
7676   MDRV_DEVICE_CONFIG(_intrf)
7777
7878/****************************** machine ******************************/
src/mess/includes/gamecom.h
r3957r3958
158158extern WRITE8_HANDLER( gamecom_vram_w );
159159extern READ8_HANDLER( gamecom_vram_r );
160160
161extern void gamecom_handle_dma( int cycles );
162extern void gamecom_update_timers( int cycles );
161extern void gamecom_handle_dma( const device_config *device, int cycles );
162extern void gamecom_update_timers( const device_config *device, int cycles );
163163
164164extern UINT8 internal_registers[];
165165extern UINT8 gamecom_vram[];
src/mess/includes/gmaster.h
r3957r3958
55
66/*----------- defined in audio/gmaster.c -----------*/
77
8int gmaster_io_callback(int ioline, int state);
8int gmaster_io_callback(const device_config *device, int ioline, int state);
99CUSTOM_START( gmaster_custom_start );
10//extern void gmaster_custom_stop (void);
11//extern void gmaster_custom_update (void);
1210
1311#endif
src/mess/includes/odyssey2.h
r3957r3958
4040WRITE8_HANDLER ( odyssey2_video_w );
4141WRITE8_HANDLER ( odyssey2_lum_w );
4242
43void odyssey2_sh_update( void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples );
43STREAM_UPDATE( odyssey2_sh_update );
4444
4545extern const custom_sound_interface odyssey2_sound_interface;
4646
r3957r3958
6666WRITE8_HANDLER ( odyssey2_putbus );
6767
6868READ8_HANDLER( odyssey2_t0_r );
69void the_voice_lrq_callback( int state );
69void the_voice_lrq_callback( const device_config *device, int state );
7070
7171READ8_HANDLER ( g7400_bus_r );
7272WRITE8_HANDLER ( g7400_bus_w );
src/mess/includes/pc.h
r3957r3958
2828void pc_speaker_set_spkrdata(UINT8 data);
2929void pc_speaker_set_input(UINT8 data);
3030
31void mess_init_pc_common( running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int));
31void mess_init_pc_common( running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(running_machine *, int), void (*set_hdc_int_func)(int,int));
3232
3333WRITE8_HANDLER( pc_nmi_enable_w );
3434READ8_HANDLER( pcjr_nmi_enable_r );
src/mess/includes/gamepock.h
r3957r3958
1313READ8_HANDLER( gamepock_port_b_r );
1414READ8_HANDLER( gamepock_port_c_r );
1515
16int gamepock_io_callback( int ioline, int state );
16int gamepock_io_callback( const device_config *device, int ioline, int state );
1717
1818#endif
src/mess/messdriv.c
r3957r3958
517517   DRIVER( ip244415 )
518518
519519   /* TEXAS INSTRUMENTS */
520   DRIVER( ti990_10 )   /* 1975 TI 990/10                           */
521   DRIVER( ti990_4 )   /* 1976 TI 990/4                           */
522   DRIVER( 990189 )   /* 1978 TM 990/189                           */
523   DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board         */
520//0128u7   DRIVER( ti990_10 )   /* 1975 TI 990/10                           */
521//0128u7   DRIVER( ti990_4 )   /* 1976 TI 990/4                           */
522//0128u7   DRIVER( 990189 )   /* 1978 TM 990/189                           */
523//0128u7   DRIVER( 990189v )   /* 1980 TM 990/189 with Color Video Board         */
524524
525   DRIVER( ti99_224 )   /* 1983 TI 99/2 (24kb ROMs)                     */
526   DRIVER( ti99_232 )   /* 1983 TI 99/2 (32kb ROMs)                     */
527   DRIVER( ti99_4 )   /* 1979 TI-99/4                              */
528   DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                  */
529   DRIVER( ti99_4a )   /* 1981 TI-99/4A                           */
530   DRIVER( ti99_4ae )   /* 1981 TI-99/4A with 50Hz video               */
531   DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card            */
532   DRIVER( ti99_8 )   /* 1983 TI-99/8                              */
533   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
525//0128u7   DRIVER( ti99_224 )   /* 1983 TI 99/2 (24kb ROMs)                     */
526//0128u7   DRIVER( ti99_232 )   /* 1983 TI 99/2 (32kb ROMs)                     */
527//0128u7   DRIVER( ti99_4 )   /* 1979 TI-99/4                              */
528//0128u7   DRIVER( ti99_4e )   /* 1980 TI-99/4 with 50Hz video                  */
529//0128u7   DRIVER( ti99_4a )   /* 1981 TI-99/4A                           */
530//0128u7   DRIVER( ti99_4ae )   /* 1981 TI-99/4A with 50Hz video               */
531//0128u7   DRIVER( ti99_4ev)   /* 1994 TI-99/4A with EVPC video card            */
532//0128u7   DRIVER( ti99_8 )   /* 1983 TI-99/8                              */
533//0128u7   DRIVER( ti99_8e )   /* 1983 TI-99/8 with 50Hz video                  */
534534
535535   /* TI 99 clones */
536   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
537   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
538   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
539   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
536//0128u7   DRIVER( tutor)      /* 1983? Tomy Tutor                           */
537//0128u7   DRIVER( geneve )   /* 1987? Myarc Geneve 9640                     */
538//0128u7   DRIVER( genmod )   /* 199?? Myarc Geneve 9640                     */
539//0128u7   DRIVER( ti99_4p )   /* 1996 SNUG 99/4P (a.k.a. SGCPU)               */
540540
541541   DRIVER( avigo )      /*                                       */
542542
r3957r3958
559559   DRIVER( jupiter )   /* Jupiter Ace                              */
560560
561561   /* SORD */
562   DRIVER( sordm5 )
563   DRIVER( srdm5fd5 )
562//0128u7   DRIVER( sordm5 )
563//0128u7   DRIVER( srdm5fd5 )
564564
565565   /* APF Electronics Inc. */
566566   DRIVER( apfm1000 )
567567   DRIVER( apfimag )
568568
569569   /* Tatung */
570   DRIVER( einstein )
571   DRIVER( einstei2 )
570//0128u7   DRIVER( einstein )
571//0128u7   DRIVER( einstei2 )
572572
573573   /* INTELLIGENT SOFTWARE */
574574   DRIVER( ep128 )      /* Enterprise 128 k                           */
r3957r3958
578578
579579   /* VEB MIKROELEKTRONIK */
580580   /* KC compact is partial CPC compatible */
581   DRIVER( kc85_4 )   /* VEB KC 85/4                              */
582   DRIVER( kc85_3 )   /* VEB KC 85/3                              */
583   DRIVER( kc85_4d )   /* VEB KC 85/4 with disk interface               */
581//0128u7   DRIVER( kc85_4 )   /* VEB KC 85/4                              */
582//0128u7   DRIVER( kc85_3 )   /* VEB KC 85/3                              */
583//0128u7   DRIVER( kc85_4d )   /* VEB KC 85/4 with disk interface               */
584584
585585   /* MICROBEE SYSTEMS */
586   DRIVER( mbee )      /* Microbee 16 Standard or Plus                  */
587   DRIVER( mbeeic )   /* Microbee 32 IC                           */
588   DRIVER( mbeepc )   /* Microbee 32 PC                           */
589   DRIVER( mbeepc85 )   /* Microbee 32 PC85                           */
590   DRIVER( mbee56 )   /* Microbee 56K (CP/M)                        */
586//0128u7   DRIVER( mbee )      /* Microbee 16 Standard or Plus                  */
587//0128u7   DRIVER( mbeeic )   /* Microbee 32 IC                           */
588//0128u7   DRIVER( mbeepc )   /* Microbee 32 PC                           */
589//0128u7   DRIVER( mbeepc85 )   /* Microbee 32 PC85                           */
590//0128u7   DRIVER( mbee56 )   /* Microbee 56K (CP/M)                        */
591591
592592   /* TANDY RADIO SHACK */
593593   DRIVER( trs80 )      /* TRS-80 Model I - Level I BASIC               */
r3957r3958
622622   /* system 80 trs80 compatible */
623623
624624   /* VIDEO TECHNOLOGY */
625   DRIVER( crvision )   /* 1981 creatiVision                        */
626   DRIVER( fnvision )   /* 1983 FunVision                           */
627   DRIVER( laser110 )   /* 1983 Laser 110                           */
628   DRIVER( las110de )   /* 1983 Sanyo Laser 110 (Germany)               */
629   DRIVER( laser200 )   /* 1983 Laser 200 (color version of 110)         */
625//0128u7   DRIVER( crvision )   /* 1981 creatiVision                        */
626//0128u7   DRIVER( fnvision )   /* 1983 FunVision                           */
627//0128u7   DRIVER( laser110 )   /* 1983 Laser 110                           */
628//0128u7   DRIVER( las110de )   /* 1983 Sanyo Laser 110 (Germany)               */
629//0128u7   DRIVER( laser200 )   /* 1983 Laser 200 (color version of 110)         */
630630//   DRIVER( vz200de )   /* 1983 VZ-200 (Germany)                     */
631   DRIVER( fellow )   /* 1983 Salora Fellow (Finland)                */
632   DRIVER( tx8000 )   /* 1983 Texet TX-8000 (U.K.)                  */
633   DRIVER( laser210 )   /* 1984 Laser 210 (200 with more memory)         */
634   DRIVER( las210de )   /* 1984 Sanyo Laser 210 (Germany)               */
635   DRIVER( vz200 )      /* 1984 Dick Smith Electronics VZ-200            */
636   DRIVER( laser310 )   /* 1984 Laser 310 (210 with diff. keyboard and RAM)   */
637   DRIVER( vz300 )      /* 1984 Dick Smith Electronics VZ-300            */
638   DRIVER( laser350 )   /* 1984? Laser 350                           */
639   DRIVER( laser500 )   /* 1984? Laser 500                           */
640   DRIVER( laser700 )   /* 1984? Laser 700                           */
631//0128u7   DRIVER( fellow )   /* 1983 Salora Fellow (Finland)                */
632//0128u7   DRIVER( tx8000 )   /* 1983 Texet TX-8000 (U.K.)                  */
633//0128u7   DRIVER( laser210 )   /* 1984 Laser 210 (200 with more memory)         */
634//0128u7   DRIVER( las210de )   /* 1984 Sanyo Laser 210 (Germany)               */
635//0128u7   DRIVER( vz200 )      /* 1984 Dick Smith Electronics VZ-200            */
636//0128u7   DRIVER( laser310 )   /* 1984 Laser 310 (210 with diff. keyboard and RAM)   */
637//0128u7   DRIVER( vz300 )      /* 1984 Dick Smith Electronics VZ-300            */
638//0128u7   DRIVER( laser350 )   /* 1984? Laser 350                           */
639//0128u7   DRIVER( laser500 )   /* 1984? Laser 500                           */
640//0128u7   DRIVER( laser700 )   /* 1984? Laser 700                           */
641641
642642   /* TANGERINE */
643643   DRIVER( microtan )   /* 1979 Microtan 65                           */
r3957r3958
787787
788788
789789   /* NASCOM MICROCOMPUTERS */
790   DRIVER( nascom1 )   /* 1978 Nascom 1                           */
791   DRIVER( nascom2 )   /* 1979 Nascom 2                           */
790//0128u7   DRIVER( nascom1 )   /* 1978 Nascom 1                           */
791//0128u7   DRIVER( nascom2 )   /* 1979 Nascom 2                           */
792792
793793   /* MILES GORDON TECHNOLOGY */
794794   DRIVER( samcoupe )   /* 1989 Sam Coupe                           */
r3957r3958
884884   DRIVER(compis)      /* 1985 Telenova Compis                        */
885885
886886   /* Multitech */
887   DRIVER(mpf1)      /* 1979 Multitech Micro Professor 1               */
888   DRIVER(mpf1b)      /* 1979 Multitech Micro Professor 1B            */
887//0128u7   DRIVER(mpf1)      /* 1979 Multitech Micro Professor 1               */
888//0128u7   DRIVER(mpf1b)      /* 1979 Multitech Micro Professor 1B            */
889889
890890   /* Telercas Oy */
891891//   DRIVER(tmc1800)
r3957r3958
903903   DRIVER( tx0_8kw )   /* 1962 MIT TX-0 (8kw RAM)                     */
904904
905905   /* Luxor Datorer AB */
906   DRIVER( abc80 )
907   DRIVER( abc802 )
908   DRIVER( abc800m )
909   DRIVER( abc800c )
910   DRIVER( abc806 )
906//0128u7   DRIVER( abc80 )
907//0128u7   DRIVER( abc802 )
908//0128u7   DRIVER( abc800m )
909//0128u7   DRIVER( abc800c )
910//0128u7   DRIVER( abc806 )
911911
912912   /* Be Incorporated */
913913   DRIVER( bebox )      /* BeBox Dual603-66                           */
r3957r3958
917917   DRIVER( gamecom )   /* Tiger Game.com                           */
918918
919919   /* Thomson */
920   DRIVER( t9000 )      /* 1980 Thomson T9000 (TO7 prototype)            */
921   DRIVER( to7 )      /* 1982 Thomson TO7                           */
922   DRIVER( to770 )      /* 1984 Thomson TO7/70                        */
923   DRIVER( to770a )   /* 198? Thomson TO7/70 arabic version            */
924   DRIVER( mo5 )      /* 1984 Thomson MO5                           */
925   DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)            */
926   DRIVER( to9 )      /* 1985 Thomson T09                           */
927   DRIVER( to8 )      /* 1986 Thomson T08                           */
928   DRIVER( to8d )      /* 1987 Thomson T08D                        */
929   DRIVER( to9p )      /* 1986 Thomson T09+                        */
930   DRIVER( mo6 )      /* 1986 Thomson MO6                           */
931   DRIVER( mo5nr )      /* 1986 Thomson MO5 NR                        */
932   DRIVER( pro128 )   /* 1986 Olivetti Prodest PC 128                  */
920//0128u7   DRIVER( t9000 )      /* 1980 Thomson T9000 (TO7 prototype)            */
921//0128u7   DRIVER( to7 )      /* 1982 Thomson TO7                           */
922//0128u7   DRIVER( to770 )      /* 1984 Thomson TO7/70                        */
923//0128u7   DRIVER( to770a )   /* 198? Thomson TO7/70 arabic version            */
924//0128u7   DRIVER( mo5 )      /* 1984 Thomson MO5                           */
925//0128u7   DRIVER( mo5e )      /* 1986 Thomson MO5E (export version)            */
926//0128u7   DRIVER( to9 )      /* 1985 Thomson T09                           */
927//0128u7   DRIVER( to8 )      /* 1986 Thomson T08                           */
928//0128u7   DRIVER( to8d )      /* 1987 Thomson T08D                        */
929//0128u7   DRIVER( to9p )      /* 1986 Thomson T09+                        */
930//0128u7   DRIVER( mo6 )      /* 1986 Thomson MO6                           */
931//0128u7   DRIVER( mo5nr )      /* 1986 Thomson MO5 NR                        */
932//0128u7   DRIVER( pro128 )   /* 1986 Olivetti Prodest PC 128                  */
933933
934934   /* Cybiko, Inc. */
935935//   DRIVER( cybikov1 )   /* Cybiko Wireless Intertainment System - Classic V1 */
r3957r3958
937937//   DRIVER( cybikoxt )   /* Cybiko Wireless Intertainment System - Xtreme     */
938938
939939   /* Dick Smith */
940   DRIVER( super80 )
941   DRIVER( super80d )
942   DRIVER( super80e )
943   DRIVER( super80m )
944   DRIVER( super80r )
945   DRIVER( super80v )
940//0128u7   DRIVER( super80 )
941//0128u7   DRIVER( super80d )
942//0128u7   DRIVER( super80e )
943//0128u7   DRIVER( super80m )
944//0128u7   DRIVER( super80r )
945//0128u7   DRIVER( super80v )
946946
947947   /* Galeb */
948948   DRIVER( galeb )
src/mess/device.c
r3957r3958
294294      case DEVINFO_FCT_GET_NAME:            info->f = (genf *) DEVICE_GET_NAME_NAME(mess_device);   break;
295295
296296      /* --- the following bits of info are returned as NULL-terminated strings --- */
297      case DEVINFO_STR_NAME:               info->s = "Legacy MESS Device";               break;
298      case DEVINFO_STR_FAMILY:            info->s = "Legacy MESS Device";               break;
299      case DEVINFO_STR_VERSION:            info->s = "1.0";                        break;
300      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                        break;
301      case DEVINFO_STR_CREDITS:            info->s = "Copyright the MESS Team";         break;
302      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:   info->s = mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_FILE_EXTENSIONS); break;
303      case DEVINFO_STR_IMAGE_INSTANCE_NAME:   info->s = mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_NAME + mess_device->io_device.index_in_device); break;
304      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   info->s = mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_SHORT_NAME + mess_device->io_device.index_in_device); break;
297      case DEVINFO_STR_NAME:               strcpy(info->s, "Legacy MESS Device");               break;
298      case DEVINFO_STR_FAMILY:            strcpy(info->s, "Legacy MESS Device");               break;
299      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                        break;
300      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                        break;
301      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright the MESS Team");         break;
302      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_FILE_EXTENSIONS)); break;
303      case DEVINFO_STR_IMAGE_INSTANCE_NAME:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_NAME + mess_device->io_device.index_in_device)); break;
304      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_SHORT_NAME + mess_device->io_device.index_in_device)); break;
305305
306306      default:
307307         if ((state >= DEVINFO_PTR_IMAGE_CREATE_OPTSPEC) && (state < DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + DEVINFO_CREATE_OPTMAX))
r3957r3958
406406      }
407407
408408      /* create a bonafide MAME device */
409      device = device_list_add(listheadptr, MESS_DEVICE, mame_tag);
409      device = device_list_add(listheadptr, NULL, MESS_DEVICE, mame_tag, 0);
410410      mess_device = (mess_device_config *) device->inline_config;
411411
412412      /* we need to copy the mess_tag into the structure */
r3957r3958
656656
657657
658658
659const device_config *image_from_devtype_and_index(iodevice_t type, int id)
659const device_config *image_from_devtype_and_index(running_machine *machine, iodevice_t type, int id)
660660{
661661   const device_config *image = NULL;
662662   const device_config *dev;
663663   const legacy_mess_device *iodev;
664664
665   for (dev = device_list_first(Machine->config->devicelist, MESS_DEVICE); dev != NULL; dev = device_list_next(dev, MESS_DEVICE))
665   for (dev = device_list_first(machine->config->devicelist, MESS_DEVICE); dev != NULL; dev = device_list_next(dev, MESS_DEVICE))
666666   {
667667      iodev = mess_device_from_core_device(dev);
668668      if ((type == iodev->type) && (iodev->index_in_device == id))
src/mess/device.h
r3957r3958
209209
210210/* deprecated device access functions that assume one device of any given type */
211211iodevice_t image_devtype(const device_config *device);
212const device_config *image_from_devtype_and_index(iodevice_t type, int id);
212const device_config *image_from_devtype_and_index(running_machine *machine, iodevice_t type, int id);
213213
214214/* diagnostics */
215215int device_valididtychecks(void);
src/mess/machine/applefdc.c
r3957r3958
627627      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(applefdc);   break;
628628
629629      /* --- the following bits of info are returned as NULL-terminated strings --- */
630      case DEVINFO_STR_FAMILY:                  info->s = "Apple FDC";                  break;
631      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
632      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
630      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Apple FDC");                  break;
631      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
632      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
633633   }
634634}
635635
r3957r3958
658658   switch (state)
659659   {
660660      /* --- the following bits of info are returned as NULL-terminated strings --- */
661      case DEVINFO_STR_NAME:                     info->s = "Apple FDC";            break;
661      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple FDC");            break;
662662
663663      /* --- the following bits of info are returned as pointers to data or functions --- */
664664      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(oldfdc);   break;
r3957r3958
692692   switch (state)
693693   {
694694      /* --- the following bits of info are returned as NULL-terminated strings --- */
695      case DEVINFO_STR_NAME:                     info->s = "Apple IWM (Integrated Woz Machine)";            break;
695      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple IWM (Integrated Woz Machine)");            break;
696696
697697      /* --- the following bits of info are returned as pointers to data or functions --- */
698698      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(iwm);   break;
r3957r3958
726726   switch (state)
727727   {
728728      /* --- the following bits of info are returned as NULL-terminated strings --- */
729      case DEVINFO_STR_NAME:                     info->s = "Apple SWIM (Steve Woz Integrated Machine)";            break;
729      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple SWIM (Steve Woz Integrated Machine)");            break;
730730
731731      /* --- the following bits of info are returned as pointers to data or functions --- */
732732      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(swim);   break;
src/mess/machine/conkort.c
r3957r3958
153153
154154static const device_config *get_floppy_image(int drive)
155155{
156   return image_from_devtype_and_index(IO_FLOPPY, drive);
156   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
157157}
158158
159159/* Slow Controller */
r3957r3958
662662
663663static const z80dma_interface dma_intf =
664664{
665   Z80DMA_CPUNUM,      /* cpunum to HALT */
666   XTAL_16MHz/4,      /* chip clock */
665   CONKORT_Z80_TAG,      /* cpunum to HALT */
667666   dma_port_a_r,      /* memory read */
668667   dma_port_a_w,      /* memory write */
669668   dma_port_a_r,      /* port A read */
r3957r3958
743742   MDRV_CPU_IO_MAP(fast_io_map, 0)
744743   MDRV_CPU_CONFIG(fast_daisy_chain)
745744
746   MDRV_DEVICE_ADD(CONKORT_Z80DMA_TAG, Z80DMA)
747   MDRV_DEVICE_CONFIG(dma_intf)
745   MDRV_Z80DMA_ADD(CONKORT_Z80DMA_TAG, XTAL_16MHz/4, dma_intf)
748746   
749747   MDRV_WD1793_ADD("wd1793", fast_wd17xx_interface )   
750748MACHINE_DRIVER_END
r3957r3958
861859      case DEVINFO_FCT_ABCBUS_CARD_SELECT:         info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_10828);   break;
862860
863861      /* --- the following bits of info are returned as NULL-terminated strings --- */
864      case DEVINFO_STR_NAME:                     info->s = "Luxor 55 10828-01";                        break;
865      case DEVINFO_STR_FAMILY:                  info->s = "Luxor ABC";                              break;
866      case DEVINFO_STR_VERSION:                  info->s = "1.0";                                 break;
867      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                                 break;
868      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";                   break;
862      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor 55 10828-01");                        break;
863      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                              break;
864      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                                 break;
865      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                                 break;
866      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");                   break;
869867   }
870868}
871869
r3957r3958
930928      case DEVINFO_FCT_ABCBUS_CARD_SELECT:         info->f = (genf *)ABCBUS_CARD_SELECT_NAME(luxor_55_21046);   break;
931929
932930      /* --- the following bits of info are returned as NULL-terminated strings --- */
933      case DEVINFO_STR_NAME:                     info->s = "Luxor Conkort 55 21046-xx";                  break;
934      case DEVINFO_STR_FAMILY:                  info->s = "Luxor ABC";                              break;
935      case DEVINFO_STR_VERSION:                  info->s = "1.0";                                 break;
936      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                                 break;
937      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";                   break;
931      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor Conkort 55 21046-xx");                  break;
932      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");                              break;
933      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                                 break;
934      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                                 break;
935      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");                   break;
938936   }
939937}
src/mess/machine/hp48.c
r3957r3958
11001100   case DEVINFO_FCT_IMAGE_LOAD:            info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( hp48_port );    break;
11011101   case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME( hp48_port );  break;
11021102   case DEVINFO_FCT_IMAGE_CREATE:            info->f = (genf *) DEVICE_IMAGE_CREATE_NAME( hp48_port );  break;
1103   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   info->s = conf ? conf->brief_name : "";                    break;
1104   case DEVINFO_STR_IMAGE_INSTANCE_NAME:         info->s = conf ? conf->name : "";                          break;
1105   case DEVINFO_STR_NAME:                    info->s = "HP48 memory card";                            break;
1106   case DEVINFO_STR_FAMILY:                      info->s = "HP48 memory card";                            break;
1107   case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                                        break;
1108   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "crd";                                           break;
1103   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   strcpy(info->s, conf ? conf->brief_name : "");                    break;
1104   case DEVINFO_STR_IMAGE_INSTANCE_NAME:         strcpy(info->s, conf ? conf->name : "");                          break;
1105   case DEVINFO_STR_NAME:                   strcpy( info->s, "HP48 memory card");                            break;
1106   case DEVINFO_STR_FAMILY:                      strcpy(info->s, "HP48 memory card");                            break;
1107   case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);                                        break;
1108   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "crd");                                           break;
11091109   }
11101110}
11111111
src/mess/machine/applefdc.h
r3957r3958
7575***************************************************************************/
7676
7777#define MDRV_APPLEFDC_ADD(_tag, _intrf) \
78   MDRV_DEVICE_ADD(_tag, APPLEFDC) \
78   MDRV_DEVICE_ADD(_tag, APPLEFDC, 0) \
7979   MDRV_DEVICE_CONFIG(_intrf)
8080
8181#define MDRV_APPLEFDC_MODIFY(_tag, _intrf) \
r3957r3958
8686  MDRV_DEVICE_REMOVE(_tag, APPLEFDC)
8787 
8888#define MDRV_IWM_ADD(_tag, _intrf) \
89   MDRV_DEVICE_ADD(_tag, IWM) \
89   MDRV_DEVICE_ADD(_tag, IWM, 0) \
9090   MDRV_DEVICE_CONFIG(_intrf)
9191
9292#define MDRV_IWM_MODIFY(_tag, _intrf) \
r3957r3958
9797  MDRV_DEVICE_REMOVE(_tag, IWM)
9898 
9999#define MDRV_SWIM_ADD(_tag, _intrf) \
100   MDRV_DEVICE_ADD(_tag, SWIM) \
100   MDRV_DEVICE_ADD(_tag, SWIM, 0) \
101101   MDRV_DEVICE_CONFIG(_intrf)
102102
103103#define MDRV_SWIM_MODIFY(_tag, _intrf) \
src/mess/machine/ap2_slot.c
r3957r3958
161161      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
162162
163163      /* --- the following bits of info are returned as NULL-terminated strings --- */
164      case DEVINFO_STR_NAME:                     info->s = "Apple II Slot";               break;
165      case DEVINFO_STR_FAMILY:                  info->s = "Apple II Slot";               break;
166      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
167      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
164      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple II Slot");               break;
165      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Apple II Slot");               break;
166      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
167      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
168168   }
169169}
src/mess/machine/mockngbd.c
r3957r3958
131131
132132      default:
133133         if (LOG_MOCKINGBOARD)
134            logerror("mockingboard_r unmapped, offset: %02x, pc: %04x\n", offset, (unsigned) cpu_get_reg(device->machine->cpu[0], REG_PC));
134            logerror("mockingboard_r unmapped, offset: %02x, pc: %s\n", offset, cpuexec_describe_context(device->machine));
135135         break;
136136   }
137137   return 0x00;
r3957r3958
229229      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(mockingboard);   break;
230230
231231      /* --- the following bits of info are returned as NULL-terminated strings --- */
232      case DEVINFO_STR_NAME:                     info->s = "Apple II Mockingboard";         break;
233      case DEVINFO_STR_FAMILY:                  info->s = "Apple II Mockingboard";         break;
234      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
235      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
232      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple II Mockingboard");         break;
233      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Apple II Mockingboard");         break;
234      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
235      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
236236   }
237237}
src/mess/machine/apple3.c
r3957r3958
739739   /* the Apple /// does some weird tricks whereby it monitors the SYNC pin
740740    * on the CPU to check for indexed instructions and directs them to
741741    * different memory locations */
742   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6502_READINDEXED_CALLBACK, (genf *) apple3_indexed_read);
743   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK, (genf *) apple3_indexed_write);
742   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6502_READINDEXED_CALLBACK, (genf *) apple3_indexed_read);
743   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6502_WRITEINDEXED_CALLBACK, (genf *) apple3_indexed_write);
744744}
src/mess/machine/ap2_slot.h
r3957r3958
3939***************************************************************************/
4040
4141#define MDRV_APPLE2_SLOT_ADD(_slot_number, _slot_device_tag, _rh, _wh)      \
42   MDRV_DEVICE_ADD("slot_" #_slot_number, APPLE2_SLOT)         \
42   MDRV_DEVICE_ADD("slot_" #_slot_number, APPLE2_SLOT, 0)         \
4343   MDRV_DEVICE_CONFIG_DATAPTR(apple2_slot_config, tag, _slot_device_tag)   \
4444   MDRV_DEVICE_CONFIG_DATAPTR(apple2_slot_config, rh, _rh)      \
4545   MDRV_DEVICE_CONFIG_DATAPTR(apple2_slot_config, wh, _wh)      \
src/mess/machine/mockngbd.h
r3957r3958
1919#define MOCKINGBOARD      DEVICE_GET_INFO_NAME(mockingboard)
2020
2121#define MDRV_MOCKINGBOARD_ADD(_tag)   \
22   MDRV_DEVICE_ADD((_tag), MOCKINGBOARD)
22   MDRV_DEVICE_ADD((_tag), MOCKINGBOARD, 0)
2323
2424
2525/***************************************************************************
src/mess/machine/c65.c
r3957r3958
658658   read8_space_func rh4, rh8;
659659   write8_space_func wh5, wh9;
660660
661   data = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
661   data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
662662   if (data == old)
663663      return;
664664
src/mess/machine/dai.c
r3957r3958
5353
5454static TIMER_CALLBACK(dai_bootstrap_callback)
5555{
56   cpu_set_reg(machine->cpu[0], I8080_PC, 0xc000);
56   cpu_set_reg(machine->cpu[0], REG_GENPC, 0xc000);
5757}
5858
5959static UINT8 dai_keyboard_scan_mask = 0;
src/mess/machine/ncr5380.c
r3957r3958
372372   // try to open the devices
373373   for (i = 0; i < interface->scsidevs->devs_present; i++)
374374   {
375      SCSIAllocInstance( interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
375      SCSIAllocInstance( machine, interface->scsidevs->devices[i].scsiClass, &devices[interface->scsidevs->devices[i].scsiID], interface->scsidevs->devices[i].diskregion );
376376   }
377377
378378   state_save_register_item_array(machine, "ncr5380", NULL, 0, n5380_Registers);
r3957r3958
472472      case DEVINFO_FCT_RESET:            info->reset = DEVICE_RESET_NAME(ncr5380);   break;
473473
474474      /* --- the following bits of info are returned as NULL-terminated strings --- */
475      case DEVINFO_STR_NAME:            info->s = "NCR 5380";               break;
476      case DEVINFO_STR_FAMILY:         info->s = "NCR53xx";               break;
477      case DEVINFO_STR_VERSION:         info->s = "1.1";               break;
478      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;               break;
479      case DEVINFO_STR_CREDITS:         info->s = "Copyright the MAME and MESS Teams"; break;
475      case DEVINFO_STR_NAME:            strcpy(info->s, "NCR 5380");               break;
476      case DEVINFO_STR_FAMILY:         strcpy(info->s, "NCR53xx");               break;
477      case DEVINFO_STR_VERSION:         strcpy(info->s, "1.1");               break;
478      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);               break;
479      case DEVINFO_STR_CREDITS:         strcpy(info->s, "Copyright the MAME and MESS Teams"); break;
480480   }
481481}
482482#endif
src/mess/machine/adam.c
r3957r3958
560560
561561         if (deviceNum>=4 && deviceNum<=7)
562562         {
563            image = image_from_devtype_and_index(IO_FLOPPY, deviceNum - 4);
563            image = image_from_devtype_and_index(machine, IO_FLOPPY, deviceNum - 4);
564564            if (image_exists(image))
565565               ram[statusDCB+20] = (ram[statusDCB+20]&0xF0); /* Inserted Media */
566566            else
r3957r3958
582582               }
583583               else if (deviceNum>=4 && deviceNum<=7)
584584               {
585                  image = image_from_devtype_and_index(IO_FLOPPY, deviceNum - 4);
585                  image = image_from_devtype_and_index(machine, IO_FLOPPY, deviceNum - 4);
586586                  if (image_exists(image))
587587                  {
588588                     ram[statusDCB] = 0x80;
r3957r3958
643643               }
644644               else if (deviceNum>=4 && deviceNum<=7)
645645               {
646                  image = image_from_devtype_and_index(IO_FLOPPY, deviceNum - 4);
646                  image = image_from_devtype_and_index(machine, IO_FLOPPY, deviceNum - 4);
647647                  if (image_exists(image))
648648                  {
649649                     sectorNmbr = ((ram[statusDCB+5])+(ram[statusDCB+6]<<8)+(ram[statusDCB+7]<<16)+(ram[statusDCB+8]<<24))<<1;
src/mess/machine/cbmb.c
r3957r3958
252252const cia6526_interface cbmb_cia =
253253{
254254   cbmb_tpi6525_0_irq2_level,
255   0.0, 60,
255   60,
256256
257257   {
258258      { cbmb_cia_port_a_r, cbmb_cia_port_a_w },
src/mess/machine/pokemini.c
r3957r3958
12201220            Bit 7   R/W IR received bit (mirror, if device not selected: 0)
12211221         */
12221222      if ( pm_reg[0x60] & 0x04 )
1223         i2cmem_write( 0, I2CMEM_SDA, ( data & 0x04 ) ? 1 : 0 );
1223         i2cmem_write( space->machine, 0, I2CMEM_SDA, ( data & 0x04 ) ? 1 : 0 );
12241224
12251225      if ( pm_reg[0x60] & 0x08 )
1226         i2cmem_write( 0, I2CMEM_SCL, ( data & 0x08 ) ? 1 : 0 );
1226         i2cmem_write( space->machine, 0, I2CMEM_SCL, ( data & 0x08 ) ? 1 : 0 );
12271227      break;
12281228   case 0x70:   /* Sound related */
12291229      pm_reg[0x70] = data;
r3957r3958
13841384   case 0x61:
13851385      if ( ! ( pm_reg[0x60] & 0x04 ) )
13861386      {
1387         data = ( data & ~ 0x04 ) | ( i2cmem_read( 0, I2CMEM_SDA ) ? 0x04 : 0x00 );
1387         data = ( data & ~ 0x04 ) | ( i2cmem_read( space->machine, 0, I2CMEM_SDA ) ? 0x04 : 0x00 );
13881388      }
13891389
13901390      if ( ! ( pm_reg[0x60] & 0x08 ) )
src/mess/machine/coco.c
r3957r3958
629629      if (preamble != 0)
630630      {
631631         /* start address - just set the address and return */
632         cpu_set_reg(image->machine->cpu[0], REG_PC, block_address);
632         cpu_set_reg(image->machine->cpu[0], REG_GENPC, block_address);
633633         done = TRUE;
634634      }
635635      else
r3957r3958
11331133#define SOUNDMUX_STATUS_SEL2   2
11341134#define SOUNDMUX_STATUS_SEL1   1
11351135
1136static const device_config *cartslot_image(void)
1136static const device_config *cartslot_image(running_machine *machine)
11371137{
1138   return image_from_devtype_and_index(IO_CARTSLOT, 0);
1138   return image_from_devtype_and_index(machine, IO_CARTSLOT, 0);
11391139}
11401140
11411141static const device_config *cassette_device_image(running_machine *machine)
r3957r3958
27492749    generic_mapmemory
27502750-------------------------------------------------*/
27512751
2752static void generic_mapmemory(coco_cartridge *cartridge, UINT32 offset, UINT32 mask, UINT8 *cartmem, UINT32 cartmem_size)
2752static void generic_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask, UINT8 *cartmem, UINT32 cartmem_size)
27532753{
2754   const device_config *image = cartslot_image();
2754   const device_config *image = cartslot_image(machine);
27552755   const UINT8 *cart_ptr;
27562756   UINT32 cart_size, i;
27572757
r3957r3958
27732773
27742774static void coco_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask)
27752775{
2776   generic_mapmemory(cartridge, offset, mask, &coco_rom[0x4000], 0x3FFF);
2776   generic_mapmemory(machine, cartridge, offset, mask, &coco_rom[0x4000], 0x3FFF);
27772777}
27782778
27792779
r3957r3958
27842784
27852785static void coco3_mapmemory(running_machine *machine, coco_cartridge *cartridge, UINT32 offset, UINT32 mask)
27862786{
2787   generic_mapmemory(cartridge, offset, mask, &coco_rom[0xC000], 0x3FFF);
2787   generic_mapmemory(machine, cartridge, offset, mask, &coco_rom[0xC000], 0x3FFF);
27882788}
27892789
27902790
r3957r3958
28862886   halt_timer = timer_alloc(machine, halt_timer_proc, NULL);
28872887
28882888   /* determine which cartridge hardware we should be using */
2889   cart_image = cartslot_image();
2889   cart_image = cartslot_image(machine);
28902890   if (image_exists(cart_image))
28912891   {
28922892      /* we have a mounted cartridge; check the extra info */
src/mess/machine/tc8521.c
r3957r3958
560560      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
561561
562562      /* --- the following bits of info are returned as NULL-terminated strings --- */
563      case DEVINFO_STR_NAME:                     info->s = "Toshiba 8521 RTC";            break;
564      case DEVINFO_STR_FAMILY:                  info->s = "Toshiba 8521 RTC";            break;
565      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
566      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
563      case DEVINFO_STR_NAME:                     strcpy(info->s, "Toshiba 8521 RTC");      break;
564      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Toshiba 8521 RTC");      break;
565      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
566      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
567567      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
568568   }
569569}
src/mess/machine/mc6854.c
r3957r3958
10491049      case DEVINFO_FCT_RESET:            info->reset = DEVICE_RESET_NAME(mc6854);   break;
10501050
10511051      /* --- the following bits of info are returned as NULL-terminated strings --- */
1052      case DEVINFO_STR_NAME:            info->s = "Motorola MC6854 ADLC";      break;
1053      case DEVINFO_STR_FAMILY:         info->s = "MC6854";            break;
1054      case DEVINFO_STR_VERSION:         info->s = "1.00";            break;
1055      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;            break;
1056      case DEVINFO_STR_CREDITS:         info->s = "Copyright the MAME and MESS Teams";  break;
1052      case DEVINFO_STR_NAME:            strcpy(info->s, "Motorola MC6854 ADLC");      break;
1053      case DEVINFO_STR_FAMILY:         strcpy(info->s, "MC6854");            break;
1054      case DEVINFO_STR_VERSION:         strcpy(info->s, "1.00");            break;
1055      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
1056      case DEVINFO_STR_CREDITS:         strcpy(info->s, "Copyright the MAME and MESS Teams");  break;
10571057   }
10581058}
src/mess/machine/gb.c
r3957r3958
402402   /* NOTE: The reason we save the carts RAM this way instead of using MAME's
403403      built in macros is because they force the filename to be the name of
404404      the machine.  We need to have a separate name for each game. */
405   image_battery_save(image_from_devtype_and_index(IO_CARTSLOT, 0), gb_cart_ram, RAMBanks * 0x2000 );
405   image_battery_save(image_from_devtype_and_index(machine, IO_CARTSLOT, 0), gb_cart_ram, RAMBanks * 0x2000 );
406406}
407407
408408static void gb_set_mbc1_banks( running_machine *machine ) {
src/mess/machine/tc8521.h
r3957r3958
1717#define TC8521         DEVICE_GET_INFO_NAME(tc8521)
1818
1919#define MDRV_TC8521_ADD(_tag, _intrf) \
20   MDRV_DEVICE_ADD(_tag, TC8521) \
20   MDRV_DEVICE_ADD(_tag, TC8521, 0) \
2121   MDRV_DEVICE_CONFIG(_intrf)
2222
2323#define MDRV_TC8521_REMOVE(_tag) \
src/mess/machine/mc6854.h
r3957r3958
5050
5151
5252#define MDRV_MC6854_ADD(_tag, _intrf) \
53  MDRV_DEVICE_ADD(_tag, MC6854)         \
53  MDRV_DEVICE_ADD(_tag, MC6854, 0)         \
5454  MDRV_DEVICE_CONFIG(_intrf)
5555
5656#define MDRV_MC6854_REMOVE(_tag)      \
src/mess/machine/990_hd.c
r3957r3958
10331033};
10341034
10351035MACHINE_DRIVER_START( ti990_hdc )
1036   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
1036   MDRV_DEVICE_ADD( "harddisk1", HARDDISK, 0 )
10371037   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1038   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
1038   MDRV_DEVICE_ADD( "harddisk2", HARDDISK, 0 )
10391039   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1040   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
1040   MDRV_DEVICE_ADD( "harddisk3", HARDDISK, 0 )
10411041   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1042   MDRV_DEVICE_ADD( "harddisk4", HARDDISK )
1042   MDRV_DEVICE_ADD( "harddisk4", HARDDISK, 0 )
10431043   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
10441044MACHINE_DRIVER_END
10451045
src/mess/machine/99_dsk.c
r3957r3958
359359
360360   for (id=0; id<MAX_FLOPPIES; id++)
361361   {
362      image = image_from_devtype_and_index(IO_FLOPPY, id);
362      image = image_from_devtype_and_index(machine, IO_FLOPPY, id);
363363      floppy_install_tracktranslate_proc(image, ti99_tracktranslate);
364364   }
365365}
src/mess/machine/gamecom.c
r3957r3958
384384
385385READ8_HANDLER( gamecom_internal_r )
386386{
387   /* NPW 22-Dec-2008 - Shouldn't this entire function be moved to an internal memory map of the CPU core? */
387388   if ( offset >= 0x80 )
388389   {
389390      return internal_ram[offset];
r3957r3958
395396   case SM8521_R4:  case SM8521_R5:  case SM8521_R6:  case SM8521_R7:
396397   case SM8521_R8:  case SM8521_R9:  case SM8521_R10: case SM8521_R11:
397398   case SM8521_R12: case SM8521_R13: case SM8521_R14: case SM8521_R15:
398      return sm85cpu_mem_readbyte( offset );
399      return 0;   /* NPW 22-Dec-2008 - Not sure what to do here */
400      /*return sm85cpu_mem_readbyte( state, offset );*/
399401   case SM8521_IE0:   return cpu_get_reg( space->machine->cpu[0], SM8500_IE0 );
400402   case SM8521_IE1:   return cpu_get_reg( space->machine->cpu[0], SM8500_IE1 );
401403   case SM8521_IR0:   return cpu_get_reg( space->machine->cpu[0], SM8500_IR0 );
r3957r3958
512514   Their usage is also not explained properly in the manuals. Guess we'll have to wait
513515   for them to show up in some rom images...
514516 */
515void gamecom_handle_dma( int cycles )
517void gamecom_handle_dma( const device_config *device, int cycles )
516518{
517519   unsigned y_count, x_count;
518520   /* If not enabled, ignore */
r3957r3958
603605      gamecom_dma.dest_current = gamecom_dma.dest_line;
604606   }
605607   gamecom_dma.enabled = 0;
606   cpu_set_input_line(Machine->cpu[0], DMA_INT, HOLD_LINE );
608   cpu_set_input_line(device->machine->cpu[0], DMA_INT, HOLD_LINE );
607609}
608610
609void gamecom_update_timers( int cycles )
611void gamecom_update_timers( const device_config *device, int cycles )
610612{
611613   if ( gamecom_timer[0].enabled )
612614   {
r3957r3958
618620         if ( gamecom_timer[0].counter == gamecom_timer[0].check_value )
619621         {
620622            gamecom_timer[0].counter = 0;
621            cpu_set_input_line(Machine->cpu[0], TIM0_INT, HOLD_LINE );
623            cpu_set_input_line(device->machine->cpu[0], TIM0_INT, HOLD_LINE );
622624         }
623625      }
624626   }
r3957r3958
632634         if ( gamecom_timer[1].counter == gamecom_timer[1].check_value )
633635         {
634636            gamecom_timer[1].counter = 0;
635            cpu_set_input_line(Machine->cpu[0], TIM1_INT, HOLD_LINE );
637            cpu_set_input_line(device->machine->cpu[0], TIM1_INT, HOLD_LINE );
636638         }
637639      }
638640   }
r3957r3958
650652
651653DEVICE_START( gamecom_cart )
652654{
653   internal_ram = sm8500_internal_ram();
655   internal_ram = device_get_info_ptr(device->machine->cpu[0], CPUINFO_PTR_SM8500_INTERNAL_RAM);
654656   return DEVICE_START_OK;
655657}
656658
src/mess/machine/ins8154.c
r3957r3958
256256      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME(ins8154);      break;
257257
258258      /* --- the following bits of info are returned as NULL-terminated strings --- */
259      case DEVINFO_STR_NAME:               info->s = "National Semiconductor INS8154";      break;
260      case DEVINFO_STR_FAMILY:            info->s = "INS8154";                     break;
261      case DEVINFO_STR_VERSION:            info->s = "1.0";                        break;
262      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                        break;
263      case DEVINFO_STR_CREDITS:            info->s = "Copyright MESS Team";            break;
259      case DEVINFO_STR_NAME:               strcpy(info->s, "National Semiconductor INS8154");      break;
260      case DEVINFO_STR_FAMILY:            strcpy(info->s, "INS8154");                  break;
261      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                     break;
262      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                  break;
263      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright MESS Team");         break;
264264   }
265265}
src/mess/machine/radio86.c
r3957r3958
149149const dma8257_interface radio86_dma =
150150{
151151   0,
152   XTAL_16MHz / 9,
153152
154153   radio86_dma_read_byte,
155154   0,
r3957r3958
168167
169168READ8_HANDLER (radio_cpu_state_r )
170169{
171   return cpu_get_reg(space->cpu, I8080_STATUS);   
170   return cpu_get_reg(space->cpu, I8085_STATUS);   
172171}
173172
174173READ8_HANDLER (radio_io_r )
src/mess/machine/ins8154.h
r3957r3958
5454***************************************************************************/
5555
5656#define MDRV_INS8154_ADD(_tag, _intrf) \
57   MDRV_DEVICE_ADD(_tag, INS8154) \
57   MDRV_DEVICE_ADD(_tag, INS8154, 0) \
5858   MDRV_DEVICE_CONFIG(_intrf)
5959
6060#endif /* INS8154_H_ */
src/mess/machine/b2m.c
r3957r3958
388388}
389389
390390
391static void b2m_sh_update(void *param,stream_sample_t **inputs, stream_sample_t **outputs,int samples)
391static STREAM_UPDATE( b2m_sh_update )
392392{
393393   INT16 channel_1_signal;
394394
src/mess/machine/74145.c
r3957r3958
155155      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(ttl74145);      break;
156156
157157      /* --- the following bits of info are returned as NULL-terminated strings --- */
158      case DEVINFO_STR_NAME:                     info->s = "TTL74145";                  break;
159      case DEVINFO_STR_FAMILY:                  info->s = "TTL74145";                  break;
160      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
161      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
162      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
158      case DEVINFO_STR_NAME:                     strcpy(info->s, "TTL74145");            break;
159      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "TTL74145");            break;
160      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
161      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
162      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
163163   }
164164}
src/mess/machine/mc6846.c
r3957r3958
636636      case DEVINFO_FCT_RESET:            info->reset = DEVICE_RESET_NAME(mc6846);   break;
637637
638638      /* --- the following bits of info are returned as NULL-terminated strings --- */
639              case DEVINFO_STR_NAME:            info->s = "Motorola MC6846 programmable timer";   break;
640      case DEVINFO_STR_FAMILY:         info->s = "MC6846";            break;
641      case DEVINFO_STR_VERSION:         info->s = "1.00";            break;
642      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;            break;
643      case DEVINFO_STR_CREDITS:         info->s = "Copyright the MAME and MESS Teams";  break;
639              case DEVINFO_STR_NAME:            strcpy(info->s, "Motorola MC6846 programmable timer");   break;
640      case DEVINFO_STR_FAMILY:         strcpy(info->s, "MC6846");            break;
641      case DEVINFO_STR_VERSION:         strcpy(info->s, "1.00");            break;
642      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
643      case DEVINFO_STR_CREDITS:         strcpy(info->s, "Copyright the MAME and MESS Teams");  break;
644644   }
645645}
src/mess/machine/cdp1871.c
r3957r3958
348348      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
349349
350350      /* --- the following bits of info are returned as NULL-terminated strings --- */
351      case DEVINFO_STR_NAME:                     info->s = "RCA CDP1871";               break;
352      case DEVINFO_STR_FAMILY:                  info->s = "RCA CDP1800";               break;
353      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
354      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
355      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
351      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1871");               break;
352      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
353      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
354      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
355      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
356356   }
357357}
src/mess/machine/8530scc.c
r3957r3958
369369      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
370370
371371      /* --- the following bits of info are returned as NULL-terminated strings --- */
372      case DEVINFO_STR_NAME:                     info->s = "Zilog 8530 SCC";               break;
373      case DEVINFO_STR_FAMILY:                  info->s = "Zilog 8530 SCC";               break;
374      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
375      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
372      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog 8530 SCC");         break;
373      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Zilog 8530 SCC");         break;
374      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
375      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
376376      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
377377   }
378378}
src/mess/machine/74145.h
r3957r3958
5555***************************************************************************/
5656
5757#define MDRV_TTL74145_ADD(_tag, _intrf) \
58   MDRV_DEVICE_ADD(_tag, TTL74145) \
58   MDRV_DEVICE_ADD(_tag, TTL74145, 0) \
5959   MDRV_DEVICE_CONFIG(_intrf)
6060
6161
src/mess/machine/mc6846.h
r3957r3958
3333
3434
3535#define MDRV_MC6846_ADD(_tag, _intrf) \
36  MDRV_DEVICE_ADD(_tag, MC6846)         \
36  MDRV_DEVICE_ADD(_tag, MC6846, 0)         \
3737  MDRV_DEVICE_CONFIG(_intrf)
3838
3939#define MDRV_MC6846_MODIFY(_tag, _intrf) \
src/mess/machine/cdp1871.h
r3957r3958
4242#define CDP1871      DEVICE_GET_INFO_NAME(cdp1871)
4343
4444#define MDRV_CDP1871_ADD(_tag, _intrf) \
45   MDRV_DEVICE_ADD(_tag, CDP1871) \
45   MDRV_DEVICE_ADD(_tag, CDP1871, 0) \
4646   MDRV_DEVICE_CONFIG(_intrf)
4747
4848#define MDRV_CDP1871_REMOVE(_tag) \
src/mess/machine/8530scc.h
r3957r3958
3535***************************************************************************/
3636
3737#define MDRV_SCC8530_ADD(_tag, _intrf) \
38   MDRV_DEVICE_ADD(_tag, SCC8530) \
38   MDRV_DEVICE_ADD(_tag, SCC8530, 0) \
3939   MDRV_DEVICE_CONFIG(_intrf)
4040
4141
src/mess/machine/kramermc.c
r3957r3958
3232
3333const z80pio_interface kramermc_z80pio_intf =
3434{
35   "main",
36   0,
3735   NULL,   /* callback when change interrupt status */
3836   kramermc_port_a_r,
3937   kramermc_port_b_r,
src/mess/machine/spectrum.c
r3957r3958
5757{
5858   /* Hack for correct handling 0xffff interrupt vector */
5959   if (address == 0x0001)
60      if (cpu_get_reg(space->machine->cpu[0], REG_PREVIOUSPC)==0xffff)
60      if (cpu_get_reg(space->machine->cpu[0], REG_GENPCBASE)==0xffff)
6161      {
6262         cpu_set_reg(space->machine->cpu[0], Z80_PC, 0xfff4);
6363         return 0xfff4;
src/mess/machine/6883sam.c
r3957r3958
299299      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(sam6883);      break;
300300
301301      /* --- the following bits of info are returned as NULL-terminated strings --- */
302      case DEVINFO_STR_NAME:                     info->s = "6883 SAM";                  break;
303      case DEVINFO_STR_FAMILY:                  info->s = "6883 SAM";                  break;
304      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
305      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
306      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
302      case DEVINFO_STR_NAME:                     strcpy(info->s, "6883 SAM");                  break;
303      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "6883 SAM");                  break;
304      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
305      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
306      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
307307   }
308308}
309309
r3957r3958
312312   switch (state)
313313   {
314314      /* --- the following bits of info are returned as NULL-terminated strings --- */
315      case DEVINFO_STR_NAME:                     info->s = "6883 SAM GIME";            break;
315      case DEVINFO_STR_NAME:                     strcpy(info->s, "6883 SAM GIME");            break;
316316
317317      /* --- the following bits of info are returned as pointers to data or functions --- */
318318      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(sam6883_gime);   break;
src/mess/machine/c128.c
r3957r3958
9696   const device_config *cia_0 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_0");
9797   const device_config *cia_1 = device_list_find_by_tag(space->machine->config->devicelist, CIA6526R1, "cia_1");
9898
99   UINT8 c64_port6510 = (UINT8) cpu_get_info_int(space->machine->cpu[0], CPUINFO_INT_M6510_PORT);
99   UINT8 c64_port6510 = (UINT8) device_get_info_int(space->machine->cpu[0], CPUINFO_INT_M6510_PORT);
100100
101101   if (!c128_write_io)
102102   {
r3957r3958
190190   if (!c64mode)
191191      return;
192192
193   data = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
193   data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
194194   if ((data == old)&&(exrom==c64_exrom)&&(game==c64_game)&&!reset)
195195      return;
196196
r3957r3958
586586          * driver used to work with this behavior, so I am doing this hack
587587          * where I set CPU #1's PC to 0x1100 on reset.
588588          */
589         if (cpu_get_reg(machine->cpu[1], REG_PC) == 0x0000)
590            cpu_set_reg(machine->cpu[1], REG_PC, 0x1100);
589         if (cpu_get_reg(machine->cpu[1], REG_GENPC) == 0x0000)
590            cpu_set_reg(machine->cpu[1], REG_GENPC, 0x1100);
591591      }
592592      mmu_cpu = MMU_CPU8502;
593593      return;
r3957r3958
780780 */
781781static int c128_dma_read(running_machine *machine, int offset)
782782{
783   UINT8 c64_port6510 = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
783   UINT8 c64_port6510 = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
784784
785785   /* main memory configuration to include */
786786   if (c64mode)
r3957r3958
803803
804804static int c128_dma_read_color(running_machine *machine, int offset)
805805{
806   UINT8 c64_port6510 = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
806   UINT8 c64_port6510 = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
807807
808808   if (c64mode)
809809      return c64_colorram[offset & 0x3ff] & 0xf;
r3957r3958
890890   int i;
891891
892892   /* configure the M6510 port */
893   cpu_set_info_fct(machine->cpu[1], CPUINFO_PTR_M6510_PORTREAD, (genf *) c128_m6510_port_read);
894   cpu_set_info_fct(machine->cpu[1], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c128_m6510_port_write);
893   device_set_info_fct(machine->cpu[1], CPUINFO_PTR_M6510_PORTREAD, (genf *) c128_m6510_port_read);
894   device_set_info_fct(machine->cpu[1], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c128_m6510_port_write);
895895
896896   c64_memory = ram;
897897
src/mess/machine/6883sam.h
r3957r3958
8686***************************************************************************/
8787
8888#define MDRV_SAM6883_ADD(_tag, _intrf) \
89   MDRV_DEVICE_ADD(_tag, SAM6883) \
89   MDRV_DEVICE_ADD(_tag, SAM6883, 0) \
9090   MDRV_DEVICE_CONFIG(_intrf)
9191
9292#define MDRV_SAM6883_GIME_ADD(_tag, _intrf) \
93   MDRV_DEVICE_ADD(_tag, SAM6883_GIME) \
93   MDRV_DEVICE_ADD(_tag, SAM6883_GIME, 0) \
9494   MDRV_DEVICE_CONFIG(_intrf)
9595
9696
src/mess/machine/ap2_lang.c
r3957r3958
115115      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
116116
117117      /* --- the following bits of info are returned as NULL-terminated strings --- */
118      case DEVINFO_STR_NAME:                     info->s = "Apple II Language Card";         break;
119      case DEVINFO_STR_FAMILY:                  info->s = "Apple II Language Card";         break;
120      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
121      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
118      case DEVINFO_STR_NAME:                     strcpy(info->s, "Apple II Language Card");         break;
119      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Apple II Language Card");         break;
120      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
121      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
122122   }
123123}
src/mess/machine/6530miot.c
r3957r3958
377377
378378static DEVICE_START( miot6530 )
379379{
380   const miot6530_config *config = device->inline_config;
381380   miot6530_state *miot = get_safe_token(device);
382381
383382   /* validate arguments */
r3957r3958
387386
388387   /* set static values */
389388   miot->intf = device->static_config;
390   miot->clock = config->clock;
389   miot->clock = device->clock;
391390
392391   /* configure the ports */
393392   miot->port[0].in_func = miot->intf->in_a_func;
r3957r3958
453452   {
454453      /* --- the following bits of info are returned as 64-bit signed integers --- */
455454      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(miot6530_state);      break;
456      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(miot6530_config);      break;
455      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                     break;
457456      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;      break;
458457
459458      /* --- the following bits of info are returned as pointers to data or functions --- */
r3957r3958
463462      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(miot6530);break;
464463
465464      /* --- the following bits of info are returned as NULL-terminated strings --- */
466      case DEVINFO_STR_NAME:                     info->s = "6530 (MIOT)";            break;
467      case DEVINFO_STR_FAMILY:                  info->s = "I/O devices";            break;
468      case DEVINFO_STR_VERSION:                  info->s = "1.0";                  break;
469      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                  break;
470      case DEVINFO_STR_CREDITS:                  info->s = "Copyright Nicola Salmoria and the MAME Team"; break;
465      case DEVINFO_STR_NAME:                     strcpy(info->s, "6530 (MIOT)");            break;
466      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "I/O devices");            break;
467      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
468      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                  break;
469      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break;
471470   }
472471}
src/mess/machine/tms9901.c
r3957r3958
636636      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(tms9901);   break;
637637
638638      /* --- the following bits of info are returned as NULL-terminated strings --- */
639      case DEVINFO_STR_NAME:                     info->s = "TMS9901";               break;
640      case DEVINFO_STR_FAMILY:                  info->s = "TMS9901";               break;
641      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
642      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
639      case DEVINFO_STR_NAME:                     strcpy(info->s, "TMS9901");               break;
640      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "TMS9901");               break;
641      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
642      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
643643      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
644644   }
645645}
src/mess/machine/pet.c
r3957r3958
708708
709709   cbm_drive_0_config (input_port_read(machine, "CFG") & 2 ? IEEE : 0, 8);
710710   cbm_drive_1_config (input_port_read(machine, "CFG") & 1 ? IEEE : 0, 9);
711   cpu_reset(cputag_get_cpu(machine, "main"));
711   device_reset(cputag_get_cpu(machine, "main"));
712712}
713713
714714
src/mess/machine/ap2_lang.h
r3957r3958
1919#define APPLE2_LANGCARD      DEVICE_GET_INFO_NAME(apple2_langcard)
2020
2121#define MDRV_APPLE2_LANGCARD_ADD(_tag)   \
22   MDRV_DEVICE_ADD((_tag), APPLE2_LANGCARD)
22   MDRV_DEVICE_ADD((_tag), APPLE2_LANGCARD, 0)
2323
2424
2525
src/mess/machine/c16.c
r3957r3958
125125UINT8 c16_m7501_port_read(const device_config *device, UINT8 direction)
126126{
127127   UINT8 data = 0xff;
128   UINT8 c16_port7501 = (UINT8) cpu_get_info_int(device->machine->cpu[0], CPUINFO_INT_M6510_PORT);
128   UINT8 c16_port7501 = (UINT8) device_get_info_int(device->machine->cpu[0], CPUINFO_INT_M6510_PORT);
129129
130130   if ((c16_port7501 & 0x01) || !cbm_serial_data_read(device->machine))
131131      data &= ~0x80;
r3957r3958
432432   UINT8 *rom;
433433
434434   /* configure the M7501 port */
435   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTREAD, (genf *) c16_m7501_port_read);
436   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c16_m7501_port_write);
435   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTREAD, (genf *) c16_m7501_port_read);
436   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c16_m7501_port_write);
437437
438438   c16_select_roms (cputag_get_address_space(machine,"main",ADDRESS_SPACE_PROGRAM), 0, 0);
439439   c16_switch_to_rom (cputag_get_address_space(machine,"main",ADDRESS_SPACE_PROGRAM), 0, 0);
src/mess/machine/6530miot.h
r3957r3958
1212    TYPE DEFINITIONS
1313***************************************************************************/
1414
15typedef struct _miot6530_config miot6530_config;
16struct _miot6530_config
17{
18   UINT32               clock;
19};
20
21
2215typedef UINT8 (*miot_read_func)(const device_config *device, UINT8 olddata);
2316typedef void (*miot_write_func)(const device_config *device, UINT8 newdata, UINT8 olddata);
2417
r3957r3958
3932***************************************************************************/
4033
4134#define MDRV_MIOT6530_ADD(_tag, _clock, _intrf) \
42   MDRV_DEVICE_ADD(_tag, MIOT6530) \
43   MDRV_DEVICE_CONFIG_DATA32(miot6530_config, clock, _clock) \
35   MDRV_DEVICE_ADD(_tag, MIOT6530, _clock) \
4436   MDRV_DEVICE_CONFIG(_intrf)
4537
4638#define MDRV_MIOT6530_REMOVE(_tag) \
src/mess/machine/tms9901.h
r3957r3958
6363***************************************************************************/
6464
6565#define MDRV_TMS9901_ADD(_tag, _intrf) \
66   MDRV_DEVICE_ADD(_tag, TMS9901) \
66   MDRV_DEVICE_ADD(_tag, TMS9901, 0) \
6767   MDRV_DEVICE_CONFIG(_intrf)
6868
6969#endif /* __TMS9901_H__ */
src/mess/machine/oric.c
r3957r3958
12201220      }
12211221      break;
12221222   }
1223   cpu_reset(cputag_get_cpu(machine, "main"));
1223   device_reset(cputag_get_cpu(machine, "main"));
12241224}
12251225
12261226
r3957r3958
12571257   {
12581258      if ((offset & 0x0f)!=0x0d)
12591259      {
1260         logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpu_get_reg(space->machine->cpu[0], REG_PC));
1260         logerror("via 0 r: %04x %04x\n",offset, (unsigned) cpu_get_reg(space->machine->cpu[0], REG_GENPC));
12611261      }
12621262   }
12631263   /* it is repeated */
r3957r3958
12981298#endif
12991299   if (enable_logging)
13001300   {
1301      logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpu_get_reg(space->machine->cpu[0], REG_PC));
1301      logerror("via 0 w: %04x %02x %04x\n",offset,data,(unsigned) cpu_get_reg(space->machine->cpu[0], REG_GENPC));
13021302   }
13031303
13041304   via_w(via_0, offset & 0x0f,data);
src/mess/machine/990_dk.c
r3957r3958
114114
115115   for (i=0; i<MAX_FLOPPIES; i++)
116116   {
117      fd800.drv[i].img = image_from_devtype_and_index(IO_FLOPPY, i);
117      fd800.drv[i].img = image_from_devtype_and_index(machine, IO_FLOPPY, i);
118118      fd800.drv[i].phys_cylinder = -1;
119119      fd800.drv[i].log_cylinder[0] = fd800.drv[i].log_cylinder[1] = -1;
120120      fd800.drv[i].seclen = 64;
src/mess/machine/at.c
r3957r3958
153153}
154154
155155
156static void at_set_keyb_int(int state) {
156static void at_set_keyb_int(running_machine *machine, int state) {
157157   pic8259_set_irq_line(at_devices.pic8259_master, 1, state);
158158}
159159
r3957r3958
222222
223223   if (LOG_PORT80 && (offset == 0))
224224   {
225      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) cpu_get_reg(space->machine->cpu[0],REG_PC));
225      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC));
226226   }
227227
228228   switch(offset % 8) {
src/mess/machine/vector06.c
r3957r3958
161161   UINT8 val = input_port_read(machine, "RESET");
162162   if ((val & 1)==1) {
163163      memory_set_bankptr(machine, 1, memory_region(machine, "main") + 0x10000);
164      cpu_reset(machine->cpu[0]);
164      device_reset(machine->cpu[0]);
165165   }
166166   if ((val & 2)==2) {
167167      memory_set_bankptr(machine, 1, mess_ram + 0x0000);
168      cpu_reset(machine->cpu[0]);
168      device_reset(machine->cpu[0]);
169169   }
170170}
171171
src/mess/machine/pc_hdc.c
r3957r3958
511511   {
512512      command_name = hdc_command_names[cmd] ? hdc_command_names[cmd] : "Unknown";
513513      logerror("pc_hdc_command(): Executing command; pc=0x%08x cmd=0x%02x (%s) drv=%d\n",
514         (unsigned) cpu_get_reg(machine->cpu[0], REG_PC), cmd, command_name, drv);
514         (unsigned) cpu_get_reg(machine->cpu[0], REG_GENPC), cmd, command_name, drv);
515515   }
516516
517517   switch (cmd)
r3957r3958
549549         if (LOG_HDC_STATUS)
550550         {
551551            logerror("hdc read pc=0x%08x INDEX #%d D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
552               (unsigned) cpu_get_reg(machine->cpu[0], REG_PC), idx, drv, cylinder[idx], head[idx], sector[idx], sector_cnt[idx], control[idx]);
552               (unsigned) cpu_get_reg(machine->cpu[0], REG_GENPC), idx, drv, cylinder[idx], head[idx], sector[idx], sector_cnt[idx], control[idx]);
553553         }
554554
555555         if (test_ready(machine, n))
r3957r3958
564564         if (LOG_HDC_STATUS)
565565         {
566566            logerror("hdc write pc=0x%08x INDEX #%d D:%d C:%d H:%d S:%d N:%d CTL:$%02x\n",
567               (unsigned) cpu_get_reg(machine->cpu[0], REG_PC), idx, drv, cylinder[idx], head[idx], sector[idx], sector_cnt[idx], control[idx]);
567               (unsigned) cpu_get_reg(machine->cpu[0], REG_GENPC), idx, drv, cylinder[idx], head[idx], sector[idx], sector_cnt[idx], control[idx]);
568568         }
569569
570570         if (test_ready(machine, n))
r3957r3958
673673      if (--data_cnt == 0)
674674      {
675675         if (LOG_HDC_STATUS)
676            logerror("pc_hdc_data_w(): Launching command; pc=0x%08x\n", (unsigned) cpu_get_reg(machine->cpu[0], REG_PC));
676            logerror("pc_hdc_data_w(): Launching command; pc=0x%08x\n", (unsigned) cpu_get_reg(machine->cpu[0], REG_GENPC));
677677
678678            status[n] &= ~STA_COMMAND;
679679         status[n] &= ~STA_REQUEST;
r3957r3958
715715   int irq = irq = (dip[n] & 0x40) ? 5 : 2;
716716
717717   if (LOG_HDC_STATUS)
718      logerror("pc_hdc_control_w(): Control write pc=0x%08x data=%d\n", (unsigned) cpu_get_reg(machine->cpu[0], REG_PC), data);
718      logerror("pc_hdc_control_w(): Control write pc=0x%08x data=%d\n", (unsigned) cpu_get_reg(machine->cpu[0], REG_GENPC), data);
719719
720720   hdc_control = data;
721721
r3957r3958
843843
844844MACHINE_DRIVER_START( pc_hdc )
845845   /* harddisk */
846   MDRV_DEVICE_ADD("harddisk1", HARDDISK)
847   MDRV_DEVICE_ADD("harddisk2", HARDDISK)
848   MDRV_DEVICE_ADD("harddisk3", HARDDISK)
849   MDRV_DEVICE_ADD("harddisk4", HARDDISK)
846   MDRV_HARDDISK_ADD("harddisk1")
847   MDRV_HARDDISK_ADD("harddisk2")
848   MDRV_HARDDISK_ADD("harddisk3")
849   MDRV_HARDDISK_ADD("harddisk4")
850850MACHINE_DRIVER_END
851851
852852
src/mess/machine/68901mfp.c
r3957r3958
14941494      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(mc68901);   break;
14951495
14961496      /* --- the following bits of info are returned as NULL-terminated strings --- */
1497      case DEVINFO_STR_NAME:                     info->s = "Motorola MC68901";            break;
1498      case DEVINFO_STR_FAMILY:                  info->s = "MC68901 MFP";               break;
1499      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
1500      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
1501      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
1497      case DEVINFO_STR_NAME:                     strcpy(info->s, "Motorola MC68901");      break;
1498      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MC68901 MFP");            break;
1499      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
1500      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
1501      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
15021502   }
15031503}
15041504
r3957r3958
15191519      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(mc68901);   break;
15201520
15211521      /* --- the following bits of info are returned as NULL-terminated strings --- */
1522      case DEVINFO_STR_NAME:                     info->s = "Mostek MK68901";               break;
1523      case DEVINFO_STR_FAMILY:                  info->s = "MK68901 MFP";               break;
1524      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
1525      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
1526      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
1522      case DEVINFO_STR_NAME:                     strcpy(info->s, "Mostek MK68901");         break;
1523      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MK68901 MFP");            break;
1524      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
1525      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
1526      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
15271527   }
15281528}
15291529#endif
src/mess/machine/z80dart.c
r3957r3958
13941394      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)z80dart_irq_reti;            break;
13951395
13961396      /* --- the following bits of info are returned as NULL-terminated strings --- */
1397      case DEVINFO_STR_NAME:                     info->s = "Zilog Z80 DART";                  break;
1398      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                        break;
1399      case DEVINFO_STR_VERSION:                  info->s = "1.0";                        break;
1400      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                        break;
1401      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";         break;
1397      case DEVINFO_STR_NAME:                     strcpy(info->s, "Zilog Z80 DART");                  break;
1398      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");                        break;
1399      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                        break;
1400      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                        break;
1401      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");         break;
14021402   }
14031403}
src/mess/machine/amigakbd.c
r3957r3958
6969
7070      if ( amiga_intf != NULL && amiga_intf->nmi_callback )
7171      {
72         (*amiga_intf->nmi_callback)();
72         (*amiga_intf->nmi_callback)(field->port->machine);
7373      }
7474   }
7575   else
src/mess/machine/68901mfp.h
r3957r3958
6262#define MK68901 DEVICE_GET_INFO_NAME( mk68901 )
6363
6464#define MDRV_MC68901_ADD(_tag, _config)   \
65   MDRV_DEVICE_ADD((_tag), MC68901)   \
65   MDRV_DEVICE_ADD((_tag), MC68901, 0)   \
6666   MDRV_DEVICE_CONFIG(_config)
6767
6868#define MDRV_MK68901_ADD(_tag, _config)   \
69   MDRV_DEVICE_ADD((_tag), MK68901)   \
69   MDRV_DEVICE_ADD((_tag), MK68901, 0)   \
7070   MDRV_DEVICE_CONFIG(_config)
7171
7272
src/mess/machine/z80dart.h
r3957r3958
100100***************************************************************************/
101101
102102#define MDRV_Z80DART_ADD(_tag, _intrf) \
103   MDRV_DEVICE_ADD(_tag, Z80DART) \
103   MDRV_DEVICE_ADD(_tag, Z80DART, 0) \
104104   MDRV_DEVICE_CONFIG(_intrf)
105105
106106#define MDRV_Z80DART_REMOVE(_tag) \
src/mess/machine/amigacrt.c
r3957r3958
1111
1212
1313#include "driver.h"
14#include "deprecat.h"
1514#include "amiga.h"
1615#include "cpu/m68000/m68000.h"
1716#include "machine/6526cia.h"
r3957r3958
439438   }
440439}
441440
442void amiga_cart_nmi( void )
441void amiga_cart_nmi( running_machine *machine )
443442{
444   running_machine *machine = Machine;
445443   if ( amiga_cart_type < 0 )
446444      return;
447445
src/mess/machine/tms9902.c
r3957r3958
682682      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(tms9902);   break;
683683
684684      /* --- the following bits of info are returned as NULL-terminated strings --- */
685      case DEVINFO_STR_NAME:                     info->s = "TMS9902";               break;
686      case DEVINFO_STR_FAMILY:                  info->s = "TMS9902";               break;
687      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
688      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
685      case DEVINFO_STR_NAME:                     strcpy(info->s, "TMS9902");               break;
686      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "TMS9902");               break;
687      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
688      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
689689      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
690690   }
691691}
src/mess/machine/osborne1.c
r3957r3958
580580      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)osborne1_daisy_irq_reti;            break;
581581
582582      /* --- the following bits of info are returned as NULL-terminated strings --- */
583      case DEVINFO_STR_NAME:                     info->s = "Osborne1 daisy";                        break;
584      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                              break;
585      case DEVINFO_STR_VERSION:                  info->s = "1.0";                              break;
586      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                              break;
587      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";               break;
583      case DEVINFO_STR_NAME:                     strcpy(info->s, "Osborne1 daisy");                        break;
584      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");                              break;
585      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
586      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                              break;
587      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");               break;
588588   }
589589}
590590
src/mess/machine/vtech1.c
r3957r3958
222222      memory_write_byte(space, 0x788e, start % 256); /* usr subroutine address */
223223      memory_write_byte(space, 0x788f, start / 256);
224224      image_message(image, " %s (M)\nsize=%04X : start=%04X : end=%04X",pgmname,size,start,end);
225      cpu_set_reg(cputag_get_cpu(image->machine, "main"), REG_PC, start);            /* start program */
225      cpu_set_reg(cputag_get_cpu(image->machine, "main"), REG_GENPC, start);            /* start program */
226226      break;
227227
228228   default:
r3957r3958
239239 Floppy Handling
240240******************************************************************************/
241241
242static const device_config *vtech1_file(void)
242static const device_config *vtech1_file(running_machine *machine)
243243{
244244   if (vtech1_drive < 0)
245245      return NULL;
246246
247   return image_from_devtype_and_index(IO_FLOPPY, vtech1_drive);
247   return image_from_devtype_and_index(machine, IO_FLOPPY, vtech1_drive);
248248}
249249
250250/*
src/mess/machine/amstrad.c
r3957r3958
8787
8888   RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8);
8989   cpu_set_reg(machine->cpu[0],Z80_SP, RegData);
90   cpu_set_reg(machine->cpu[0],REG_SP,RegData);
90   cpu_set_reg(machine->cpu[0],REG_GENSP,RegData);
9191
9292   RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8);
9393
src/mess/machine/amigacrt.h
r3957r3958
33
44void amiga_cart_init( running_machine *machine );
55void amiga_cart_check_overlay( running_machine *machine );
6void amiga_cart_nmi( void );
6void amiga_cart_nmi( running_machine *machine );
77
88#endif /* AMIGACRT_H */
src/mess/machine/tms9902.h
r3957r3958
5454***************************************************************************/
5555
5656#define MDRV_TMS9902_ADD(_tag, _intrf) \
57   MDRV_DEVICE_ADD(_tag, TMS9902) \
57   MDRV_DEVICE_ADD(_tag, TMS9902, 0) \
5858   MDRV_DEVICE_CONFIG(_intrf)
5959
6060#endif /* __TMS9902_H__ */
src/mess/machine/sms.c
r3957r3958
581581static void sms_machine_stop(running_machine *machine) {
582582   /* Does the cartridge have SRAM that should be saved? */
583583   if ( sms_cartridge[sms_current_cartridge].sram_save ) {
584      image_battery_save( image_from_devtype_and_index(IO_CARTSLOT, 0), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
584      image_battery_save( image_from_devtype_and_index(machine, IO_CARTSLOT, 0), sms_cartridge[sms_current_cartridge].cartSRAM, sizeof(UINT8) * NVRAM_SIZE );
585585   }
586586}
587587
r3957r3958
10051005   } else {
10061006      /* Pull reset line of CPU #0 low */
10071007      cpu_suspend( space->machine->cpu[0], SUSPEND_REASON_HALT, 1 );
1008      cpu_reset(space->machine->cpu[0]);
1008      device_reset(space->machine->cpu[0]);
10091009   }
10101010   sms_store_control = data;
10111011}
src/mess/machine/wd17xx.c
r3957r3958
284284static const device_config *wd17xx_current_image(const device_config *device)
285285{
286286   wd17xx_t *w = get_safe_token(device);
287   return image_from_devtype_and_index(IO_FLOPPY, w->current_drive);
287   return image_from_devtype_and_index(device->machine, IO_FLOPPY, w->current_drive);
288288}
289289
290290
r3957r3958
16661666   
16671667   for (i = 0; i < device_count(device->machine, IO_FLOPPY); i++)
16681668   {
1669      const device_config *img = image_from_devtype_and_index(IO_FLOPPY, i);
1669      const device_config *img = image_from_devtype_and_index(device->machine, IO_FLOPPY, i);
16701670      floppy_drive_set_controller(img,device);
16711671      floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
16721672      floppy_drive_set_rpm( img, 300.);
r3957r3958
17401740      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(wd17xx);      break;
17411741
17421742      /* --- the following bits of info are returned as NULL-terminated strings --- */
1743      case DEVINFO_STR_NAME:                     info->s = "WD1770";                  break;
1744      case DEVINFO_STR_FAMILY:                  info->s = "WD17xx";                  break;
1745      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
1746      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
1747      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
1743      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1770");                  break;
1744      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "WD17xx");                  break;
1745      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
1746      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
1747      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
17481748   }
17491749}
17501750
r3957r3958
17541754   switch (state)
17551755   {
17561756      /* --- the following bits of info are returned as NULL-terminated strings --- */
1757      case DEVINFO_STR_NAME:                     info->s = "WD1772";            break;
1757      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1772");            break;
17581758
17591759      /* --- the following bits of info are returned as pointers to data or functions --- */
17601760      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1772);   break;
r3957r3958
17671767   switch (state)
17681768   {
17691769      /* --- the following bits of info are returned as NULL-terminated strings --- */
1770      case DEVINFO_STR_NAME:                     info->s = "WD1773";            break;
1770      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1773");            break;
17711771
17721772      /* --- the following bits of info are returned as pointers to data or functions --- */
17731773      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1773);   break;
r3957r3958
17801780   switch (state)
17811781   {
17821782      /* --- the following bits of info are returned as NULL-terminated strings --- */
1783      case DEVINFO_STR_NAME:                     info->s = "WD179x";            break;
1783      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD179x");            break;
17841784
17851785      /* --- the following bits of info are returned as pointers to data or functions --- */
17861786      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd179x);   break;
r3957r3958
17931793   switch (state)
17941794   {
17951795      /* --- the following bits of info are returned as NULL-terminated strings --- */
1796      case DEVINFO_STR_NAME:                     info->s = "WD1793";            break;
1796      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD1793");            break;
17971797
17981798      /* --- the following bits of info are returned as pointers to data or functions --- */
17991799      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd1793);   break;
r3957r3958
18061806   switch (state)
18071807   {
18081808      /* --- the following bits of info are returned as NULL-terminated strings --- */
1809      case DEVINFO_STR_NAME:                     info->s = "WD2793";            break;
1809      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD2793");            break;
18101810
18111811      /* --- the following bits of info are returned as pointers to data or functions --- */
18121812      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd2793);   break;
r3957r3958
18191819   switch (state)
18201820   {
18211821      /* --- the following bits of info are returned as NULL-terminated strings --- */
1822      case DEVINFO_STR_NAME:                     info->s = "WD177x";            break;
1822      case DEVINFO_STR_NAME:                     strcpy(info->s, "WD177x");            break;
18231823
18241824      /* --- the following bits of info are returned as pointers to data or functions --- */
18251825      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(wd177x);   break;
r3957r3958
18321832   switch (state)
18331833   {
18341834      /* --- the following bits of info are returned as NULL-terminated strings --- */
1835      case DEVINFO_STR_NAME:                     info->s = "MB8877";            break;
1835      case DEVINFO_STR_NAME:                     strcpy(info->s, "MB8877");            break;
18361836
18371837      /* --- the following bits of info are returned as pointers to data or functions --- */
18381838      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(mb8877);   break;
src/mess/machine/wd17xx.h
r3957r3958
9696***************************************************************************/
9797
9898#define MDRV_WD1770_ADD(_tag, _intrf) \
99   MDRV_DEVICE_ADD(_tag, WD1770) \
99   MDRV_DEVICE_ADD(_tag, WD1770, 0) \
100100   MDRV_DEVICE_CONFIG(_intrf)
101101
102102#define MDRV_WD1772_ADD(_tag, _intrf) \
103   MDRV_DEVICE_ADD(_tag, WD1772) \
103   MDRV_DEVICE_ADD(_tag, WD1772, 0) \
104104   MDRV_DEVICE_CONFIG(_intrf)
105105
106106#define MDRV_WD1773_ADD(_tag, _intrf) \
107   MDRV_DEVICE_ADD(_tag, WD1773) \
107   MDRV_DEVICE_ADD(_tag, WD1773, 0) \
108108   MDRV_DEVICE_CONFIG(_intrf)
109109
110110#define MDRV_WD179X_ADD(_tag, _intrf) \
111   MDRV_DEVICE_ADD(_tag, WD179X) \
111   MDRV_DEVICE_ADD(_tag, WD179X, 0) \
112112   MDRV_DEVICE_CONFIG(_intrf)
113113
114114#define MDRV_WD1793_ADD(_tag, _intrf) \
115   MDRV_DEVICE_ADD(_tag, WD1793) \
115   MDRV_DEVICE_ADD(_tag, WD1793, 0) \
116116   MDRV_DEVICE_CONFIG(_intrf)
117117
118118#define MDRV_WD2793_ADD(_tag, _intrf) \
119   MDRV_DEVICE_ADD(_tag, WD2793) \
119   MDRV_DEVICE_ADD(_tag, WD2793, 0) \
120120   MDRV_DEVICE_CONFIG(_intrf)
121121
122122#define MDRV_WD177X_ADD(_tag, _intrf) \
123   MDRV_DEVICE_ADD(_tag, WD177X) \
123   MDRV_DEVICE_ADD(_tag, WD177X, 0) \
124124   MDRV_DEVICE_CONFIG(_intrf)
125125
126126#define MDRV_MB8877_ADD(_tag, _intrf) \
127   MDRV_DEVICE_ADD(_tag, MB8877) \
127   MDRV_DEVICE_ADD(_tag, MB8877, 0) \
128128   MDRV_DEVICE_CONFIG(_intrf)
129129
130130   
src/mess/machine/odyssey2.c
r3957r3958
3737   }
3838}
3939
40void the_voice_lrq_callback(int state) {
40void the_voice_lrq_callback(const device_config *device, int state) {
4141   the_voice_lrq_state = state;
4242}
4343
src/mess/machine/svi318.c
r3957r3958
384384
385385   wd17xx_set_side(fdc, data & 0x02 ? 1:0);
386386
387   image = image_from_devtype_and_index(IO_FLOPPY, svi318_fdc.driveselect);
387   image = image_from_devtype_and_index(space->machine, IO_FLOPPY, svi318_fdc.driveselect);
388388   if (image_exists(image))
389389   {
390390      UINT8 sectors;
r3957r3958
566566      UINT8 *table = auto_malloc (0x100);
567567      const UINT8 *old_table;
568568
569      old_table = cpu_get_info_ptr(machine->cpu[0], CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i]);
569      old_table = device_get_info_ptr(machine->cpu[0], CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i]);
570570      memcpy (table, old_table, 0x100);
571571
572572      if (z80_cycle_table[i] == Z80_TABLE_ex)
r3957r3958
587587            }
588588         }
589589      }
590      cpu_set_info_ptr(machine->cpu[0], CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i], (void*)table);
590      device_set_info_ptr(machine->cpu[0], CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i], (void*)table);
591591   }
592592}
593593
src/mess/machine/gamepock.c
r3957r3958
216216}
217217
218218/* This is called whenever the T0 pin switches state */
219int gamepock_io_callback( int ioline, int state )
219int gamepock_io_callback( const device_config *device, int ioline, int state )
220220{
221221   if ( ioline == UPD7810_TO )
222222   {
src/mess/machine/vtech2.c
r3957r3958
374374
375375static const device_config *laser_file(void)
376376{
377   return image_from_devtype_and_index(IO_FLOPPY, laser_drive);
377   return image_from_devtype_and_index(machine, IO_FLOPPY, laser_drive);
378378}
379379
380380static void laser_get_track(void)
src/mess/machine/wswan.c
r3957r3958
199199
200200static void wswan_machine_stop( running_machine *machine ) {
201201   if ( eeprom.size ) {
202      image_battery_save( image_from_devtype_and_index(IO_CARTSLOT,0), eeprom.data, eeprom.size );
202      image_battery_save( image_from_devtype_and_index(machine, IO_CARTSLOT,0), eeprom.data, eeprom.size );
203203   }
204204}
205205
src/mess/machine/nec765.c
r3957r3958
164164   if (!fdc->intf->get_image)
165165   {
166166      if (fdc->drive < device_count(device->machine, IO_FLOPPY))
167         image = image_from_devtype_and_index(IO_FLOPPY, fdc->drive);
167         image = image_from_devtype_and_index(device->machine, IO_FLOPPY, fdc->drive);
168168   }
169169   else
170170   {
r3957r3958
21772177      a_drive_is_ready = 0;
21782178      for (i = 0; i < device_count(device->machine, IO_FLOPPY); i++)
21792179      {
2180         if (image_exists(image_from_devtype_and_index(IO_FLOPPY, i)))
2180         if (image_exists(image_from_devtype_and_index(device->machine, IO_FLOPPY, i)))
21812181         {
21822182            a_drive_is_ready = 1;
21832183            break;
r3957r3958
22972297   int i;
22982298     
22992299   for (i = 0; i < device_count(device->machine, IO_FLOPPY); i++) {
2300      const device_config *img = image_from_devtype_and_index(IO_FLOPPY, i);
2300      const device_config *img = image_from_devtype_and_index(device->machine, IO_FLOPPY, i);
23012301      floppy_drive_set_controller(img, device);
23022302      floppy_drive_set_ready_state_change_callback(img, nec765_set_ready_change_callback);
23032303   }
r3957r3958
23292329      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(nec765);   break;
23302330
23312331      /* --- the following bits of info are returned as NULL-terminated strings --- */
2332      case DEVINFO_STR_NAME:                     info->s = "NEC765A";                  break;
2333      case DEVINFO_STR_FAMILY:                  info->s = "NEC765A";                  break;
2334      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
2335      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
2336      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
2332      case DEVINFO_STR_NAME:                     strcpy(info->s, "NEC765A");                  break;
2333      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "NEC765A");                  break;
2334      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
2335      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
2336      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
23372337   }
23382338}
23392339
r3957r3958
23432343   switch (state)
23442344   {
23452345      /* --- the following bits of info are returned as NULL-terminated strings --- */
2346      case DEVINFO_STR_NAME:                     info->s = "NEC765B";            break;
2346      case DEVINFO_STR_NAME:                     strcpy(info->s, "NEC765B");            break;
23472347
23482348      /* --- the following bits of info are returned as pointers to data or functions --- */
23492349      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(nec765b);   break;
r3957r3958
23572357   switch (state)
23582358   {
23592359      /* --- the following bits of info are returned as NULL-terminated strings --- */
2360      case DEVINFO_STR_NAME:                     info->s = "SMC37C78";            break;
2360      case DEVINFO_STR_NAME:                     strcpy(info->s, "SMC37C78");            break;
23612361
23622362      /* --- the following bits of info are returned as pointers to data or functions --- */
23632363      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(smc37c78);   break;
r3957r3958
23712371   switch (state)
23722372   {
23732373      /* --- the following bits of info are returned as NULL-terminated strings --- */
2374      case DEVINFO_STR_NAME:                     info->s = "NEC72065";            break;
2374      case DEVINFO_STR_NAME:                     strcpy(info->s, "NEC72065");            break;
23752375
23762376      /* --- the following bits of info are returned as pointers to data or functions --- */
23772377      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(nec72065);   break;
src/mess/machine/abc99.c
r3957r3958
3939      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
4040
4141      /* --- the following bits of info are returned as NULL-terminated strings --- */
42      case DEVINFO_STR_NAME:                     info->s = "Luxor ABC-99";               break;
43      case DEVINFO_STR_FAMILY:                  info->s = "Luxor ABC";                  break;
44      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
45      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
46      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
42      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor ABC-99");         break;
43      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");            break;
44      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
45      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
46      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
4747   }
4848}
src/mess/machine/nec765.h
r3957r3958
120120***************************************************************************/
121121
122122#define MDRV_NEC765A_ADD(_tag, _intrf) \
123   MDRV_DEVICE_ADD(_tag, NEC765A) \
123   MDRV_DEVICE_ADD(_tag, NEC765A, 0) \
124124   MDRV_DEVICE_CONFIG(_intrf)
125125
126126#define MDRV_NEC765A_MODIFY(_tag, _intrf) \
r3957r3958
131131  MDRV_DEVICE_REMOVE(_tag, NEC765A)
132132
133133#define MDRV_NEC765B_ADD(_tag, _intrf) \
134   MDRV_DEVICE_ADD(_tag, NEC765B) \
134   MDRV_DEVICE_ADD(_tag, NEC765B, 0) \
135135   MDRV_DEVICE_CONFIG(_intrf)
136136
137137#define MDRV_NEC765B_MODIFY(_tag, _intrf) \
r3957r3958
142142  MDRV_DEVICE_REMOVE(_tag, NEC765B)
143143
144144#define MDRV_SMC37C78_ADD(_tag, _intrf) \
145   MDRV_DEVICE_ADD(_tag, SMC37C78) \
145   MDRV_DEVICE_ADD(_tag, SMC37C78, 0) \
146146   MDRV_DEVICE_CONFIG(_intrf)
147147
148148#define MDRV_SMC37C78_MODIFY(_tag, _intrf) \
r3957r3958
153153  MDRV_DEVICE_REMOVE(_tag, SMC37C78)
154154
155155#define MDRV_NEC72065_ADD(_tag, _intrf) \
156   MDRV_DEVICE_ADD(_tag, NEC72065) \
156   MDRV_DEVICE_ADD(_tag, NEC72065, 0) \
157157   MDRV_DEVICE_CONFIG(_intrf)
158158
159159#define MDRV_NEC72065_MODIFY(_tag, _intrf) \
src/mess/machine/apple2gs.c
r3957r3958
17371737   apple2_init_common(machine);
17381738
17391739   /* set up Apple IIgs vectoring */
1740   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_G65816_READVECTOR_CALLBACK, (genf *) apple2gs_read_vector);
1740   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_G65816_READVECTOR_CALLBACK, (genf *) apple2gs_read_vector);
17411741
17421742   /* setup globals */
17431743   apple2gs_cur_slot6_image = NULL;
src/mess/machine/x68k_hdc.c
r3957r3958
469469      case DEVINFO_FCT_IMAGE_CREATE:               info->f = (genf *)DEVICE_IMAGE_CREATE_NAME(sasihd);   break;
470470
471471         /* --- the following bits of info are returned as NULL-terminated strings --- */
472      case DEVINFO_STR_NAME:                     info->s = "SASI Hard Disk";   break;
473      case DEVINFO_STR_FAMILY:                  info->s = "SASI Hard Disk Controller";         break;
474      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
475      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
476      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
477      case DEVINFO_STR_IMAGE_INSTANCE_NAME:         info->s = "sasihd";          break;
478      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:      info->s = "sasi";          break;
479      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "hdf"; break;
472      case DEVINFO_STR_NAME:                     strcpy(info->s, "SASI Hard Disk");   break;
473      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "SASI Hard Disk Controller");         break;
474      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
475      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
476      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");       break;
477      case DEVINFO_STR_IMAGE_INSTANCE_NAME:         strcpy(info->s, "sasihd");          break;
478      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:      strcpy(info->s, "sasi");          break;
479      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "hdf"); break;
480480   }
481481}
482482
src/mess/machine/x68k_hdc.h
r3957r3958
111111
112112#define X68KHDC DEVICE_GET_INFO_NAME(x68k_hdc)
113113
114#define MDRV_X68KHDC_ADD(_tag) \
115   MDRV_DEVICE_ADD(_tag, X68KHDC, 0)
116
114117WRITE16_DEVICE_HANDLER( x68k_hdc_w );
115118READ16_DEVICE_HANDLER( x68k_hdc_r );
src/mess/machine/pcf8593.c
r3957r3958
478478      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(pcf8593);   break;
479479
480480      /* --- the following bits of info are returned as NULL-terminated strings --- */
481      case DEVINFO_STR_NAME:                     info->s = "PCF8593 RTC";               break;
482      case DEVINFO_STR_FAMILY:                  info->s = "PCF8593 RTC";               break;
483      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
484      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
481      case DEVINFO_STR_NAME:                     strcpy(info->s, "PCF8593 RTC");               break;
482      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "PCF8593 RTC");               break;
483      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
484      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
485485      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
486486   }
487487}
src/mess/machine/pcf8593.h
r3957r3958
1919#define PCF8593      DEVICE_GET_INFO_NAME(pcf8593)
2020
2121#define MDRV_PCF8593_ADD(_tag) \
22   MDRV_DEVICE_ADD(_tag, PCF8593) \
22   MDRV_DEVICE_ADD(_tag, PCF8593, 0) \
2323
2424#define MDRV_PCF8593_REMOVE(_tag) \
2525   MDRV_DEVICE_REMOVE(_tag, PCF8593)
src/mess/machine/i8271.c
r3957r3958
190190static const device_config *current_image(const device_config *device)
191191{
192192   i8271_t *i8271 = get_safe_token(device);
193   return image_from_devtype_and_index(IO_FLOPPY, i8271->drive);
193   return image_from_devtype_and_index(device->machine, IO_FLOPPY, i8271->drive);
194194}
195195
196196
r3957r3958
10741074         status |= (1<<2) | (1<<6);
10751075
10761076         /* these two do not appear to be set at all! ?? */
1077         if (floppy_drive_get_flag_state(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_READY))
1077         if (floppy_drive_get_flag_state(image_from_devtype_and_index(img->machine, IO_FLOPPY, 0), FLOPPY_DRIVE_READY))
10781078         {
10791079            status |= (1<<2);
10801080         }
10811081
1082         if (floppy_drive_get_flag_state(image_from_devtype_and_index(IO_FLOPPY, 1), FLOPPY_DRIVE_READY))
1082         if (floppy_drive_get_flag_state(image_from_devtype_and_index(img->machine, IO_FLOPPY, 1), FLOPPY_DRIVE_READY))
10831083         {
10841084            status |= (1<<6);
10851085         }
r3957r3958
16131613      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(i8271);      break;
16141614
16151615      /* --- the following bits of info are returned as NULL-terminated strings --- */
1616      case DEVINFO_STR_NAME:                     info->s = "Intel 8271";                  break;
1617      case DEVINFO_STR_FAMILY:                  info->s = "Intel 8271";                  break;
1618      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
1619      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
1620      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
1616      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8271");                  break;
1617      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8271");                  break;
1618      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
1619      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
1620      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
16211621   }
16221622}
16231623
src/mess/machine/i8271.h
r3957r3958
4545***************************************************************************/
4646
4747#define MDRV_I8271_ADD(_tag, _intrf) \
48   MDRV_DEVICE_ADD(_tag, I8271) \
48   MDRV_DEVICE_ADD(_tag, I8271, 0) \
4949   MDRV_DEVICE_CONFIG(_intrf)
5050
5151#endif /* I8271_H_ */
src/mess/machine/nes.c
r3957r3958
6363    FUNCTIONS
6464***************************************************************************/
6565
66static const device_config *cartslot_image(void)
66static const device_config *cartslot_image(running_machine *machine)
6767{
68   return image_from_devtype_and_index(IO_CARTSLOT, 0);
68   return image_from_devtype_and_index(machine, IO_CARTSLOT, 0);
6969}
7070
7171static void init_nes_core (running_machine *machine)
r3957r3958
197197{
198198   /* Write out the battery file if necessary */
199199   if (nes.battery)
200      image_battery_save(cartslot_image(), battery_ram, BATTERY_SIZE);
200      image_battery_save(cartslot_image(machine), battery_ram, BATTERY_SIZE);
201201}
202202
203203
src/mess/machine/amigacd.c
r3957r3958
1717#include "machine/tpi6525.h"
1818#include "devices/chd_cd.h"
1919#include "matsucd.h"
20#include "deprecat.h"
2120
2221
2322#define VERBOSE_DMAC 0
r3957r3958
385384
386385***************************************************************************/
387386
388static void   dmac_install(offs_t base)
387static void   dmac_install(running_machine *machine, offs_t base)
389388{
390   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
389   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
391390   memory_install_read16_handler(space, base, base + 0xFFFF, 0, 0, amiga_dmac_r);
392391   memory_install_write16_handler(space, base, base + 0xFFFF, 0, 0, amiga_dmac_w);
393392}
394393
395static void   dmac_uninstall(offs_t base)
394static void   dmac_uninstall(running_machine *machine, offs_t base)
396395{
397   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
396   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
398397   memory_install_read16_handler(space, base, base + 0xFFFF, 0, 0, SMH_UNMAP);
399398   memory_install_write16_handler(space, base, base + 0xFFFF, 0, 0, SMH_UNMAP);
400399}
r3957r3958
526525   tpi6525[0].cb.output = NULL;
527526
528527   /* set up DMAC with autoconfig */
529   amiga_add_autoconfig( &dmac_device );
528   amiga_add_autoconfig( machine, &dmac_device );
530529}
531530
532531MACHINE_RESET( amigacd )
src/mess/machine/concept.c
r3957r3958
648648      current_drive = ((data >> LC_DE0_bit) & 1) | ((data >> (LC_DE1_bit-1)) & 2);
649649      wd17xx_set_drive(fdc, current_drive);
650650      /*motor_on = (data & LC_MOTOROF_mask) == 0;*/
651      // floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, current_drive), (data & LC_MOTOROF_mask) == 0 ? 1 : 0);
651      // floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, current_drive), (data & LC_MOTOROF_mask) == 0 ? 1 : 0);
652652      /*flp_8in = (data & LC_FLP8IN_mask) != 0;*/
653653      wd17xx_set_density(fdc, (data & LC_FMMFM_mask) ? DEN_FM_LO : DEN_MFM_LO);
654      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, current_drive), 1, 0);
654      floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, current_drive), 1, 0);
655655      break;
656656
657657   case 8:
src/mess/machine/upd7002.c
r3957r3958
238238      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(uPD7002);      break;
239239
240240      /* --- the following bits of info are returned as NULL-terminated strings --- */
241      case DEVINFO_STR_NAME:                     info->s = "uPD7002";                  break;
242      case DEVINFO_STR_FAMILY:                  info->s = "uPD7002";                  break;
243      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
244      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
245      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
241      case DEVINFO_STR_NAME:                     strcpy(info->s, "uPD7002");                  break;
242      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "uPD7002");                  break;
243      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
244      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
245      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
246246   }
247247}
src/mess/machine/upd7002.h
r3957r3958
5454***************************************************************************/
5555
5656#define MDRV_UPD7002_ADD(_tag, _intrf) \
57   MDRV_DEVICE_ADD(_tag, UPD7002) \
57   MDRV_DEVICE_ADD(_tag, UPD7002, 0) \
5858   MDRV_DEVICE_CONFIG(_intrf)
5959
6060
src/mess/machine/msx.c
r3957r3958
362362      UINT8 *table = auto_malloc (0x100);
363363      const UINT8 *old_table;
364364
365      old_table = cpu_get_info_ptr (machine->cpu[0],
365      old_table = device_get_info_ptr (machine->cpu[0],
366366            CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i]);
367367      memcpy (table, old_table, 0x100);
368368
r3957r3958
380380            }
381381         }
382382      }
383      cpu_set_info_ptr (machine->cpu[0],
383      device_set_info_ptr (machine->cpu[0],
384384               CPUINFO_PTR_Z80_CYCLE_TABLE + z80_cycle_table[i],
385385               (void*)table);
386386   }
r3957r3958
390390{
391391   v9938_set_sprite_limit(0, input_port_read(device->machine, "DSW") & 0x20);
392392   v9938_set_resolution(0, input_port_read(device->machine, "DSW") & 0x03);
393   v9938_interrupt(0);
393   v9938_interrupt(device->machine, 0);
394394}
395395
396396INTERRUPT_GEN( msx_interrupt )
src/mess/machine/adc080x.c
r3957r3958
144144   adc080x->intf = device->static_config;
145145
146146   assert(adc080x->intf != NULL);
147   assert(adc080x->intf->clock > 0);
147   assert(device->clock > 0);
148148
149149   /* set initial values */
150150   adc080x->eoc = 1;
151151
152152   /* allocate cycle timer */
153153   adc080x->cycle_timer = timer_alloc(device->machine, cycle_tick, (void *)device);
154   timer_adjust_periodic(adc080x->cycle_timer, attotime_zero, 0, ATTOTIME_IN_HZ(adc080x->intf->clock));
154   timer_adjust_periodic(adc080x->cycle_timer, attotime_zero, 0, ATTOTIME_IN_HZ(device->clock));
155155
156156   /* register for state saving */
157157   state_save_register_item(device->machine, "adc080x", device->tag, 0, adc080x->address);
r3957r3958
189189      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
190190
191191      /* --- the following bits of info are returned as NULL-terminated strings --- */
192      case DEVINFO_STR_NAME:                     info->s = "National Semiconductor ADC0808";   break;
193      case DEVINFO_STR_FAMILY:                  info->s = "National Semiconductor ADC080";   break;
194      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
195      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
196      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
192      case DEVINFO_STR_NAME:                     strcpy(info->s, "National Semiconductor ADC0808");   break;
193      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "National Semiconductor ADC080");   break;
194      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
195      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
196      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
197197   }
198198}
199199
r3957r3958
202202   switch (state)
203203   {
204204      /* --- the following bits of info are returned as NULL-terminated strings --- */
205      case DEVINFO_STR_NAME:                     info->s = "National Semiconductor ADC0809";   break;
205      case DEVINFO_STR_NAME:                     strcpy(info->s, "National Semiconductor ADC0809");   break;
206206
207207      default:                              DEVICE_GET_INFO_CALL(adc0808);            break;
208208   }
src/mess/machine/adc080x.h
r3957r3958
4242#define ADC0808      DEVICE_GET_INFO_NAME(adc0808)
4343#define ADC0809      DEVICE_GET_INFO_NAME(adc0809)
4444
45#define MDRV_ADC0808_ADD(_tag, _intrf) \
46   MDRV_DEVICE_ADD(_tag, ADC0808) \
45#define MDRV_ADC0808_ADD(_tag, _clock, _intrf) \
46   MDRV_DEVICE_ADD(_tag, ADC0808, _clock) \
4747   MDRV_DEVICE_CONFIG(_intrf)
4848
4949#define MDRV_ADC0808_REMOVE(_tag) \
5050   MDRV_DEVICE_REMOVE(_tag, ADC0808)
5151
52#define MDRV_ADC0809_ADD(_tag, _intrf) \
53   MDRV_DEVICE_ADD(_tag, ADC0809) \
52#define MDRV_ADC0809_ADD(_tag, _clock, _intrf) \
53   MDRV_DEVICE_ADD(_tag, ADC0809, _clock) \
5454   MDRV_DEVICE_CONFIG(_intrf)
5555
5656#define MDRV_ADC0809_REMOVE(_tag) \
r3957r3958
6161typedef struct _adc080x_interface adc080x_interface;
6262struct _adc080x_interface
6363{
64   int clock;               /* the clock (pin 10) of the chip */
65
6664   /* this gets called for every change of the EOC pin (pin 7) */
6765   adc080x_on_eoc_changed_func      on_eoc_changed;
6866
src/mess/machine/lisa.c
r3957r3958
11411141   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM), lisa_OPbaseoverride);
11421142   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[1],ADDRESS_SPACE_PROGRAM), lisa_fdc_OPbaseoverride);
11431143
1144   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M68K_RESET_CALLBACK, (genf *)/*lisa_reset_instr_callback*/NULL);
1144   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M68K_RESET_CALLBACK, (genf *)/*lisa_reset_instr_callback*/NULL);
11451145
11461146   /* init MMU */
11471147
src/mess/machine/sym1.c
r3957r3958
294294   memory_install_readwrite8_handler(cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ),
295295         0xf800, 0xffff, 0, 0, SMH_BANK1, SMH_NOP);
296296   memory_set_bankptr(machine, 1, sym1_monitor + 0x800);
297   cpu_reset(cputag_get_cpu(machine, "main"));
297   device_reset(cputag_get_cpu(machine, "main"));
298298}
src/mess/machine/geneve.c
r3957r3958
276276INTERRUPT_GEN( geneve_hblank_interrupt )
277277{
278278   static int line_count;
279   v9938_interrupt(0);
279   v9938_interrupt(device->machine, 0);
280280   if (++line_count == 262)
281281   {
282282      line_count = 0;
src/mess/machine/i82439tx.c
r3957r3958
199199   }
200200
201201   /* hack to compensate for weird issue (maybe the Pentium core needs to support caching? */
202   if ((cpu_get_reg(machine->cpu[0], REG_PC) == 0xFCB01) && !strcmp(machine->gamedrv->name, "at586"))
202   if ((cpu_get_reg(machine->cpu[0], REG_GENPC) == 0xFCB01) && !strcmp(machine->gamedrv->name, "at586"))
203203   {
204204      memory_region(machine, "user1")[0x3CB01] = 0xF3;
205205      memory_region(machine, "user1")[0x3CB02] = 0xA4;
src/mess/machine/lviv.c
r3957r3958
267267   /* Set registers */
268268   lo = data[0x14112] & 0x0ff;
269269   hi = data[0x14111] & 0x0ff;
270   cpu_set_reg(machine->cpu[0], I8080_BC, (hi << 8) | lo);
270   cpu_set_reg(machine->cpu[0], I8085_BC, (hi << 8) | lo);
271271   lo = data[0x14114] & 0x0ff;
272272   hi = data[0x14113] & 0x0ff;
273   cpu_set_reg(machine->cpu[0], I8080_DE, (hi << 8) | lo);
273   cpu_set_reg(machine->cpu[0], I8085_DE, (hi << 8) | lo);
274274   lo = data[0x14116] & 0x0ff;
275275   hi = data[0x14115] & 0x0ff;
276   cpu_set_reg(machine->cpu[0], I8080_HL, (hi << 8) | lo);
276   cpu_set_reg(machine->cpu[0], I8085_HL, (hi << 8) | lo);
277277   lo = data[0x14118] & 0x0ff;
278278   hi = data[0x14117] & 0x0ff;
279   cpu_set_reg(machine->cpu[0], I8080_AF, (hi << 8) | lo);
279   cpu_set_reg(machine->cpu[0], I8085_AF, (hi << 8) | lo);
280280   lo = data[0x14119] & 0x0ff;
281281   hi = data[0x1411a] & 0x0ff;
282   cpu_set_reg(machine->cpu[0], I8080_SP, (hi << 8) | lo);
282   cpu_set_reg(machine->cpu[0], I8085_SP, (hi << 8) | lo);
283283   lo = data[0x1411b] & 0x0ff;
284284   hi = data[0x1411c] & 0x0ff;
285   cpu_set_reg(machine->cpu[0], I8080_PC, (hi << 8) | lo);
285   cpu_set_reg(machine->cpu[0], I8085_PC, (hi << 8) | lo);
286286
287287   /* Memory dump */
288288   memcpy (mess_ram, data+0x0011, 0xc000);
r3957r3958
298298
299299static void dump_registers(running_machine *machine)
300300{
301   logerror("PC   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_PC));
302   logerror("SP   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_SP));
303   logerror("AF   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_AF));
304   logerror("BC   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_BC));
305   logerror("DE   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_DE));
306   logerror("HL   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8080_HL));
301   logerror("PC   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_PC));
302   logerror("SP   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_SP));
303   logerror("AF   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_AF));
304   logerror("BC   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_BC));
305   logerror("DE   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_DE));
306   logerror("HL   = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], I8085_HL));
307307}
308308
309309static int lviv_verify_snapshot (UINT8 * data, UINT32 size)
src/mess/machine/pc8801.c
r3957r3958
828828   else
829829      cpu_resume(machine->cpu[1], SUSPEND_REASON_DISABLE);
830830   cpu_set_input_line_vector(machine->cpu[1],0,0);
831   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1);
832   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1);
833   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1,0);
834   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,0);
831   floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), 1);
832   floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 1), 1);
833   floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), 1,0);
834   floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, 1), 1,0);
835835}
836836
837837/*
src/mess/machine/6551.c
r3957r3958
618618      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
619619
620620      /* --- the following bits of info are returned as NULL-terminated strings --- */
621      case DEVINFO_STR_NAME:                     info->s = "MOS Technology 6551 ACIA";      break;
622      case DEVINFO_STR_FAMILY:                  info->s = "MOS Technology 6551 ACIA";      break;
623      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
624      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
621      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS Technology 6551 ACIA");      break;
622      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MOS Technology 6551 ACIA");      break;
623      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
624      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
625625      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
626626   }
627627}
src/mess/machine/atom.c
r3957r3958
316316
317317
318318   /* set new pc address */
319   cpu_set_reg( image->machine->cpu[0], REG_PC, exec);
319   cpu_set_reg( image->machine->cpu[0], REG_GENPC, exec);
320320
321321   /* free the data */
322322   free(quickload_data);
src/mess/machine/ay31015.c
r3957r3958
767767      case DEVINFO_FCT_RESET:               info->reset = DEVICE_RESET_NAME( ay31015 );      break;
768768
769769      /* --- the following bits of info are returned as NULL-terminated strings --- */
770      case DEVINFO_STR_NAME:               info->s = "AY-3-1015";                     break;
771      case DEVINFO_STR_FAMILY:            info->s = "AY-3-1015/AY-5-1013 UARTs";         break;
772      case DEVINFO_STR_VERSION:            info->s = "1.00";                        break;
773      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;                        break;
774      case DEVINFO_STR_CREDITS:            info->s = "Copyright the MAME and MESS Teams";   break;
770      case DEVINFO_STR_NAME:               strcpy(info->s, "AY-3-1015");                     break;
771      case DEVINFO_STR_FAMILY:            strcpy(info->s, "AY-3-1015/AY-5-1013 UARTs");         break;
772      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.00");                        break;
773      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                        break;
774      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright the MAME and MESS Teams");   break;
775775   }
776776}
777777
src/mess/machine/6551.h
r3957r3958
1717#define ACIA6551      DEVICE_GET_INFO_NAME(acia6551)
1818
1919#define MDRV_ACIA6551_ADD(_tag)   \
20   MDRV_DEVICE_ADD((_tag), ACIA6551)
20   MDRV_DEVICE_ADD((_tag), ACIA6551, 0)
2121
2222
2323/***************************************************************************
src/mess/machine/ay31015.h
r3957r3958
6666***************************************************************************/
6767
6868#define MDRV_AY31015_ADD(_tag, _config)   \
69    MDRV_DEVICE_ADD(_tag, AY31015)      \
69    MDRV_DEVICE_ADD(_tag, AY31015, 0)      \
7070    MDRV_DEVICE_CONFIG(_config)
7171
7272#define MDRV_AY31015_REMOVE(_tag)      \
src/mess/machine/partner.c
r3957r3958
396396const dma8257_interface partner_dma =
397397{
398398   0,
399   XTAL_16MHz / 9,
400399
401400   radio86_dma_read_byte,
402401   partner_dma_write_byte,
src/mess/machine/pc_fdc.c
r3957r3958
120120
121121   for (i = 0; i < device_count(machine, IO_FLOPPY); i++)
122122   {
123      img = image_from_devtype_and_index(IO_FLOPPY, i);
123      img = image_from_devtype_and_index(machine, IO_FLOPPY, i);
124124      floppy_drive_set_geometry(img, FLOPPY_DRIVE_DS_80);
125125   }
126126}
r3957r3958
134134   if (!fdc->fdc_interface.get_image)
135135   {
136136      if (floppy_index < device_count(device->machine, IO_FLOPPY))
137         image = image_from_devtype_and_index(IO_FLOPPY, floppy_index);
137         image = image_from_devtype_and_index(device->machine, IO_FLOPPY, floppy_index);
138138   }
139139   else
140140   {
141      image = fdc->fdc_interface.get_image(floppy_index);
141      image = fdc->fdc_interface.get_image(device->machine, floppy_index);
142142   }
143143   return image;
144144}
r3957r3958
259259   floppy_count = device_count(machine, IO_FLOPPY);
260260
261261   if (floppy_count > (fdc->digital_output_register & 0x03))
262      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0);
262      floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0);
263263
264264   fdc->digital_output_register = data;
265265
r3957r3958
267267
268268   /* set floppy drive motor state */
269269   if (floppy_count > 0)
270      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0),   (data>>4) & 0x0f);
270      floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0),   (data>>4) & 0x0f);
271271   if (floppy_count > 1)
272      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1),   (data>>5) & 0x01);
272      floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 1),   (data>>5) & 0x01);
273273   if (floppy_count > 2)
274      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 2),   (data>>6) & 0x01);
274      floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 2),   (data>>6) & 0x01);
275275   if (floppy_count > 3)
276      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 3),   (data>>7) & 0x01);
276      floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 3),   (data>>7) & 0x01);
277277
278278   if ((data>>4) & (1<<selected_drive))
279279   {
280280      if (floppy_count > selected_drive)
281         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, selected_drive), 1, 0);
281         floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, selected_drive), 1, 0);
282282   }
283283
284284   /* changing the DMA enable bit, will affect the terminal count state
r3957r3958
364364
365365   /* set floppy drive motor state */
366366   if (floppy_count > 0)
367      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), data & 0x01);
367      floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), data & 0x01);
368368
369369   if ( data & 0x01 )
370370   {
371371      if ( floppy_count )
372         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
372         floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), 1, 0);
373373   }
374374
375375   /* Is the watchdog timer disabled */
r3957r3958
453453    }
454454
455455   if (LOG_FDC)
456      logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_PC), offset, data);
456      logerror("pc_fdc_r(): pc=0x%08x offset=%d result=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC), offset, data);
457457   return data;
458458}
459459
r3957r3958
462462WRITE8_HANDLER ( pc_fdc_w )
463463{
464464   if (LOG_FDC)
465      logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_PC), offset, data);
465      logerror("pc_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC), offset, data);
466466
467467   switch(offset)
468468   {
r3957r3958
501501WRITE8_HANDLER ( pcjr_fdc_w )
502502{
503503   if (LOG_FDC)
504      logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_PC), offset, data);
504      logerror("pcjr_fdc_w(): pc=0x%08x offset=%d data=0x%02X\n", (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC), offset, data);
505505
506506   switch(offset)
507507   {
src/mess/machine/99_ide.c
r3957r3958
8888
8989   clock interrupt callback
9090*/
91static void clk_interrupt_callback(int state)
91static void clk_interrupt_callback(running_machine *machine, int state)
9292{
9393   clk_irq = state;
94   ti99_peb_set_ila_bit(Machine, inta_ide_clk_bit, state);
94   ti99_peb_set_ila_bit(machine, inta_ide_clk_bit, state);
9595}
9696
9797/*
src/mess/machine/pc_fdc.h
r3957r3958
2828{   
2929   void (*pc_fdc_interrupt)(running_machine*,int);
3030   void (*pc_fdc_dma_drq)(running_machine*,int,int);   
31   const device_config *(*get_image)(int floppy_index);
31   const device_config *(*get_image)(running_machine*, int floppy_index);
3232   device_config *(*get_device)(running_machine*);
3333};
3434
src/mess/machine/mc6843.c
r3957r3958
859859      case DEVINFO_FCT_RESET:            info->reset = DEVICE_RESET_NAME(mc6843);   break;
860860
861861      /* --- the following bits of info are returned as NULL-terminated strings --- */
862              case DEVINFO_STR_NAME:            info->s = "Motorola MC6843 floppy controller";   break;
863      case DEVINFO_STR_FAMILY:         info->s = "MC6843";            break;
864      case DEVINFO_STR_VERSION:         info->s = "1.00";            break;
865      case DEVINFO_STR_SOURCE_FILE:         info->s = __FILE__;            break;
866      case DEVINFO_STR_CREDITS:         info->s = "Copyright the MAME and MESS Teams";  break;
862              case DEVINFO_STR_NAME:            strcpy(info->s, "Motorola MC6843 floppy controller");   break;
863      case DEVINFO_STR_FAMILY:         strcpy(info->s, "MC6843");            break;
864      case DEVINFO_STR_VERSION:         strcpy(info->s, "1.00");            break;
865      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);            break;
866      case DEVINFO_STR_CREDITS:         strcpy(info->s, "Copyright the MAME and MESS Teams");  break;
867867   }
868868}
src/mess/machine/mm58274c.c
r3957r3958
544544      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(mm58274c);   break;
545545
546546      /* --- the following bits of info are returned as NULL-terminated strings --- */
547      case DEVINFO_STR_NAME:                     info->s = "National Semiconductor MM58274C";break;
548      case DEVINFO_STR_FAMILY:                  info->s = "National Semiconductor MM58274C";break;
549      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
550      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
551      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
547      case DEVINFO_STR_NAME:                     strcpy(info->s, "National Semiconductor MM58274C");break;
548      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "National Semiconductor MM58274C");break;
549      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
550      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
551      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
552552   }
553553}
src/mess/machine/mc6843.h
r3957r3958
2222
2323
2424#define MDRV_MC6843_ADD(_tag, _intrf) \
25  MDRV_DEVICE_ADD(_tag, MC6843)         \
25  MDRV_DEVICE_ADD(_tag, MC6843, 0)         \
2626  MDRV_DEVICE_CONFIG(_intrf)
2727
2828#define MDRV_MC6843_REMOVE(_tag)      \
src/mess/machine/mm58274c.h
r3957r3958
3636***************************************************************************/
3737
3838#define MDRV_MM58274C_ADD(_tag, _intrf) \
39   MDRV_DEVICE_ADD(_tag, MM58274C) \
39   MDRV_DEVICE_ADD(_tag, MM58274C, 0) \
4040   MDRV_DEVICE_CONFIG(_intrf)
4141
4242#endif /* MM58274C_H */
src/mess/machine/bebox.c
r3957r3958
323323      assert_always((interrupt_bit < ARRAY_LENGTH(interrupt_names)) && (interrupt_names[interrupt_bit] != NULL), "Raising invalid interrupt");
324324
325325      logerror("bebox_set_irq_bit(): pc[0]=0x%08x pc[1]=0x%08x %s interrupt #%u (%s)\n",
326         (unsigned) cpu_get_reg( machine->cpu[0], REG_PC),
327         (unsigned) cpu_get_reg( machine->cpu[1], REG_PC),
326         (unsigned) cpu_get_reg( machine->cpu[0], REG_GENPC),
327         (unsigned) cpu_get_reg( machine->cpu[1], REG_GENPC),
328328         val ? "Asserting" : "Clearing",
329329         interrupt_bit, interrupt_names[interrupt_bit]);
330330   }
r3957r3958
423423}
424424
425425
426static const device_config *bebox_fdc_get_image(int floppy_index)
426static const device_config *bebox_fdc_get_image(running_machine *machine, int floppy_index)
427427{
428428   /* the BeBox boot ROM seems to query for floppy #1 when it should be
429429    * querying for floppy #0 */
430   return image_from_devtype_and_index(IO_FLOPPY, 0);
430   return image_from_devtype_and_index(machine, IO_FLOPPY, 0);
431431}
432432
433433static device_config * bebox_get_device(running_machine *machine )
r3957r3958
953953                        ((x << 8) & 0xff0000) | \
954954                        ((x << 24) & 0xff000000))
955955
956static UINT32 scsi53c810_fetch(UINT32 dsp)
956static UINT32 scsi53c810_fetch(running_machine *machine, UINT32 dsp)
957957{
958958   UINT32 result;
959   result = memory_read_dword_64be( cpu_get_address_space( Machine->cpu[0], ADDRESS_SPACE_PROGRAM ), dsp & 0x7FFFFFFF);
959   result = memory_read_dword_64be( cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ), dsp & 0x7FFFFFFF);
960960   return BYTE_REVERSE32(result);
961961}
962962
r3957r3958
967967}
968968
969969
970static void scsi53c810_dma_callback(UINT32 src, UINT32 dst, int length, int byteswap)
970static void scsi53c810_dma_callback(running_machine *machine, UINT32 src, UINT32 dst, int length, int byteswap)
971971{
972972}
973973
r3957r3958
10221022               /* brutal ugly hack; at some point the PCI code should be handling this stuff */
10231023               if (scsi53c810_data[5] != 0xFFFFFFF0)
10241024               {
1025                  const address_space *space = cpu_get_address_space( Machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1025                  const address_space *space = cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM );
10261026
10271027                  addr = (scsi53c810_data[5] | 0xC0000000) & ~0xFF;
10281028                  memory_install_read64_handler(space, addr, addr + 0xFF, 0, 0, scsi53c810_r);
r3957r3958
10941094{
10951095   pc_fdc_init(machine, &bebox_fdc_interface);
10961096   /* SCSI */
1097   lsi53c810_init(&scsi53c810_intf);
1097   lsi53c810_init(machine, &scsi53c810_intf);
10981098   add_exit_callback(machine, bebox_exit);
10991099}
11001100
src/mess/machine/e0516.c
r3957r3958
240240      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
241241
242242      /* --- the following bits of info are returned as NULL-terminated strings --- */
243      case DEVINFO_STR_NAME:                     info->s = "E05-16";                     break;
244      case DEVINFO_STR_FAMILY:                  info->s = "E05-16";                     break;
245      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
246      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
247      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
243      case DEVINFO_STR_NAME:                     strcpy(info->s, "E05-16");               break;
244      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "E05-16");               break;
245      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
246      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
247      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");      break;
248248   }
249249}
src/mess/machine/e0516.h
r3957r3958
44#define E0516   DEVICE_GET_INFO_NAME(e0516)
55
66#define MDRV_E0516_ADD(_tag, _config)   \
7   MDRV_DEVICE_ADD(_tag, E0516)      \
7   MDRV_DEVICE_ADD(_tag, E0516, 0)      \
88   MDRV_DEVICE_CONFIG(_config)
99
1010/* interface */
src/mess/machine/mtx.c
r3957r3958
228228
229229const z80ctc_interface mtx_ctc_intf =
230230{
231   "main",
232   MTX_SYSTEM_CLOCK,
233231   0,
234232   mtx_ctc_interrupt,
235233   0,
src/mess/machine/abc77.c
r3957r3958
293293   MDRV_CPU_IO_MAP(abc77_io_map, 0)
294294
295295   /* watchdog */
296   MDRV_WATCHDOG_TIME_INIT(UINT64_ATTOTIME_IN_HZ(XTAL_4_608MHz/(3*5)))
296   MDRV_WATCHDOG_TIME_INIT(HZ(XTAL_4_608MHz/(3*5)))
297297
298298   /* serial clock timer */
299299   MDRV_TIMER_ADD_PERIODIC("serial", clock_tick, HZ(XTAL_4_608MHz/(3*5)/16))
r3957r3958
378378      case DEVINFO_FCT_RESET:                     /* Nothing */                        break;
379379
380380      /* --- the following bits of info are returned as NULL-terminated strings --- */
381      case DEVINFO_STR_NAME:                     info->s = "Luxor ABC-77";               break;
382      case DEVINFO_STR_FAMILY:                  info->s = "Luxor ABC";                  break;
383      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
384      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
385      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
381      case DEVINFO_STR_NAME:                     strcpy(info->s, "Luxor ABC-77");         break;
382      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Luxor ABC");            break;
383      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
384      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
385      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team"); break;
386386   }
387387}
src/mess/machine/ins8250.c
r3957r3958
633633      case DEVINFO_FCT_RESET:                  info->reset = DEVICE_RESET_NAME(ins8250);   break;
634634
635635      /* --- the following bits of info are returned as NULL-terminated strings --- */
636      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor INS8250/INS8250B";   break;
637      case DEVINFO_STR_FAMILY:               info->s = "INS8250";                  break;
638      case DEVINFO_STR_VERSION:               info->s = "1.00";                     break;
639      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__;                     break;
640      case DEVINFO_STR_CREDITS:               info->s = "Copyright the MESS Team";      break;
636      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor INS8250/INS8250B");   break;
637      case DEVINFO_STR_FAMILY:               strcpy(info->s, "INS8250");               break;
638      case DEVINFO_STR_VERSION:               strcpy(info->s, "1.00");               break;
639      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__);               break;
640      case DEVINFO_STR_CREDITS:               strcpy(info->s, "Copyright the MESS Team");   break;
641641   }
642642}
643643
r3957r3958
647647   switch ( state )
648648   {
649649      /* --- the following bits of info are returned as 64-bit signed integers --- */
650      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor INS8250A/INS82C50A";   break;
650      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor INS8250A/INS82C50A");   break;
651651
652652      /* --- the following bits of info are returned as pointers to data or functions --- */
653653      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ins8250a);   break;
r3957r3958
662662   switch ( state )
663663   {
664664      /* --- the following bits of info are returned as 64-bit signed integers --- */
665      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor NS16450/PC16450";   break;
665      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16450/PC16450");   break;
666666
667667      /* --- the following bits of info are returned as pointers to data or functions --- */
668668      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16450);   break;
r3957r3958
677677   switch ( state )
678678   {
679679      /* --- the following bits of info are returned as 64-bit signed integers --- */
680      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor NS16550/PC16550";   break;
680      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16550/PC16550");   break;
681681
682682      /* --- the following bits of info are returned as pointers to data or functions --- */
683683      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16550);   break;
r3957r3958
692692   switch ( state )
693693   {
694694      /* --- the following bits of info are returned as 64-bit signed integers --- */
695      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor NS16550A/PC16550A";   break;
695      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor NS16550A/PC16550A");   break;
696696
697697      /* --- the following bits of info are returned as pointers to data or functions --- */
698698      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(ns16550a);   break;
r3957r3958
707707   switch ( state )
708708   {
709709      /* --- the following bits of info are returned as 64-bit signed integers --- */
710      case DEVINFO_STR_NAME:                  info->s = "National Semiconductor PC16550D";   break;
710      case DEVINFO_STR_NAME:                  strcpy(info->s, "National Semiconductor PC16550D");   break;
711711
712712      /* --- the following bits of info are returned as pointers to data or functions --- */
713713      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(pc16550d);   break;
src/mess/machine/abc77.h
r3957r3958
5151/* inline configuration */
5252#define MDRV_ABC77_ADD(config) \
5353   MDRV_SPEAKER_STANDARD_MONO("mono")\
54   MDRV_DEVICE_ADD(ABC77_TAG, ABC77)\
54   MDRV_DEVICE_ADD(ABC77_TAG, ABC77, 0)\
5555   MDRV_DEVICE_CONFIG(config)
5656
5757/* device interface */
src/mess/machine/ins8250.h
r3957r3958
5555***************************************************************************/
5656
5757#define MDRV_INS8250_ADD(_tag, _intrf) \
58   MDRV_DEVICE_ADD(_tag, INS8250) \
58   MDRV_DEVICE_ADD(_tag, INS8250, 0) \
5959   MDRV_DEVICE_CONFIG(_intrf)
6060
6161#define MDRV_INS8250_REMOVE(_tag) \
r3957r3958
6363
6464
6565#define MDRV_NS16450_ADD(_tag, _intrf) \
66   MDRV_DEVICE_ADD(_tag, NS16450) \
66   MDRV_DEVICE_ADD(_tag, NS16450, 0) \
6767   MDRV_DEVICE_CONFIG(_intrf)
6868
6969#define MDRV_NS16450_REMOVE(_tag) \
r3957r3958
7171
7272
7373#define MDRV_NS16550_ADD(_tag, _intrf) \
74   MDRV_DEVICE_ADD(_tag, NS16550) \
74   MDRV_DEVICE_ADD(_tag, NS16550, 0) \
7575   MDRV_DEVICE_CONFIG(_intrf)
7676
7777#define MDRV_NS16550_REMOVE(_tag) \
src/mess/machine/zx8302.c
r3957r3958
668668      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(zx8302);   break;
669669
670670      /* --- the following bits of info are returned as NULL-terminated strings --- */
671      case DEVINFO_STR_NAME:                     info->s = "Sinclair ZX8302";            break;
672      case DEVINFO_STR_FAMILY:                  info->s = "Sinclair ZX83";               break;
673      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
674      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
675      case DEVINFO_STR_CREDITS:                  info->s = "Copyright MESS Team";         break;
671      case DEVINFO_STR_NAME:                     strcpy(info->s, "Sinclair ZX8302");            break;
672      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Sinclair ZX83");               break;
673      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
674      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
675      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
676676   }
677677}
src/mess/machine/snescart.c
r3957r3958
119119***************************************************************************/
120120
121121/* Loads the battery backed RAM into the appropriate memory area */
122static void snes_load_sram(void)
122static void snes_load_sram(running_machine *machine)
123123{
124124   UINT8 ii;
125125   UINT8 *battery_ram, *ptr;
126126
127127   battery_ram = malloc_or_die(snes_cart.sram_max);
128128   ptr = battery_ram;
129   image_battery_load(image_from_devtype_and_index(IO_CARTSLOT,0), battery_ram, snes_cart.sram_max);
129   image_battery_load(image_from_devtype_and_index(machine, IO_CARTSLOT,0), battery_ram, snes_cart.sram_max);
130130
131131   if (snes_cart.mode == SNES_MODE_20)
132132   {
r3957r3958
165165}
166166
167167/* Saves the battery backed RAM from the appropriate memory area */
168static void snes_save_sram(void)
168static void snes_save_sram(running_machine *machine)
169169{
170170   UINT8 ii;
171171   UINT8 *battery_ram, *ptr;
r3957r3958
198198      }
199199   }
200200
201   image_battery_save(image_from_devtype_and_index(IO_CARTSLOT,0), battery_ram, snes_cart.sram_max);
201   image_battery_save(image_from_devtype_and_index(machine, IO_CARTSLOT,0), battery_ram, snes_cart.sram_max);
202202
203203   free(battery_ram);
204204}
r3957r3958
207207{
208208   /* Save SRAM */
209209   if( snes_cart.sram > 0 )
210      snes_save_sram();
210      snes_save_sram(machine);
211211}
212212
213213MACHINE_START( snes_mess )
r3957r3958
761761   }
762762
763763   /* Load SRAM */
764   snes_load_sram();
764   snes_load_sram(space->machine);
765765
766766   /* All done */
767767   return INIT_PASS;
src/mess/machine/apple2.c
r3957r3958
569569
570570void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask)
571571{
572   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, (unsigned int) cpu_get_reg(machine->cpu[0], REG_PC)));
572   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, (unsigned int) cpu_get_reg(machine->cpu[0], REG_GENPC)));
573573
574574   assert((val & mask) == val);
575575
src/mess/machine/zx8302.h
r3957r3958
4444
4545#define ZX8302 DEVICE_GET_INFO_NAME( zx8302 )
4646
47#define MDRV_ZX8302_ADD(_tag, _clock, _config) \
48   MDRV_DEVICE_ADD(_tag, ZX8302, _clock) \
49   MDRV_DEVICE_CONFIG(_config)
50
4751/* interface */
4852typedef struct _zx8302_interface zx8302_interface;
4953struct _zx8302_interface
5054{
51   int clock;               /* the CPU clock (pin 25) of the chip */
5255   int rtc_clock;            /* the RTC clock (pin 30) of the chip */
5356
5457   const char *mdv1_tag;      /* microdrive 1 */
src/mess/machine/c64.c
r3957r3958
421421const cia6526_interface c64_ntsc_cia0 =
422422{
423423   c64_cia0_interrupt,
424   0.0,
425424   60,
426425
427426   {
r3957r3958
433432const cia6526_interface c64_pal_cia0 =
434433{
435434   c64_cia0_interrupt,
436   0.0,
437435   50,
438436
439437   {
r3957r3958
445443const cia6526_interface c64_ntsc_cia1 =
446444{
447445   c64_cia1_interrupt,
448   0.0,
449446   60,
450447
451448   {
r3957r3958
457454const cia6526_interface c64_pal_cia1 =
458455{
459456   c64_cia1_interrupt,
460   0.0,
461457   50,
462458
463459   {
r3957r3958
676672   static int old = -1, exrom, game;
677673   int loram, hiram, charen;
678674   int ultimax_mode = 0;
679   int data = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
675   int data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
680676
681677   /* If nothing has changed or reset = 0, don't do anything */
682678   if ((data == old) && (exrom == c64_exrom) && (game == c64_game) && !reset)
r3957r3958
10211017static void c64_common_driver_init (running_machine *machine)
10221018{
10231019   /* configure the M6510 port */
1024   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTREAD, (genf *) c64_m6510_port_read);
1025   cpu_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c64_m6510_port_write);
1020   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTREAD, (genf *) c64_m6510_port_read);
1021   device_set_info_fct(machine->cpu[0], CPUINFO_PTR_M6510_PORTWRITE, (genf *) c64_m6510_port_write);
10261022
10271023   if (!ultimax)
10281024   {
src/mess/machine/genesis.c
r3957r3958
12051205         genesis_sram_end += 1;
12061206     
12071207      genesis_sram = malloc_or_die(genesis_sram_end - genesis_sram_start);
1208      image_battery_load(image_from_devtype_and_index(IO_CARTSLOT, 0), genesis_sram, genesis_sram_end - genesis_sram_start);
1208      image_battery_load(image_from_devtype_and_index(image->machine, IO_CARTSLOT, 0), genesis_sram, genesis_sram_end - genesis_sram_start);
12091209
12101210      megadriv_backupram = (UINT16*)ROM + ((genesis_sram_start & 0x3fffff) / 2);
12111211      memmove(&megadriv_backupram[0], genesis_sram, genesis_sram_end - genesis_sram_start);
r3957r3958
12291229   /* Write out the battery file if necessary */
12301230   if (has_sram && (genesis_sram != NULL) && (genesis_sram_end - genesis_sram_start > 0))
12311231   {
1232      image_battery_save(image_from_devtype_and_index(IO_CARTSLOT, 0), genesis_sram, genesis_sram_end - genesis_sram_start);
1232      image_battery_save(image_from_devtype_and_index(image->machine, IO_CARTSLOT, 0), genesis_sram, genesis_sram_end - genesis_sram_start);
12331233   }
12341234}
12351235
src/mess/machine/hd63450.c
r3957r3958
436436      case DEVINFO_FCT_RESET:                     /*info->reset = DEVICE_RESET_NAME(hd63450);*/   break;
437437
438438      /* --- the following bits of info are returned as NULL-terminated strings --- */
439      case DEVINFO_STR_NAME:                     info->s = "Hitachi HD63450";            break;
440      case DEVINFO_STR_FAMILY:                  info->s = "DMA Controller";               break;
441      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
442      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
443      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";       break;
439      case DEVINFO_STR_NAME:                     strcpy(info->s, "Hitachi HD63450");         break;
440      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "DMA Controller");         break;
441      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
442      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
443      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");   break;
444444   }
445445}
446446
src/mess/machine/pc.c
r3957r3958
220220
221221static PIC8259_SET_INT_LINE( pcjr_pic8259_master_set_int_line )
222222{
223   if ( cpu_get_reg( device->machine->cpu[0], REG_PC ) == 0xF0454 )
223   if ( cpu_get_reg( device->machine->cpu[0], REG_GENPC ) == 0xF0454 )
224224   {
225225      timer_adjust_oneshot( pc_int_delay_timer, cpu_clocks_to_attotime(device->machine->cpu[0], 1), interrupt );
226226   }
r3957r3958
521521}
522522
523523
524static void pcjr_set_keyb_int(int state)
524static void pcjr_set_keyb_int(running_machine *machine, int state)
525525{
526526   if ( state )
527527   {
r3957r3958
11471147   pic8259_set_irq_line(pc_devices.pic8259_master, irq, state);
11481148}
11491149
1150static void pc_set_keyb_int(int state) {
1150static void pc_set_keyb_int(running_machine *machine, int state)
1151{
11511152   pc_set_irq_line( 1, state );
11521153}
11531154
r3957r3958
11581159 *
11591160 **********************************************************/
11601161
1161void mess_init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(int), void (*set_hdc_int_func)(int,int))
1162void mess_init_pc_common(running_machine *machine, UINT32 flags, void (*set_keyb_int_func)(running_machine *, int), void (*set_hdc_int_func)(int,int))
11621163{
11631164   if ( set_keyb_int_func != NULL )
11641165      init_pc_common(machine, flags, set_keyb_int_func);
src/mess/machine/hd63450.h
r3957r3958
6767
6868#define HD63450 DEVICE_GET_INFO_NAME(hd63450)
6969
70#define MDRV_HD63450_ADD(_tag, _config) \
71   MDRV_DEVICE_ADD(_tag, HD63450, 0) \
72   MDRV_DEVICE_CONFIG(_config)
73
7074READ16_DEVICE_HANDLER( hd63450_r );
7175WRITE16_DEVICE_HANDLER( hd63450_w );
src/mess/machine/ti99_4x.c
r3957r3958
889889INTERRUPT_GEN( ti99_4ev_hblank_interrupt )
890890{
891891   static int line_count;
892   v9938_interrupt(0);
892   v9938_interrupt(device->machine, 0);
893893   if (++line_count == 262)
894894   {
895895      line_count = 0;
src/mess/machine/smc92x4.c
r3957r3958
12581258
12591259
12601260MACHINE_DRIVER_START( smc92x4_hd )
1261   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
1261   MDRV_DEVICE_ADD( "harddisk1", HARDDISK, 0 )
12621262   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
1263   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
1263   MDRV_DEVICE_ADD( "harddisk2", HARDDISK, 0 )
12641264   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
1265   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
1265   MDRV_DEVICE_ADD( "harddisk3", HARDDISK, 0 )
12661266   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
12671267MACHINE_DRIVER_END
src/mess/machine/msm8251.c
r3957r3958
820820      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(msm8251);   break;
821821
822822      /* --- the following bits of info are returned as NULL-terminated strings --- */
823      case DEVINFO_STR_NAME:                     info->s = "Intel 8251 UART";            break;
824      case DEVINFO_STR_FAMILY:                  info->s = "Intel 8251 UART";            break;
825      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
826      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
823      case DEVINFO_STR_NAME:                     strcpy(info->s, "Intel 8251 UART");            break;
824      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Intel 8251 UART");            break;
825      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
826      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
827827      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
828828   }
829829}
src/mess/machine/tms5501.c
r3957r3958
520520      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(tms5501);   break;
521521
522522      /* --- the following bits of info are returned as NULL-terminated strings --- */
523      case DEVINFO_STR_NAME:                     info->s = "TMS5501";               break;
524      case DEVINFO_STR_FAMILY:                  info->s = "TMS5501";               break;
525      case DEVINFO_STR_VERSION:                  info->s = "1.0";                     break;
526      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                     break;
523      case DEVINFO_STR_NAME:                     strcpy(info->s, "TMS5501");               break;
524      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "TMS5501");               break;
525      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
526      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
527527      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
528528   }
529529}
src/mess/machine/msm8251.h
r3957r3958
2929#define MSM8251_STATUS_TX_READY   0x01
3030
3131#define MDRV_MSM8251_ADD(_tag, _intrf) \
32   MDRV_DEVICE_ADD(_tag, MSM8251) \
32   MDRV_DEVICE_ADD(_tag, MSM8251, 0) \
3333   MDRV_DEVICE_CONFIG(_intrf)
3434
3535#define MDRV_MSM8251_REMOVE(_tag) \
src/mess/machine/tms5501.h
r3957r3958
3939***************************************************************************/
4040
4141#define MDRV_TMS5501_ADD(_tag, _intrf) \
42   MDRV_DEVICE_ADD(_tag, TMS5501) \
42   MDRV_DEVICE_ADD(_tag, TMS5501, 0) \
4343   MDRV_DEVICE_CONFIG(_intrf)
4444
4545
src/mess/machine/kc.c
r3957r3958
235235
236236static TIMER_CALLBACK(kc85_disk_reset_timer_callback)
237237{
238   cpu_set_reg(machine->cpu[1], REG_PC, 0x0f000);
239   cpu_set_reg(machine->cpu[0], REG_PC, 0x0f000);
238   cpu_set_reg(machine->cpu[1], REG_GENPC, 0x0f000);
239   cpu_set_reg(machine->cpu[0], REG_GENPC, 0x0f000);
240240}
241241
242242static void kc_disc_interface_init(running_machine *machine)
r3957r3958
16801680
16811681   kc85_3_update_0x00000(machine);
16821682
1683   return (cpunum_get_reg(0, REG_PC) & 0x0ffff);
1683   return (cpunum_get_reg(0, REG_GENPC) & 0x0ffff);
16841684}
16851685
16861686
r3957r3958
16901690
16911691   kc85_4_update_0x00000(machine);
16921692
1693   return (cpunum_get_reg(0, REG_PC) & 0x0ffff);
1693   return (cpunum_get_reg(0, REG_GENPC) & 0x0ffff);
16941694}
16951695#endif
16961696
16971697
16981698static TIMER_CALLBACK(kc85_reset_timer_callback)
16991699{
1700   cpu_set_reg(machine->cpu[0], REG_PC, 0x0f000);
1700   cpu_set_reg(machine->cpu[0], REG_GENPC, 0x0f000);
17011701}
17021702
17031703 READ8_HANDLER ( kc85_pio_data_r )
r3957r3958
18361836
18371837const z80ctc_interface   kc85_ctc_intf =
18381838{
1839   "main",
1840   1379310.344828,
18411839   0,
18421840    kc85_ctc_interrupt,
18431841   kc85_zc0_callback,
src/mess/mess.mak
r3957r3958
4242
4343CPUS += Z80
4444#CPUS += Z180
45CPUS += 8080
46#CPUS += 8085A
45CPUS += I8085
4746CPUS += M6502
4847CPUS += M65C02
4948CPUS += M65SC02
r3957r3958
7877#CPUS += I8041
7978CPUS += I8048
8079#CPUS += I8648
81#CPUS += I8748
80CPUS += I8748
8281#CPUS += MB8884
8382CPUS += I8039
84#CPUS += I8049
83CPUS += I8049
8584CPUS += I8749
8685#CPUS += N7751
8786#CPUS += M58715
r3957r3958
140139#CPUS += TMS32032
141140#CPUS += TMS32051
142141#CPUS += CCPU
143#CPUS += ADSP2100
144#CPUS += ADSP2101
145#CPUS += ADSP2104
146#CPUS += ADSP2105
147#CPUS += ADSP2115
148#CPUS += ADSP2181
142#CPUS += ADSP21XX
149143CPUS += PSXCPU
150144#CPUS += CXD8661R
151145#CPUS += ASAP
r3957r3958
245239CPUS += TMS7000_EXL
246240CPUS += SM8500
247241CPUS += MINX
242CPUS += 8080
243CPUS += 8085A
244#CPUS += ADSP2100
245#CPUS += ADSP2101
246#CPUS += ADSP2104
247#CPUS += ADSP2105
248#CPUS += ADSP2115
249#CPUS += ADSP2181
248250CPUS += I8X41
249251#CPUS += M68000
250252#CPUS += M68008
r3957r3958
419421   $(MESSOBJ)/kaypro.a \
420422   $(MESSOBJ)/kim1.a \
421423   $(MESSOBJ)/kramermc.a \
422   $(MESSOBJ)/luxor.a \
423424   $(MESSOBJ)/lviv.a \
424425   $(MESSOBJ)/lynx.a \
425426   $(MESSOBJ)/magnavox.a \
426   $(MESSOBJ)/mbee.a \
427427   $(MESSOBJ)/mc10.a \
428428   $(MESSOBJ)/memotech.a \
429429   $(MESSOBJ)/mephisto.a \
r3957r3958
431431   $(MESSOBJ)/mk1.a \
432432   $(MESSOBJ)/mk2.a \
433433   $(MESSOBJ)/motorola.a \
434   $(MESSOBJ)/multitch.a \
435   $(MESSOBJ)/nascom1.a \
436434   $(MESSOBJ)/nec.a \
437435   $(MESSOBJ)/necpc.a \
438436   $(MESSOBJ)/nintendo.a \
r3957r3958
461459   $(MESSOBJ)/sharp.a \
462460   $(MESSOBJ)/sinclair.a \
463461   $(MESSOBJ)/sony.a \
464   $(MESSOBJ)/sord.a \
465462   $(MESSOBJ)/special.a \
466463   $(MESSOBJ)/ssystem3.a \
467   $(MESSOBJ)/super80.a \
468464   $(MESSOBJ)/svi.a \
469465   $(MESSOBJ)/svision.a \
470466   $(MESSOBJ)/synertec.a \
471467   $(MESSOBJ)/tangerin.a \
472   $(MESSOBJ)/tatung.a \
473468   $(MESSOBJ)/teamconc.a \
474469   $(MESSOBJ)/telmac.a \
475   $(MESSOBJ)/thomson.a \
476470   $(MESSOBJ)/ti85.a \
477   $(MESSOBJ)/ti99.a \
478471   $(MESSOBJ)/tiger.a \
479472   $(MESSOBJ)/trs80.a \
480473   $(MESSOBJ)/tutor.a \
481474   $(MESSOBJ)/tx0.a \
482475   $(MESSOBJ)/ut88.a \
483476   $(MESSOBJ)/vc4000.a \
484   $(MESSOBJ)/veb.a \
485477   $(MESSOBJ)/vector06.a \
486478   $(MESSOBJ)/votrax.a \
487   $(MESSOBJ)/vtech.a \
488479   $(MESSOBJ)/shared.a \
489480
481#   $(MESSOBJ)/luxor.a \
482#   $(MESSOBJ)/mbee.a \
483#   $(MESSOBJ)/multitch.a \
484#   $(MESSOBJ)/nascom1.a \
485#   $(MESSOBJ)/sord.a \
486#   $(MESSOBJ)/super80.a \
487#   $(MESSOBJ)/tatung.a \
488#   $(MESSOBJ)/ti99.a \
489#   $(MESSOBJ)/thomson.a \
490#   $(MESSOBJ)/veb.a \
491#   $(MESSOBJ)/vtech.a \
490492
493
491494#-------------------------------------------------
492495# the following files are general components and
493496# shared across a number of drivers
src/mess/devices/snapquik.h
r3957r3958
6464***************************************************************************/
6565
6666#define MDRV_SNAPSHOT_ADD(_load, _file_extensions, _delay)   \
67   MDRV_DEVICE_ADD(TAG_SNAPSHOT, SNAPSHOT) \
67   MDRV_DEVICE_ADD(TAG_SNAPSHOT, SNAPSHOT, 0) \
6868   MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, load, SNAPSHOT_LOAD_NAME(_load))   \
6969   MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, file_extensions, _file_extensions) \
7070   MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \
r3957r3958
7777***************************************************************************/
7878
7979#define MDRV_QUICKLOAD_ADD(_load, _file_extensions, _delay)   \
80   MDRV_DEVICE_ADD(TAG_QUICKLOAD, QUICKLOAD) \
80   MDRV_DEVICE_ADD(TAG_QUICKLOAD, QUICKLOAD, 0) \
8181   MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, load, QUICKLOAD_LOAD_NAME(_load))   \
8282   MDRV_DEVICE_CONFIG_DATAPTR(snapquick_config, file_extensions, _file_extensions) \
8383   MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \
src/mess/devices/harddriv.c
r3957r3958
304304      case DEVINFO_PTR_IMAGE_CREATE_OPTSPEC+0:   info->p = (void *) mess_hd_option_spec; break;
305305
306306      /* --- the following bits of info are returned as NULL-terminated strings --- */
307      case DEVINFO_STR_NAME:                  info->s = "Harddisk"; break;
308      case DEVINFO_STR_FAMILY:               info->s = "Harddisk"; break;
309      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__; break;
310      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:      info->s = "chd,hd"; break;
311      case DEVINFO_STR_IMAGE_CREATE_OPTNAME+0:   info->s = "chd"; break;
312      case DEVINFO_STR_IMAGE_CREATE_OPTDESC+0:   info->s = "MAME/MESS CHD Hard drive"; break;
313      case DEVINFO_STR_IMAGE_CREATE_OPTEXTS+0:   info->s = "chd,hd"; break;
307      case DEVINFO_STR_NAME:                  strcpy(info->s, "Harddisk"); break;
308      case DEVINFO_STR_FAMILY:               strcpy(info->s, "Harddisk"); break;
309      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__); break;
310      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:      strcpy(info->s, "chd,hd"); break;
311      case DEVINFO_STR_IMAGE_CREATE_OPTNAME+0:   strcpy(info->s, "chd"); break;
312      case DEVINFO_STR_IMAGE_CREATE_OPTDESC+0:   strcpy(info->s, "MAME/MESS CHD Hard drive"); break;
313      case DEVINFO_STR_IMAGE_CREATE_OPTEXTS+0:   strcpy(info->s, "chd,hd"); break;
314314   }
315315}
316316
r3957r3958
431431//      case DEVINFO_FCT_IMAGE_VERIFY:            info->f = (genf *) ide_hd_validity_check; break;
432432
433433      /* --- the following bits of info are returned as NULL-terminated strings --- */
434      case DEVINFO_STR_NAME:                  info->s = "IDE harddisk"; break;
435      case DEVINFO_STR_IMAGE_INSTANCE_NAME:      info->s = "ideharddrive"; break;
436      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   info->s = "idehd"; break;
434      case DEVINFO_STR_NAME:                  strcpy(info->s, "IDE harddisk"); break;
435      case DEVINFO_STR_IMAGE_INSTANCE_NAME:      strcpy(info->s, "ideharddrive"); break;
436      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   strcpy(info->s, "idehd"); break;
437437
438438      default:                           DEVICE_GET_INFO_CALL( mess_hd ); break;
439439   }
src/mess/devices/harddriv.h
r3957r3958
1717#define IDE_HARDDISK   DEVICE_GET_INFO_NAME(mess_ide)
1818
1919#define MDRV_HARDDISK_ADD(_tag) \
20   MDRV_DEVICE_ADD(_tag, HARDDISK) \
20   MDRV_DEVICE_ADD(_tag, HARDDISK, 0) \
2121
2222#define MDRV_IDE_HARDDISK_ADD(_tag) \
23   MDRV_DEVICE_ADD(_tag, IDE_HARDDISK) \
23   MDRV_DEVICE_ADD(_tag, IDE_HARDDISK, 0) \
2424
2525DEVICE_GET_INFO( mess_hd );
2626DEVICE_GET_INFO( mess_ide );
src/mess/devices/z80bin.c
r3957r3958
122122      else
123123      {
124124         if (autorun)
125            cpu_set_reg(cputag_get_cpu(image->machine, "main"), REG_PC, exec_addr);   
125            cpu_set_reg(cputag_get_cpu(image->machine, "main"), REG_GENPC, exec_addr);   
126126      }
127127   }
128128
r3957r3958
144144      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = sizeof(z80bin_config); break;
145145
146146      /* --- the following bits of info are returned as NULL-terminated strings --- */
147      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
148      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "bin"; break;
147      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
148      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "bin"); break;
149149
150150      /* --- the following bits of info are returned as pointers to functions --- */
151151      case DEVINFO_FCT_SNAPSHOT_QUICKLOAD_LOAD:      info->f = (genf *) quickload_load_z80bin; break;
src/mess/devices/cassette.c
r3957r3958
393393      case DEVINFO_FCT_DISPLAY:               info->f = (genf *) device_display_cassette; break;
394394
395395      /* --- the following bits of info are returned as NULL-terminated strings --- */
396      case DEVINFO_STR_NAME:                  info->s = "Cassette"; break;
397      case DEVINFO_STR_FAMILY:               info->s = "Cassette"; break;
398      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__; break;
396      case DEVINFO_STR_NAME:                  strcpy(info->s, "Cassette"); break;
397      case DEVINFO_STR_FAMILY:               strcpy(info->s, "Cassette"); break;
398      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__); break;
399399      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:
400400         if ( device && device->static_config )
401401         {
402402            const struct CassetteFormat * const *formats = ((cassette_config *)device->static_config)->formats;
403            char   *s;
404403            int      i;
405404
406405            /* set up a temporary string */
407            s = device_temp_str();
408            info->s = s;
409            s[0] = '\0';
406            info->s[0] = '\0';
410407
411408            for ( i = 0; formats[i]; i++ )
412               specify_extension( s, 256, formats[i]->extensions );
409               specify_extension( info->s, 256, formats[i]->extensions );
413410         }
414411         break;
415412   }
src/mess/devices/z80bin.h
r3957r3958
4747***************************************************************************/
4848
4949#define MDRV_Z80BIN_QUICKLOAD_ADD(_execute, _delay) \
50   MDRV_DEVICE_ADD(TAG_QUICKLOAD, Z80BIN) \
50   MDRV_DEVICE_ADD(TAG_QUICKLOAD, Z80BIN, 0) \
5151   MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_seconds, (seconds_t) (_delay)) \
5252   MDRV_DEVICE_CONFIG_DATA64(snapquick_config, delay_attoseconds, (attoseconds_t) (((_delay) - (int)(_delay)) * ATTOSECONDS_PER_SECOND)) \
5353   MDRV_DEVICE_CONFIG_DATAPTR(z80bin_config, execute, Z80BIN_EXECUTE_NAME(_execute))
src/mess/devices/cassette.h
r3957r3958
7272***************************************************************************/
7373
7474#define MDRV_CASSETTE_ADD(_tag, _config)    \
75   MDRV_DEVICE_ADD(_tag, CASSETTE)         \
75   MDRV_DEVICE_ADD(_tag, CASSETTE, 0)         \
7676   MDRV_DEVICE_CONFIG(_config)
7777
7878#define MDRV_CASSETTE_REMOVE(_tag)         \
src/mess/devices/microdrv.c
r3957r3958
3131      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(microdrv); break;
3232
3333      /* --- the following bits of info are returned as NULL-terminated strings --- */
34      case DEVINFO_STR_NAME:                     info->s = "Microdrive"; break;
35      case DEVINFO_STR_FAMILY:                  info->s = "Microdrive"; break;
36      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
37      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "mdv"; break;
34      case DEVINFO_STR_NAME:                     strcpy(info->s, "Microdrive"); break;
35      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Microdrive"); break;
36      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
37      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "mdv"); break;
3838   }
3939}
src/mess/devices/xmodem.c
r3957r3958
352352   case DEVINFO_FCT_IMAGE_LOAD:          info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( xmodem );     break;
353353   case DEVINFO_FCT_IMAGE_UNLOAD:          info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME( xmodem );   break;
354354   case DEVINFO_FCT_IMAGE_CREATE:          info->f = (genf *) DEVICE_IMAGE_CREATE_NAME( xmodem );   break;
355   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME: info->s = "x";                                        break;
355   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME: strcpy(info->s, "x");                                        break;
356356   case DEVINFO_STR_IMAGE_INSTANCE_NAME:
357   case DEVINFO_STR_NAME:                  info->s = "xmodem";                                        break;
358   case DEVINFO_STR_FAMILY:                    info->s = "serial protocol";                        break;
359   case DEVINFO_STR_SOURCE_FILE:          info->s = __FILE__;                                      break;
360   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:       info->s = "";                                            break;
357   case DEVINFO_STR_NAME:                  strcpy(info->s, "xmodem");                                        break;
358   case DEVINFO_STR_FAMILY:                    strcpy(info->s, "serial protocol");                        break;
359   case DEVINFO_STR_SOURCE_FILE:          strcpy(info->s, __FILE__);                                      break;
360   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:       strcpy(info->s, "");                                            break;
361361   }
362362}
363363
src/mess/devices/kermit.c
r3957r3958
688688   case DEVINFO_FCT_IMAGE_LOAD:          info->f = (genf *) DEVICE_IMAGE_LOAD_NAME( kermit );     break;
689689   case DEVINFO_FCT_IMAGE_UNLOAD:          info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME( kermit );   break;
690690   case DEVINFO_FCT_IMAGE_CREATE:          info->f = (genf *) DEVICE_IMAGE_CREATE_NAME( kermit );   break;
691   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME: info->s = "k";                                        break;
691   case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME: strcpy(info->s, "k");                                        break;
692692   case DEVINFO_STR_IMAGE_INSTANCE_NAME:
693   case DEVINFO_STR_NAME:                  info->s = "kermit";                                        break;
694   case DEVINFO_STR_FAMILY:                    info->s = "serial protocol";                        break;
695   case DEVINFO_STR_SOURCE_FILE:          info->s = __FILE__;                                      break;
696   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:       info->s = "";                                            break;
693   case DEVINFO_STR_NAME:                  strcpy(info->s, "kermit");                                        break;
694   case DEVINFO_STR_FAMILY:                    strcpy(info->s, "serial protocol");                        break;
695   case DEVINFO_STR_SOURCE_FILE:          strcpy(info->s, __FILE__);                                      break;
696   case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:       strcpy(info->s, "");                                            break;
697697   }
698698}
699699
src/mess/devices/xmodem.h
r3957r3958
2424
2525
2626#define MDRV_XMODEM_ADD(_tag, _intrf) \
27  MDRV_DEVICE_ADD(_tag, XMODEM)         \
27  MDRV_DEVICE_ADD(_tag, XMODEM, 0)         \
2828  MDRV_DEVICE_CONFIG(_intrf)
2929
3030#define MDRV_XMODEM_REMOVE(_tag)      \
src/mess/devices/kermit.h
r3957r3958
2424
2525
2626#define MDRV_KERMIT_ADD(_tag, _intrf) \
27  MDRV_DEVICE_ADD(_tag, KERMIT)         \
27  MDRV_DEVICE_ADD(_tag, KERMIT, 0)         \
2828  MDRV_DEVICE_CONFIG(_intrf)
2929
3030#define MDRV_KERMIT_REMOVE(_tag)      \
src/mess/devices/chd_cd.c
r3957r3958
159159      case DEVINFO_PTR_IMAGE_CREATE_OPTSPEC+0:   info->p = (void *) mess_cd_option_spec; break;
160160
161161      /* --- the following bits of info are returned as NULL-terminated strings --- */
162      case DEVINFO_STR_NAME:                  info->s = "Cdrom"; break;
163      case DEVINFO_STR_FAMILY:               info->s = "Cdrom"; break;
164      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__; break;
165      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:      info->s = "chd"; break;
166      case DEVINFO_STR_IMAGE_CREATE_OPTNAME+0:   info->s = "chdcd"; break;
167      case DEVINFO_STR_IMAGE_CREATE_OPTDESC+0:   info->s = "MAME/MESS CHD CD-ROM drive"; break;
168      case DEVINFO_STR_IMAGE_CREATE_OPTEXTS+0:   info->s = "chd"; break;
162      case DEVINFO_STR_NAME:                  strcpy(info->s, "Cdrom"); break;
163      case DEVINFO_STR_FAMILY:               strcpy(info->s, "Cdrom"); break;
164      case DEVINFO_STR_SOURCE_FILE:            strcpy(info->s, __FILE__); break;
165      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:      strcpy(info->s, "chd"); break;
166      case DEVINFO_STR_IMAGE_CREATE_OPTNAME+0:   strcpy(info->s, "chdcd"); break;
167      case DEVINFO_STR_IMAGE_CREATE_OPTDESC+0:   strcpy(info->s, "MAME/MESS CHD CD-ROM drive"); break;
168      case DEVINFO_STR_IMAGE_CREATE_OPTEXTS+0:   strcpy(info->s, "chd"); break;
169169   }
170170}
171171
src/mess/devices/chd_cd.h
r3957r3958
1515
1616
1717#define MDRV_CDROM_ADD(_tag) \
18   MDRV_DEVICE_ADD(_tag, CDROM) \
18   MDRV_DEVICE_ADD(_tag, CDROM, 0) \
1919
2020
2121DEVICE_GET_INFO(cdrom);
src/mess/devices/printer.c
r3957r3958
7474      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(printer); break;
7575
7676      /* --- the following bits of info are returned as NULL-terminated strings --- */
77      case DEVINFO_STR_NAME:                     info->s = "Printer"; break;
78      case DEVINFO_STR_FAMILY:                  info->s = "Printer"; break;
79      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
80      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "prn"; break;
77      case DEVINFO_STR_NAME:                     strcpy(info->s, "Printer"); break;
78      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Printer"); break;
79      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
80      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "prn"); break;
8181   }
8282}
src/mess/devices/coco_vhd.c
r3957r3958
281281      case DEVINFO_FCT_IMAGE_LOAD:               info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(coco_vhd); break;
282282
283283      /* --- the following bits of info are returned as NULL-terminated strings --- */
284      case DEVINFO_STR_NAME:                     info->s = "Virtual Hard Disk"; break;
285      case DEVINFO_STR_FAMILY:                  info->s = "Virtual Hard Disk"; break;
286      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
287      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "vhd"; break;
284      case DEVINFO_STR_NAME:                     strcpy(info->s, "Virtual Hard Disk"); break;
285      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Virtual Hard Disk"); break;
286      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
287      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "vhd"); break;
288288   }
289289}
src/mess/devices/bitbngr.c
r3957r3958
246246      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(bitbanger); break;
247247
248248      /* --- the following bits of info are returned as NULL-terminated strings --- */
249      case DEVINFO_STR_NAME:                     info->s = "Bitbanger"; break;
250      case DEVINFO_STR_FAMILY:                  info->s = "Bitbanger"; break;
251      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
252      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = "prn"; break;
249      case DEVINFO_STR_NAME:                     strcpy(info->s, "Bitbanger"); break;
250      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Bitbanger"); break;
251      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
252      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, "prn"); break;
253253   }
254254}
src/mess/devices/printer.h
r3957r3958
2020
2121
2222#define MDRV_PRINTER_ADD(_tag) \
23   MDRV_DEVICE_ADD(_tag, PRINTER) \
23   MDRV_DEVICE_ADD(_tag, PRINTER, 0) \
2424
2525
2626/***************************************************************************
src/mess/devices/thomflop.c
r3957r3958
337337   wd17xx_reset(fdc);
338338   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
339339   {
340      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
340      const device_config * img = image_from_devtype_and_index( machine, IO_FLOPPY, i );
341341      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
342342      floppy_drive_set_rpm( img, 300. );
343343      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
r3957r3958
439439   thom_floppy_set_density( DEN_FM_LO );
440440   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
441441   {
442      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
442      const device_config * img = image_from_devtype_and_index( machine, IO_FLOPPY, i );
443443      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
444444      floppy_drive_set_rpm( img, 300. );
445445      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
r3957r3958
545545
546546
547547
548static const device_config * to7_qdd_image ( void )
548static const device_config * to7_qdd_image ( running_machine *machine )
549549{
550   return image_from_devtype_and_index( IO_FLOPPY, 0 );
550   return image_from_devtype_and_index( machine, IO_FLOPPY, 0 );
551551}
552552
553553
554554
555555/* update MC6852 status register */
556static void to7_qdd_stat_update( void )
556static void to7_qdd_stat_update( running_machine *machine )
557557{
558   int flags = floppy_drive_get_flag_state( to7_qdd_image(), -1 );
558   int flags = floppy_drive_get_flag_state( to7_qdd_image(machine), -1 );
559559
560560   /* byte-ready */
561561   to7qdd->status |= QDD_S_RDA | QDD_S_TDRA;
r3957r3958
594594   /* rebuild disk if needed */
595595   if ( !to7qdd->data_size )
596596   {
597      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data );
597      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(machine), to7qdd->data );
598598      assert( to7qdd->data_idx < sizeof( to7qdd->data ) );
599599   }
600600
r3957r3958
627627   /* rebuild disk if needed */
628628   if ( !to7qdd->data_size )
629629   {
630      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data );
630      to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(machine), to7qdd->data );
631631      assert( to7qdd->data_idx < sizeof( to7qdd->data ) );
632632   }
633633
r3957r3958
661661         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
662662               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
663663
664         floppy_drive_format_sector( to7_qdd_image(),
664         floppy_drive_format_sector( to7_qdd_image(machine),
665665                      0, sector, 0, 0, sector, 128, filler );
666666         to7qdd->start_idx = to7qdd->data_idx;
667667      }
r3957r3958
690690            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
691691                  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
692692
693            floppy_drive_write_sector_data( to7_qdd_image(), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
693            floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
694694         }
695695
696696         to7qdd->start_idx = to7qdd->data_idx;
r3957r3958
708708   {
709709
710710   case 0: /* MC6852 status */
711      to7_qdd_stat_update();
711      to7_qdd_stat_update(space->machine);
712712      VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n",
713713             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), to7qdd->status,
714714             to7qdd->status & QDD_S_IRQ  ? 1 : 0,
r3957r3958
722722
723723   case 1: /* MC6852 data input => read byte from disk */
724724      to7qdd->status &= ~(QDD_S_RDA | QDD_S_PE | QDD_S_OVR);
725      to7_qdd_stat_update();
725      to7_qdd_stat_update(space->machine);
726726      return to7_qdd_read_byte( space->machine );
727727
728728   case 8: /* floppy status */
729729   {
730730      UINT8 data = 0;
731      const device_config* img = to7_qdd_image();
731      const device_config* img = to7_qdd_image(space->machine);
732732      if ( ! image_exists( img ) )
733733         data |= 0x40; /* disk present */
734734      if ( to7qdd->index_pulse )
r3957r3958
758758         to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF);
759759
760760      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
761      to7_qdd_stat_update();
761      to7_qdd_stat_update(space->machine);
762762      VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n",
763763             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
764764             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
r3957r3958
782782         int bits, parity;
783783         bits   = bit[ (data >> 3) & 7 ];
784784         parity = par[ (data >> 3) & 7 ];
785         to7_qdd_stat_update();
785         to7_qdd_stat_update(space->machine);
786786         VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n",
787787                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
788788                bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2,
r3957r3958
800800            to7qdd->status &= ~QDD_S_TUF;
801801         if ( data & QDD_C3_CLRCTS )
802802            to7qdd->status &= ~QDD_S_NCTS;
803         to7_qdd_stat_update();
803         to7_qdd_stat_update(space->machine);
804804         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
805805                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
806806                data & QDD_C3_CLRTUF ? "clr-tuf " : "",
r3957r3958
846846
847847   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
848848   {
849      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
849      const device_config * img = image_from_devtype_and_index( machine, IO_FLOPPY, i );
850850      floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb );
851851      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
852852      floppy_drive_set_motor_state( img, 1 );
r3957r3958
859859   to7qdd->ctrl2 &= 0x7c; /* clear EIE, PC2-PC1 */
860860   to7qdd->ctrl3 &= 0xfe; /* internal sync */
861861   to7qdd->drive = 0;
862   to7_qdd_stat_update();
862   to7_qdd_stat_update(machine);
863863}
864864
865865
r3957r3958
943943
944944
945945
946static const device_config * thmfc_floppy_image ( void )
946static const device_config * thmfc_floppy_image ( running_machine *machine )
947947{
948   return image_from_devtype_and_index( IO_FLOPPY, thmfc1->drive );
948   return image_from_devtype_and_index( machine, IO_FLOPPY, thmfc1->drive );
949949}
950950
951951
r3957r3958
959959
960960static void thmfc_floppy_index_pulse_cb ( const device_config *controller,const device_config *image, int state )
961961{
962   if ( image != thmfc_floppy_image() )
962   if ( image != thmfc_floppy_image(image->machine) )
963963      return;
964964
965965   if ( thmfc_floppy_is_qdd() )
r3957r3958
15271527
15281528   for ( i = 0; i < device_count( machine, IO_FLOPPY ); i++ )
15291529   {
1530      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
1530      const device_config * img = image_from_devtype_and_index( machine, IO_FLOPPY, i );
15311531      floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb );
15321532      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
15331533      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
src/mess/devices/coco_vhd.h
r3957r3958
1919#define COCO_VHD   DEVICE_GET_INFO_NAME(coco_vhd)
2020
2121#define MDRV_COCO_VHD_ADD(_tag) \
22   MDRV_DEVICE_ADD(_tag, COCO_VHD) \
22   MDRV_DEVICE_ADD(_tag, COCO_VHD, 0) \
2323   
2424#endif /* COCOVHD_H */
src/mess/devices/snapquik.c
r3957r3958
153153      case DEVINFO_FCT_SNAPSHOT_QUICKLOAD_LOAD:      info->f = (genf *) get_config(device)->load; break;
154154
155155      /* --- the following bits of info are returned as NULL-terminated strings --- */
156      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__; break;
157      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         info->s = get_config(device)->file_extensions; break;
156      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__); break;
157      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:         strcpy(info->s, get_config(device)->file_extensions); break;
158158   }
159159}
160160
r3957r3958
173173      case DEVINFO_INT_IMAGE_TYPE:               info->i = IO_SNAPSHOT; break;
174174
175175      /* --- the following bits of info are returned as NULL-terminated strings --- */
176      case DEVINFO_STR_NAME:                     info->s = "Snapshot"; break;
177      case DEVINFO_STR_FAMILY:                  info->s = "Snapshot"; break;
176      case DEVINFO_STR_NAME:                     strcpy(info->s, "Snapshot"); break;
177      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Snapshot"); break;
178178
179179      default: DEVICE_GET_INFO_CALL(snapquick); break;
180180   }
r3957r3958
195195      case DEVINFO_INT_IMAGE_TYPE:               info->i = IO_QUICKLOAD; break;
196196
197197      /* --- the following bits of info are returned as NULL-terminated strings --- */
198      case DEVINFO_STR_NAME:                     info->s = "Quickload"; break;
199      case DEVINFO_STR_FAMILY:                  info->s = "Quickload"; break;
198      case DEVINFO_STR_NAME:                     strcpy(info->s, "Quickload"); break;
199      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Quickload"); break;
200200
201201      default: DEVICE_GET_INFO_CALL(snapquick); break;
202202   }
src/mess/devices/bitbngr.h
r3957r3958
2020#define BITBANGER   DEVICE_GET_INFO_NAME(bitbanger)
2121
2222#define MDRV_BITBANGER_ADD(_tag, _intrf) \
23   MDRV_DEVICE_ADD(_tag, BITBANGER) \
23   MDRV_DEVICE_ADD(_tag, BITBANGER, 0) \
2424   MDRV_DEVICE_CONFIG(_intrf)
2525
2626
src/mess/osd/windows/dialog.c
r3957r3958
151151//   LOCAL VARIABLES
152152//============================================================
153153
154static running_machine *Machine;   // HACK - please fix
155
154156static double pixels_to_xdlgunits;
155157static double pixels_to_ydlgunits;
156158
r3957r3958
16291631
16301632static void before_display_dialog(running_machine *machine)
16311633{
1634   Machine = machine;
1635
16321636#ifdef UNDER_CE
16331637   // on WinCE, suspend GAPI
16341638   gx_suspend();
r3957r3958
16511655#endif
16521656
16531657   winwindow_ui_pause_from_window_thread(machine, FALSE);
1658
1659   Machine = NULL;
16541660}
16551661
16561662
src/mess/osd/windows/menu.c
r3957r3958
21122112   HMENU menu_bar = NULL;
21132113   HMODULE module;
21142114
2115   if (ui_mess_use_new_ui(machine))
2115   if (ui_mess_use_new_ui())
21162116   {
21172117      module = win_resource_module();
21182118      menu_bar = LoadMenu(module, MAKEINTRESOURCE(IDR_RUNTIME_MENU));
r3957r3958
21482148         break;
21492149
21502150      case WM_PASTE:
2151         ui_mess_paste(Machine);
2151         // FIXME 0.128u7
2152         ui_mess_paste(NULL /*Machine*/);
21522153         break;
21532154
21542155      case WM_COMMAND:
src/mess/drivers/vip.c
r3957r3958
399399static CDP1861_INTERFACE( vip_cdp1861_intf )
400400{
401401   SCREEN_TAG,
402   XTAL_3_52128MHz,
403402   vip_int_w,
404403   vip_dmao_w,
405404   vip_efx_w
r3957r3958
408407static CDP1862_INTERFACE( vip_cdp1862_intf )
409408{
410409   SCREEN_TAG,
411   CPD1862_CLOCK,
412410   RES_K(1.21), // ???
413411   RES_K(2.05), // ???
414412   RES_K(2.26), // ???
r3957r3958
622620
623621   /* reset auxiliary chips */
624622
625   state->cdp1861->reset(state->cdp1861);
626   state->cdp1862->reset(state->cdp1862);
627   state->cdp1863->reset(state->cdp1863);
623   device_reset(state->cdp1861);
624   device_reset(state->cdp1862);
625   device_reset(state->cdp1863);
628626
629627   state->colorram_mwr = CLEAR_LINE;
630628
r3957r3958
692690   MDRV_PALETTE_INIT(black_and_white)
693691   MDRV_VIDEO_UPDATE(vip)
694692
695   MDRV_DEVICE_ADD(CDP1861_TAG, CDP1861)
696   MDRV_DEVICE_CONFIG(vip_cdp1861_intf)
693   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz, vip_cdp1861_intf)
697694
698   MDRV_DEVICE_ADD(CDP1862_TAG, CDP1862)
695   MDRV_DEVICE_ADD(CDP1862_TAG, CDP1862, CPD1862_CLOCK)
699696   MDRV_DEVICE_CONFIG(vip_cdp1862_intf)
700697
701698   /* sound hardware */
702   MDRV_DEVICE_ADD(CDP1863_TAG, CDP1863)
699   MDRV_DEVICE_ADD(CDP1863_TAG, CDP1863, 0)
703700   MDRV_DEVICE_CONFIG(vip_cdp1863_intf)
704701
705702   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/wswan.c
r3957r3958
3131***************************************************************************/
3232
3333#include "driver.h"
34//#include "cpu/v30mz/nec.h"
34#include "cpu/v30mz/nec.h"
3535#include "includes/wswan.h"
3636#include "devices/cartslot.h"
3737#include "sound/custom.h"
r3957r3958
136136   MDRV_SCREEN_ADD("main", LCD)
137137   MDRV_SCREEN_REFRESH_RATE(75)
138138   MDRV_SCREEN_VBLANK_TIME(0)
139   MDRV_INTERLEAVE(1)
139   MDRV_QUANTUM_TIME(HZ(60))
140140
141141   MDRV_NVRAM_HANDLER( wswan )
142142
src/mess/drivers/cpschngr.c
r3957r3958
1515***************************************************************************/
1616
1717#include "driver.h"
18#include "cpu/m68000/m68000.h"
19#include "cpu/z80/z80.h"
1820
1921#ifdef GAME
2022#undef GAME
src/mess/drivers/jaguar.c
r3957r3958
132132   jaguardsp_ctrl_w(machine->cpu[2], D_CTRL, 0, 0);
133133
134134   /* init the sound system */
135   cojag_sound_reset();
135   cojag_sound_reset(machine);
136136
137137   joystick_data = 0xffffffff;
138138}
r3957r3958
525525   offs_t quickload_begin = 0x4000;
526526   quickload_size = MIN(quickload_size, 0x200000 - quickload_begin);
527527   image_fread(image, &memory_region(image->machine, "main")[quickload_begin], quickload_size);
528   cpu_set_reg(image->machine->cpu[0], REG_PC, quickload_begin);
528   cpu_set_reg(image->machine->cpu[0], REG_GENPC, quickload_begin);
529529   return INIT_PASS;
530530}
531531
src/mess/drivers/apple3.c
r3957r3958
3535   MDRV_CPU_ADD("main", M6502, 2000000)        /* 2 MHz */
3636   MDRV_CPU_PROGRAM_MAP(apple3_map, 0)
3737   MDRV_CPU_PERIODIC_INT(apple3_interrupt, 192)
38   MDRV_INTERLEAVE(1)
38   MDRV_QUANTUM_TIME(HZ(60))
3939
4040   MDRV_MACHINE_RESET( apple3 )
4141
src/mess/drivers/3do.c
r3957r3958
9494#include "driver.h"
9595#include "includes/3do.h"
9696#include "devices/chd_cd.h"
97#include "cpu/arm7/arm7.h"
9798
9899
99100/* The 3DO has an ARM6 core which is a bit different from the current
src/mess/drivers/c65.c
r3957r3958
240240   MDRV_QUICKLOAD_ADD(cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
241241
242242   /* cia */
243   MDRV_DEVICE_ADD("cia_0", CIA6526R1)
244   MDRV_DEVICE_CONFIG(c64_ntsc_cia0)
245   MDRV_DEVICE_ADD("cia_1", CIA6526R1)
246   MDRV_DEVICE_CONFIG(c64_ntsc_cia1)
243   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 0, c64_ntsc_cia0)
244   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 0, c64_ntsc_cia1)
247245MACHINE_DRIVER_END
248246
249247static MACHINE_DRIVER_START( c65pal )
src/mess/drivers/dai.c
r3957r3958
186186   MDRV_CPU_ADD("main", 8080, 2000000)
187187   MDRV_CPU_PROGRAM_MAP(dai_mem, 0)
188188   MDRV_CPU_IO_MAP(dai_io, 0)
189   MDRV_INTERLEAVE(1)
189   MDRV_QUANTUM_TIME(HZ(60))
190190
191191   MDRV_MACHINE_START( dai )
192192
src/mess/drivers/nc.c
r3957r3958
9494 ******************************************************************************/
9595
9696#include "driver.h"
97#include "cpu/z80/z80.h"
9798#include "includes/nc.h"
9899#include "includes/serial.h"   /* for serial data transfers */
99100#include "machine/msm8251.h"   /* for NC100 uart */
r3957r3958
13711372    nc_common_init_machine(machine);
13721373
13731374    /* double sided, 80 track drive */
1374   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
1375   //floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(IO_FLOPPY, 0), nc200_floppy_drive_index_callback);
1375   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
1376   //floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(machine, IO_FLOPPY, 0), nc200_floppy_drive_index_callback);
13761377
13771378   mc146818_init(machine, MC146818_STANDARD);
13781379
r3957r3958
16791680   MDRV_CPU_ADD("main", Z80, /*6000000*/ 4606000)        /* Russell Marks says this is more accurate */
16801681   MDRV_CPU_PROGRAM_MAP(nc_map, 0)
16811682   MDRV_CPU_IO_MAP(nc100_io, 0)
1682   MDRV_INTERLEAVE(1)
1683   MDRV_QUANTUM_TIME(HZ(60))
16831684
16841685   MDRV_MACHINE_START( nc100 )
16851686   MDRV_MACHINE_RESET( nc100 )
src/mess/drivers/mac.c
r3957r3958
149149   MDRV_SCREEN_ADD("main", RASTER)
150150   MDRV_SCREEN_REFRESH_RATE(60.15)
151151   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1260))
152   MDRV_INTERLEAVE(1)
152   MDRV_QUANTUM_TIME(HZ(60))
153153
154154   MDRV_MACHINE_RESET( mac )
155155
src/mess/drivers/adam.c
r3957r3958
598598
599599static MACHINE_RESET( adam )
600600{
601   if (image_exists(image_from_devtype_and_index(IO_CARTSLOT, 0)))
601   if (image_exists(image_from_devtype_and_index(machine, IO_CARTSLOT, 0)))
602602   {
603603      /* ColecoVision Mode Reset (Cartridge Mounted) */
604604      adam_lower_memory = 3; /* OS7 + 24k RAM */
src/mess/drivers/cbmb.c
r3957r3958
326326
327327static const mc6845_interface cbm600_crtc = {
328328   "main",
329   XTAL_18MHz / 8 /*?*/,   /*  I do not know if this is correct, please verify */
330329   8 /*?*/,
331330   NULL,
332331   cbm600_update_row,
r3957r3958
337336};
338337
339338static const mc6845_interface cbm700_crtc = {
340   "main",
341   XTAL_18MHz / 8 /*?*/,   /* I do not know if this is correct, please verify */
339   "main",   
342340   9 /*?*/,
343341   NULL,
344342   cbm700_update_row,
r3957r3958
374372   MDRV_PALETTE_LENGTH(sizeof (cbm700_palette) / sizeof (cbm700_palette[0]) / 3)
375373   MDRV_PALETTE_INIT( cbm700 )
376374
377   MDRV_DEVICE_ADD("crtc", MC6845)
378   MDRV_DEVICE_CONFIG( cbm600_crtc )
375   MDRV_MC6845_ADD("crtc", MC6845, XTAL_18MHz / 8 /*?*/ /*  I do not know if this is correct, please verify */, cbm600_crtc)
379376
380377   MDRV_VIDEO_START( cbmb_crtc )
381378   MDRV_VIDEO_UPDATE( cbmb_crtc )
r3957r3958
389386   MDRV_QUICKLOAD_ADD(cbmb, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
390387
391388   /* cia */
392   MDRV_DEVICE_ADD("cia", CIA6526R1)
393   MDRV_DEVICE_CONFIG(cbmb_cia)
389   MDRV_CIA6526_ADD("cia", CIA6526R1, 0, cbmb_cia)
394390MACHINE_DRIVER_END
395391
396392
r3957r3958
408404   MDRV_SCREEN_VISIBLE_AREA(0, 720 - 1, 0, 350 - 1)
409405   MDRV_GFXDECODE( cbm700 )
410406
411   MDRV_DEVICE_MODIFY("crtc", MC6845)
412   MDRV_DEVICE_CONFIG( cbm700_crtc )
407   MDRV_MC6845_REMOVE("crtc", MC6845)
408   MDRV_MC6845_ADD("crtc", MC6845, XTAL_18MHz / 8 /*? I do not know if this is correct, please verify */, cbm700_crtc)
413409
414410   MDRV_VIDEO_START( cbm700 )
415411MACHINE_DRIVER_END
r3957r3958
452448   MDRV_QUICKLOAD_ADD(p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
453449
454450   /* cia */
455   MDRV_DEVICE_ADD("cia", CIA6526R1)
456   MDRV_DEVICE_CONFIG(cbmb_cia)
451   MDRV_CIA6526_ADD("cia", CIA6526R1, 0, cbmb_cia)
457452MACHINE_DRIVER_END
458453
459454
src/mess/drivers/sord.c
r3957r3958
296296
297297static const z80ctc_interface   sord_m5_ctc_intf =
298298{
299   "main",
300   3800000,
301299   0,
302300   sord_m5_ctc_interrupt,
303301   0,
r3957r3958
625623   MDRV_CPU_IO_MAP(sord_m5_io, 0)
626624   MDRV_CPU_VBLANK_INT("main", sord_interrupt)
627625   MDRV_CPU_CONFIG( sord_m5_daisy_chain )
628   MDRV_INTERLEAVE(1)
626   MDRV_QUANTUM_TIME(HZ(60))
629627
630628   MDRV_MACHINE_START( sord_m5 )
631629   MDRV_MACHINE_RESET( sord_m5 )
632630
633631   MDRV_PPI8255_ADD( "ppi8255", sord_ppi8255_interface )
634632
635   MDRV_Z80CTC_ADD( "z80ctc", sord_m5_ctc_intf )
633   MDRV_Z80CTC_ADD( "z80ctc", 3800000, sord_m5_ctc_intf )
636634
637635   /* video hardware */
638636   MDRV_IMPORT_FROM(tms9928a)
r3957r3958
663661   MDRV_CPU_PROGRAM_MAP(sord_fd5_mem, 0)
664662   MDRV_CPU_IO_MAP(sord_fd5_io, 0)
665663
666   MDRV_INTERLEAVE(20)
664   MDRV_QUANTUM_TIME(HZ(1200))
667665   MDRV_MACHINE_RESET( sord_m5_fd5 )
668666   
669667   MDRV_NEC765A_ADD("nec765", sord_fd5_nec765_interface)
src/mess/drivers/mbee.c
r3957r3958
554554   if (autorun)
555555   {
556556      memory_write_word_16le(space, 0xa2, execute_address);      /* fix warm-start vector to get around some copy-protections */
557      cpu_set_reg(cpu, REG_PC, execute_address);
557      cpu_set_reg(cpu, REG_GENPC, execute_address);
558558   }
559559   else
560560   {
r3957r3958
587587      if (sw)
588588      {
589589         memory_write_word_16le(space, 0xa2,0x801e);   /* fix warm-start vector to get around some copy-protections */
590         cpu_set_reg(cpu, REG_PC, 0x801e);
590         cpu_set_reg(cpu, REG_GENPC, 0x801e);
591591      }
592592      else
593593         memory_write_word_16le(space, 0xa2,0x8517);
r3957r3958
607607            return INIT_FAIL;
608608      }
609609
610      if (sw) cpu_set_reg(cpu, REG_PC, 0x100);
610      if (sw) cpu_set_reg(cpu, REG_GENPC, 0x100);
611611   }
612612
613613   return INIT_PASS;
src/mess/drivers/pokemini.c
r3957r3958
6666   MDRV_CPU_ADD( "main", MINX, 4000000 )
6767   MDRV_CPU_PROGRAM_MAP( pokemini_mem_map, 0 )
6868
69   MDRV_INTERLEAVE(1)
69   MDRV_QUANTUM_TIME(HZ(60))
7070
7171   MDRV_MACHINE_RESET( pokemini )
7272
src/mess/drivers/pentagon.c
r3957r3958
1616
1717static DIRECT_UPDATE_HANDLER( pentagon_direct )
1818{   
19   UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_PREVIOUSPC);
19   UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_GENPCBASE);
2020   if (betadisk_is_active()) {
2121      if (pc >= 0x4000) {
2222         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
src/mess/drivers/coco.c
r3957r3958
736736   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
737737
738738   /* acia */
739   MDRV_DEVICE_ADD("acia", ACIA6551)
739   MDRV_ACIA6551_ADD("acia")
740740   
741741   MDRV_WD179X_ADD("wd179x", dragon_wd17xx_interface )
742742   
r3957r3958
775775   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
776776
777777   /* acia */
778   MDRV_DEVICE_ADD("acia", ACIA6551)
778   MDRV_ACIA6551_ADD("acia")
779779   
780780   MDRV_WD179X_ADD("wd179x", dgnalpha_wd17xx_interface )
781781   
r3957r3958
811811   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
812812
813813   /* acia */
814   MDRV_DEVICE_ADD("acia", ACIA6551)
814   MDRV_ACIA6551_ADD("acia")
815815   
816816   MDRV_WD1773_ADD("wd1773", coco_wd17xx_interface )   
817817   
r3957r3958
845845   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
846846
847847   /* devices */
848   MDRV_DEVICE_ADD("disto", MSM6242)
848   MDRV_MSM6242_ADD("disto")
849849
850850   /* cassette */
851851   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
r3957r3958
882882   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
883883
884884   /* devices */
885   MDRV_DEVICE_ADD("disto", MSM6242)
885   MDRV_MSM6242_ADD("disto")
886886
887887   /* cassette */
888888   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
r3957r3958
919919   MDRV_QUICKLOAD_ADD(coco, "bin", 0.5)
920920
921921   /* devices */
922   MDRV_DEVICE_ADD("disto", MSM6242)
922   MDRV_MSM6242_ADD("disto")
923923
924924   /* cassette */
925925   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
r3957r3958
966966
967967   /* devices */
968968   MDRV_COCO_VHD_ADD("vhd")
969   MDRV_DEVICE_ADD("disto", MSM6242)
969   MDRV_MSM6242_ADD("disto")
970970
971971   /* cassette */
972972   MDRV_CASSETTE_ADD( "cassette", coco_cassette_config )
src/mess/drivers/pocketc.c
r3957r3958
725725   MDRV_CPU_PROGRAM_MAP(pc1401_mem, 0)
726726   MDRV_CPU_CONFIG(config)
727727
728   MDRV_INTERLEAVE(1)
728   MDRV_QUANTUM_TIME(HZ(60))
729729
730730   MDRV_NVRAM_HANDLER( pc1401 )
731731
src/mess/drivers/mk1.c
r3957r3958
166166   MDRV_CPU_ADD( "main", F8, MAIN_CLOCK )        /* MK3850 */
167167   MDRV_CPU_PROGRAM_MAP( mk1_mem, 0 )
168168   MDRV_CPU_IO_MAP( mk1_io, 0 )
169   MDRV_INTERLEAVE( 1 )
169   MDRV_QUANTUM_TIME(HZ(60))
170170
171171   MDRV_MACHINE_START( mk1 )
172172   MDRV_MACHINE_RESET( mk1 )
src/mess/drivers/gb.c
r3957r3958
563563   MDRV_SCREEN_ADD("main", LCD)
564564   MDRV_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND)
565565   MDRV_SCREEN_VBLANK_TIME(0)
566   MDRV_INTERLEAVE(1)
566   MDRV_QUANTUM_TIME(HZ(60))
567567
568568   MDRV_MACHINE_START( gb )
569569   MDRV_MACHINE_RESET( gb )
r3957r3958
681681   MDRV_SCREEN_ADD("main", LCD)
682682   MDRV_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND)
683683   MDRV_SCREEN_VBLANK_TIME(0)
684   MDRV_INTERLEAVE(1)
684   MDRV_QUANTUM_TIME(HZ(60))
685685
686686   MDRV_MACHINE_RESET( megaduck )
687687
src/mess/drivers/z88.c
r3957r3958
728728   MDRV_CPU_ADD("main", Z80, 3276800)
729729   MDRV_CPU_PROGRAM_MAP(z88_mem, 0)
730730   MDRV_CPU_IO_MAP(z88_io, 0)
731   MDRV_INTERLEAVE(1)
731   MDRV_QUANTUM_TIME(HZ(60))
732732
733733   MDRV_MACHINE_RESET( z88 )
734734
src/mess/drivers/concept.c
r3957r3958
6868   MDRV_CPU_PROGRAM_MAP(concept_memmap, 0)
6969   MDRV_CPU_VBLANK_INT("main", concept_interrupt)
7070
71   MDRV_INTERLEAVE(1)
71   MDRV_QUANTUM_TIME(HZ(60))
7272   MDRV_MACHINE_START(concept)
7373
7474   /* video hardware */
src/mess/drivers/pcw16.c
r3957r3958
14001400   MDRV_CPU_ADD("main", Z80, 16000000)
14011401   MDRV_CPU_PROGRAM_MAP(pcw16_map, 0)
14021402   MDRV_CPU_IO_MAP(pcw16_io, 0)
1403   MDRV_INTERLEAVE(1)
1403   MDRV_QUANTUM_TIME(HZ(60))
14041404
14051405   MDRV_MACHINE_RESET( pcw16 )
14061406   MDRV_NVRAM_HANDLER( pcw16 )
src/mess/drivers/kim1.c
r3957r3958
107107static INPUT_CHANGED( kim1_reset )
108108{
109109   if (newval == 0)
110      cpu_reset(field->port->machine->cpu[0]);
110      device_reset(field->port->machine->cpu[0]);
111111}
112112
113113
r3957r3958
325325   /* basic machine hardware */
326326   MDRV_CPU_ADD("main", M6502, 1000000)        /* 1 MHz */
327327   MDRV_CPU_PROGRAM_MAP(kim1_map, 0)
328   MDRV_INTERLEAVE(1)
328   MDRV_QUANTUM_TIME(HZ(60))
329329
330330   MDRV_MACHINE_START( kim1 )
331331   MDRV_MACHINE_RESET( kim1 )
src/mess/drivers/msx.c
r3957r3958
10341034   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
10351035   MDRV_CPU_IO_MAP(readport,writeport)
10361036   MDRV_CPU_VBLANK_INT("main", msx_interrupt)
1037   MDRV_INTERLEAVE(1)
1037   MDRV_QUANTUM_TIME(HZ(60))
10381038
10391039   MDRV_MACHINE_START( msx )
10401040   MDRV_MACHINE_RESET( msx )
r3957r3958
10911091   MDRV_CPU_PROGRAM_MAP(readmem, writemem)
10921092   MDRV_CPU_IO_MAP(readport2,writeport2)
10931093   MDRV_CPU_VBLANK_INT_HACK(msx2_interrupt, 262)
1094   MDRV_INTERLEAVE(1)
1094   MDRV_QUANTUM_TIME(HZ(60))
10951095
10961096   MDRV_MACHINE_START( msx2 )
10971097   MDRV_MACHINE_RESET( msx2 )
src/mess/drivers/gamecom.c
r3957r3958
9797   MDRV_SCREEN_ADD("main", LCD)
9898   MDRV_SCREEN_REFRESH_RATE( 59.732155 )
9999   MDRV_SCREEN_VBLANK_TIME(0)
100   MDRV_INTERLEAVE(1)
100   MDRV_QUANTUM_TIME(HZ(60))
101101
102102   MDRV_MACHINE_RESET( gamecom )
103103
src/mess/drivers/radio86.c
r3957r3958
306306   MDRV_SOUND_ADD("cassette", WAVE, 0)
307307   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
308308
309   MDRV_DEVICE_ADD("dma8257", DMA8257)
310   MDRV_DEVICE_CONFIG(radio86_dma)
309   MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, radio86_dma)
311310
312311   MDRV_CASSETTE_ADD( "cassette", radio86_cassette_config )
313312MACHINE_DRIVER_END
r3957r3958
322321         direct->decrypted = radio16_io_mirror;
323322         direct->min = 0x4000;
324323         direct->max = 0x7fff;
325         radio16_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8080_STATUS);
324         radio16_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8085_STATUS);
326325   }
327326   return address;
328327}
src/mess/drivers/arcadia.c
r3957r3958
447447   MDRV_CPU_PROGRAM_MAP(arcadia_mem, 0)
448448   MDRV_CPU_IO_MAP(arcadia_io, 0)
449449   MDRV_CPU_PERIODIC_INT(arcadia_video_line, 262*60)
450   MDRV_INTERLEAVE(1)
450   MDRV_QUANTUM_TIME(HZ(60))
451451
452452    /* video hardware */
453453   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/thomson.c
r3957r3958
757757     MDRV_ACIA6551_ADD("acia")
758758
759759/* modem */
760     MDRV_DEVICE_ADD( "acia6850", ACIA6850 )
761     MDRV_DEVICE_CONFIG( to7_modem )
760     MDRV_ACIA6850_ADD( "acia6850", to7_modem )
762761     
763762     MDRV_WD2793_ADD("wd2793", default_wd17xx_interface )
764763MACHINE_DRIVER_END
src/mess/drivers/pasogo.c
r3957r3958
1010******************************************************************************/
1111
1212#include "driver.h"
13//#include "vidhrdw/generic.h"
13#include "cpu/i86/i86.h"
1414#include "devices/cartslot.h"
1515#include "machine/pic8259.h"
1616#include "machine/pit8253.h"
src/mess/drivers/lisa.c
r3957r3958
9797   MDRV_CPU_ADD("fdc", M6502, 2000000)        /* 16.000 MHz / 8 in when DIS asserted, 16.000 MHz / 9 otherwise (?) */
9898   MDRV_CPU_PROGRAM_MAP(lisa_fdc_map, 0)
9999
100   MDRV_INTERLEAVE(1)
100   MDRV_QUANTUM_TIME(HZ(60))
101101   MDRV_MACHINE_RESET( lisa )
102102
103103   MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
src/mess/drivers/lynx.c
r3957r3958
7676   MDRV_CPU_ADD("main", M65SC02, 4000000)        /* vti core, integrated in vlsi, stz, but not bbr bbs */
7777   MDRV_CPU_PROGRAM_MAP(lynx_mem, 0)
7878   MDRV_CPU_VBLANK_INT("main", lynx_frame_int)
79   MDRV_INTERLEAVE(1)
79   MDRV_QUANTUM_TIME(HZ(60))
8080
8181   MDRV_MACHINE_START( lynx )
8282
src/mess/drivers/cgenie.c
r3957r3958
405405   MDRV_CPU_IO_MAP(cgenie_io, 0)
406406   MDRV_CPU_VBLANK_INT("main", cgenie_frame_interrupt)
407407   MDRV_CPU_PERIODIC_INT(cgenie_timer_interrupt, 40)
408   MDRV_INTERLEAVE(4)
408   MDRV_QUANTUM_TIME(HZ(240))
409409
410410   MDRV_MACHINE_START( cgenie )
411411   MDRV_MACHINE_RESET( cgenie )
src/mess/drivers/scorpion.c
r3957r3958
221221
222222static DIRECT_UPDATE_HANDLER( scorpion_direct )
223223{   
224   UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_PREVIOUSPC);
224   UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_GENPCBASE);
225225   if (betadisk_is_active()) {
226226      if (pc >= 0x4000) {
227227         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
src/mess/drivers/specpls3.c
r3957r3958
312312
313313static WRITE8_HANDLER(spectrum_plus3_port_1ffd_w)
314314{
315   /* D0-D1: ROM/RAM paging */
316   /* D2: Affects if d0-d1 work on ram/rom */
317   /* D3 - Disk motor on/off */
318   /* D4 - parallel port strobe */
315319
316      /* D0-D1: ROM/RAM paging */
317      /* D2: Affects if d0-d1 work on ram/rom */
318      /* D3 - Disk motor on/off */
319      /* D4 - parallel port strobe */
320   floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), data & (1<<3));
321   floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), data & (1<<3));
322   floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1, 1);
323   floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1, 1);
320324
321      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), data & (1<<3));
322      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), data & (1<<3));
323      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 1);
324      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1, 1);
325   spectrum_plus3_port_1ffd_data = data;
325326
326      spectrum_plus3_port_1ffd_data = data;
327
328      /* disable paging? */
329      if ((spectrum_128_port_7ffd_data & 0x20)==0)
330      {
331            /* no */
332            spectrum_plus3_update_memory(space->machine);
333      }
327   /* disable paging? */
328   if ((spectrum_128_port_7ffd_data & 0x20)==0)
329   {
330         /* no */
331         spectrum_plus3_update_memory(space->machine);
332   }
334333}
335334
336335/* ports are not decoded full.
r3957r3958
351350{
352351   memset(mess_ram,0,128*1024);
353352   
354   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
355   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
353   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
354   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
356355
357356   /* Initial configuration */
358357   spectrum_128_port_7ffd_data = 0;
src/mess/drivers/pmd85.c
r3957r3958
545545   MDRV_CPU_ADD("main", 8080, 2000000)      /* 2.048MHz ??? */
546546   MDRV_CPU_PROGRAM_MAP(pmd85_mem, 0)
547547   MDRV_CPU_IO_MAP(pmd85_io_map, 0)
548   MDRV_INTERLEAVE(1)
548   MDRV_QUANTUM_TIME(HZ(60))
549549
550550   MDRV_MACHINE_RESET( pmd85 )
551551
src/mess/drivers/abc80.c
r3957r3958
216216   abc80_keyboard_scan(timer->machine);
217217}
218218
219static READ8_DEVICE_HANDLER(z80pio_alt_r)
220{
221   int channel = BIT(offset, 1);
222   return (offset & 1) ? z80pio_c_r(device, channel) : z80pio_d_r(device, channel);
223}
224
225static WRITE8_DEVICE_HANDLER(z80pio_alt_w)
226{
227   int channel = BIT(offset, 1);
228   if (offset & 1)
229      z80pio_c_w(device, channel, data);
230   else
231      z80pio_d_w(device, channel, data);
232}
233
219234/* Memory Maps */
220235
221236static ADDRESS_MAP_START( abc80_map, ADDRESS_SPACE_PROGRAM, 8 )
r3957r3958
364379   z80pio_astb_w(state->z80pio, state->z80pio_astb);
365380}
366381
367static Z80PIO_ON_INT_CHANGED( abc80_pio_interrupt )
382static void abc80_pio_interrupt(const device_config *device, int state)
368383{
369384   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state);
370385}
r3957r3958
440455   cassette_output(cassette_device_image(device->machine), BIT(data, 6) ? -1.0 : +1.0);
441456};
442457
443static Z80PIO_INTERFACE( abc80_pio_intf )
458static const z80pio_interface abc80_pio_intf =
444459{
445   Z80_TAG,               /* CPU */
446   0,                     /* clock (get from main CPU) */
447460   abc80_pio_interrupt,      /* callback when change interrupt status */
448461   abc80_pio_port_a_r,         /* port A read callback */
449462   abc80_pio_port_b_r,         /* port B read callback */
src/mess/drivers/x68k.c
r3957r3958
746746            output_set_indexed_value("eject_drv",drive,(data & 0x40) ? 1 : 0);
747747            if(data & 0x20)  // ejects disk
748748            {
749               image_unload(image_from_devtype_and_index(IO_FLOPPY, drive));
750               floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 0);  // I'll presume ejecting the disk stops the drive motor :)
749               image_unload(image_from_devtype_and_index(space->machine, IO_FLOPPY, drive));
750               floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, drive), 0);  // I'll presume ejecting the disk stops the drive motor :)
751751            }
752752         }
753753      }
r3957r3958
757757   case 0x03:
758758      sys.fdc.media_density[data & 0x03] = data & 0x10;
759759      sys.fdc.motor[data & 0x03] = data & 0x80;
760      floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, data & 0x03), (data & 0x80));
760      floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, data & 0x03), (data & 0x80));
761761      if(data & 0x80)
762762      {
763763         for(drive=0;drive<4;drive++) // enable motor for this drive
764764         {
765765            if(drive == (data & 0x03))
766766            {
767               floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 1);
767               floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, drive), 1);
768768               output_set_indexed_value("access_drv",drive,0);
769769            }
770770            else
r3957r3958
775775      {
776776         for(drive=0;drive<4;drive++)
777777         {
778            floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, drive), 0);
778            floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, drive), 0);
779779            output_set_indexed_value("access_drv",drive,1);
780780         }
781781      }
782      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0),1,1);
783      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1),1,1);
784      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 2),1,1);
785      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 3),1,1);
782      floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0),1,1);
783      floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1),1,1);
784      floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 2),1,1);
785      floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 3),1,1);
786786//      for(drive=0;drive<4;drive++)
787787//      {
788//         if(floppy_drive_get_flag_state(image_from_devtype_and_index(IO_FLOPPY, drive),FLOPPY_DRIVE_MOTOR_ON))
788//         if(floppy_drive_get_flag_state(image_from_devtype_and_index(machine, IO_FLOPPY, drive),FLOPPY_DRIVE_MOTOR_ON))
789789//            output_set_indexed_value("access_drv",drive,0);
790790//         else
791791//            output_set_indexed_value("access_drv",drive,1);
r3957r3958
13911391   if(mess_ram[0x09] != 0x02)  // normal vector for bus errors points to 02FF0540
13921392   {
13931393      int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a];
1394      int sp = cpu_get_reg(machine->cpu[0],REG_SP);
1395      int pc = cpu_get_reg(machine->cpu[0],REG_PC);
1394      int sp = cpu_get_reg(machine->cpu[0],REG_GENSP);
1395      int pc = cpu_get_reg(machine->cpu[0],REG_GENPC);
13961396      int sr = cpu_get_reg(machine->cpu[0],M68K_SR);
13971397      //int pda = cpu_get_reg(machine->cpu[0],M68K_PREF_DATA);
1398      cpu_set_reg(machine->cpu[0],REG_SP,sp-14);
1398      cpu_set_reg(machine->cpu[0],REG_GENSP,sp-14);
13991399      mess_ram[sp-11] = (val & 0xff000000) >> 24;
14001400      mess_ram[sp-12] = (val & 0x00ff0000) >> 16;
14011401      mess_ram[sp-9] = (val & 0x0000ff00) >> 8;
r3957r3958
14061406      mess_ram[sp-2] = (pc & 0x000000ff);  // place PC onto the stack
14071407      mess_ram[sp-5] = (sr & 0xff00) >> 8;
14081408      mess_ram[sp-6] = (sr & 0x00ff);  // place SR onto the stack
1409      cpu_set_reg(machine->cpu[0],REG_PC,addr);  // real exceptions seem to take too long to be acknowledged
1409      cpu_set_reg(machine->cpu[0],REG_GENPC,addr);  // real exceptions seem to take too long to be acknowledged
14101410      popmessage("Expansion access [%08x]: PC jump to %08x",val,addr);
14111411   }
14121412}
r3957r3958
19991999   // check for disks
20002000   for(drive=0;drive<4;drive++)
20012001   {
2002      if(image_exists(image_from_devtype_and_index(IO_FLOPPY,drive)))
2002      if(image_exists(image_from_devtype_and_index(machine, IO_FLOPPY,drive)))
20032003         sys.fdc.disk_inserted[drive] = 1;
20042004      else
20052005         sys.fdc.disk_inserted[drive] = 0;
r3957r3958
20462046   }
20472047   
20482048   // reset CPU
2049   cpu_reset(machine->cpu[0]);
2049   device_reset(machine->cpu[0]);
20502050}
20512051
20522052static MACHINE_START( x68000 )
r3957r3958
21302130   MDRV_CPU_ADD("main", M68000, 10000000)  /* 10 MHz */
21312131   MDRV_CPU_PROGRAM_MAP(x68k_map, 0)
21322132   MDRV_CPU_VBLANK_INT("main", x68k_vsync_irq)
2133   MDRV_INTERLEAVE(1)
2133   MDRV_QUANTUM_TIME(HZ(60))
21342134
21352135   MDRV_MACHINE_START( x68000 )
21362136   MDRV_MACHINE_RESET( x68000 )
r3957r3958
21402140
21412141   MDRV_PPI8255_ADD( "ppi8255",  ppi_interface )
21422142
2143   MDRV_DEVICE_ADD( "hd63450", HD63450 )
2144   MDRV_DEVICE_CONFIG( dmac_interface )
2143   MDRV_HD63450_ADD( "hd63450", dmac_interface )
21452144
2146   MDRV_DEVICE_ADD( "x68k_hdc", X68KHDC )
2145   MDRV_X68KHDC_ADD( "x68k_hdc" )
21472146
21482147   MDRV_SCC8530_ADD( "scc", x68000_scc8530_interface )
21492148
src/mess/drivers/spectrum.c
r3957r3958
460460   MDRV_CPU_PROGRAM_MAP(spectrum_mem, 0)
461461   MDRV_CPU_IO_MAP(spectrum_io, 0)
462462   MDRV_CPU_VBLANK_INT("main", spec_interrupt)
463   MDRV_INTERLEAVE(1)
463   MDRV_QUANTUM_TIME(HZ(60))
464464
465465   MDRV_MACHINE_RESET( spectrum )
466466
src/mess/drivers/mpf1.c
r3957r3958
6363{
6464   // halt-LED; the red one, is turned on when the processor is halted
6565   // TODO: processor seems to halt, but restarts(?) at 0x0000 after a while -> fix
66   led_halt = (UINT8) cpu_get_info_int(machine->cpu[0], CPUINFO_INT_REGISTER + Z80_HALT);
66   led_halt = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_REGISTER + Z80_HALT);
6767   set_led_status(1, led_tone);
6868}
6969
src/mess/drivers/kaypro.c
r3957r3958
241241   MDRV_CPU_PROGRAM_MAP(kaypro_mem, 0)
242242   MDRV_CPU_IO_MAP(kaypro_io, 0)
243243   MDRV_CPU_VBLANK_INT("main", kaypro_interrupt)
244   MDRV_INTERLEAVE(4)
244   MDRV_QUANTUM_TIME(HZ(240))
245245
246246   MDRV_MACHINE_RESET( kaypro )
247247
src/mess/drivers/n64.c
r3957r3958
9191   MDRV_CPU_PROGRAM_MAP(rsp_map, 0)
9292
9393   MDRV_MACHINE_RESET( n64 )
94   MDRV_INTERLEAVE(10)
94   MDRV_QUANTUM_TIME(HZ(600))
9595
9696   /* video hardware */
9797   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/atarist.c
r3957r3958
18041804   MDRV_PRINTER_ADD("printer")
18051805
18061806   /* acia */
1807   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1808   MDRV_DEVICE_CONFIG(acia_ikbd_intf)
1809   MDRV_DEVICE_ADD("acia_1", ACIA6850)
1810   MDRV_DEVICE_CONFIG(acia_midi_intf)
1807   MDRV_ACIA6850_ADD("acia_0", acia_ikbd_intf)
1808   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
18111809   
18121810   MDRV_WD1772_ADD("wd1772", atarist_wd17xx_interface )
18131811MACHINE_DRIVER_END
r3957r3958
18651863   MDRV_PRINTER_ADD("printer")
18661864
18671865   /* acia */
1868   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1869   MDRV_DEVICE_CONFIG(acia_ikbd_intf)
1870   MDRV_DEVICE_ADD("acia_1", ACIA6850)
1871   MDRV_DEVICE_CONFIG(acia_midi_intf)
1866   MDRV_ACIA6850_ADD("acia_0", acia_ikbd_intf)
1867   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
18721868   
18731869   MDRV_WD1772_ADD("wd1772", atarist_wd17xx_interface )
18741870MACHINE_DRIVER_END
r3957r3958
19191915   MDRV_PRINTER_ADD("printer")
19201916
19211917   /* acia */
1922   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1923   MDRV_DEVICE_CONFIG(stbook_acia_ikbd_intf)
1924   MDRV_DEVICE_ADD("acia_1", ACIA6850)
1925   MDRV_DEVICE_CONFIG(acia_midi_intf)
1918   MDRV_ACIA6850_ADD("acia_0", stbook_acia_ikbd_intf)
1919   MDRV_ACIA6850_ADD("acia_1", acia_midi_intf)
19261920   
19271921   MDRV_WD1772_ADD("wd1772", atarist_wd17xx_interface )
19281922MACHINE_DRIVER_END
src/mess/drivers/sg1000.c
r3957r3958
657657    */
658658
659659   /* floppy motor */
660   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), (data & 0x02) ? 0 : 1);
661   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
660   floppy_drive_set_motor_state(image_from_devtype_and_index(device->machine, IO_FLOPPY, 0), (data & 0x02) ? 0 : 1);
661   floppy_drive_set_ready_state(image_from_devtype_and_index(device->machine, IO_FLOPPY, 0), 1, 0);
662662
663663   /* FDC terminal count */
664664   nec765_set_tc_state(fdc, data & 0x04);
r3957r3958
734734   TMS9928A_configure(&tms9928a_interface);
735735
736736   /* configure FDC */
737   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(IO_FLOPPY, 0), sf7000_fdc_index_callback);
737   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(machine, IO_FLOPPY, 0), sf7000_fdc_index_callback);
738738
739739   /* configure PPI */
740740   centronics_config(machine, 1, sf7000_centronics_config);
src/mess/drivers/c128.c
r3957r3958
621621   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
622622
623623   /* cia */
624   MDRV_DEVICE_ADD("cia_0", CIA6526R1)
625   MDRV_DEVICE_CONFIG(c64_ntsc_cia0)
626   MDRV_DEVICE_ADD("cia_1", CIA6526R1)
627   MDRV_DEVICE_CONFIG(c64_ntsc_cia1)
624   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 0, c64_ntsc_cia0)
625   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 0, c64_ntsc_cia1)
628626MACHINE_DRIVER_END
629627
630628
src/mess/drivers/lviv.c
r3957r3958
426426   MDRV_CPU_ADD("main", 8080, 2500000)
427427   MDRV_CPU_PROGRAM_MAP(lviv_mem, 0)
428428   MDRV_CPU_IO_MAP(io_map, 0)
429   MDRV_INTERLEAVE(1)
429   MDRV_QUANTUM_TIME(HZ(60))
430430
431431   MDRV_MACHINE_RESET( lviv )
432432
src/mess/drivers/exidy.c
r3957r3958
367367
368368static MACHINE_RESET( exidy )
369369{
370   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
370   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
371371   MACHINE_RESET_CALL( exidyd );
372372}
373373
r3957r3958
911911      if ((execute_address != 0xc858) && autorun)
912912         memory_write_word_16le(space, 0xf028, execute_address);
913913
914      cpu_set_reg(cputag_get_cpu(machine, "main"), REG_PC, 0xf01f);
914      cpu_set_reg(cputag_get_cpu(machine, "main"), REG_GENPC, 0xf01f);
915915   }
916916   else
917917   {
918918      if (autorun)
919         cpu_set_reg(cputag_get_cpu(machine, "main"), REG_PC, execute_address);
919         cpu_set_reg(cputag_get_cpu(machine, "main"), REG_GENPC, execute_address);
920920   }
921921}
922922
src/mess/drivers/pc8801.c
r3957r3958
529529   MDRV_CPU_IO_MAP(pc8801fd_io, 0)
530530   MDRV_CPU_VBLANK_INT("main", pc8801fd_interrupt)
531531
532   MDRV_INTERLEAVE(5000)
532   MDRV_QUANTUM_TIME(HZ(300000))
533533
534534   MDRV_MACHINE_RESET( pc88srl )
535535
r3957r3958
566566
567567static MACHINE_DRIVER_START( pc88srh )
568568   MDRV_IMPORT_FROM( pc88srl )
569   MDRV_INTERLEAVE(6000)
569   MDRV_QUANTUM_TIME(HZ(360000))
570570
571571   MDRV_MACHINE_RESET( pc88srh )
572572
src/mess/drivers/p2000t.c
r3957r3958
236236   MDRV_CPU_PROGRAM_MAP(p2000m_mem, 0)
237237   MDRV_CPU_IO_MAP(p2000t_io, 0)
238238   MDRV_CPU_VBLANK_INT("main", p2000_interrupt)
239   MDRV_INTERLEAVE(1)
239   MDRV_QUANTUM_TIME(HZ(60))
240240
241241    /* video hardware */
242242   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/pet.c
r3957r3958
601601
602602static const mc6845_interface crtc_pet40 = {
603603   "main",
604   XTAL_17_73447MHz/3,         /* This is a wild guess and mostly likely incorrect */
605604   8,
606605   NULL,
607606   pet40_update_row,
r3957r3958
613612
614613static const mc6845_interface crtc_pet80 = {
615614   "main",
616   XTAL_12MHz / 2,         /* This is a wild guess and mostly likely incorrect */
617615   16,
618616   NULL,
619617   pet80_update_row,
r3957r3958
697695   MDRV_CPU_MODIFY( "main" )
698696   MDRV_CPU_PROGRAM_MAP( pet40_mem, 0 )
699697
700   MDRV_DEVICE_ADD("crtc", MC6845)
701   MDRV_DEVICE_CONFIG( crtc_pet40 )
698   MDRV_MC6845_ADD("crtc", MC6845, XTAL_17_73447MHz/3   /* This is a wild guess and mostly likely incorrect */, crtc_pet40)
702699
703700   MDRV_VIDEO_START( pet_crtc )
704701   MDRV_VIDEO_UPDATE( pet_crtc )
r3957r3958
724721   MDRV_SCREEN_SIZE(640, 250)
725722   MDRV_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1)
726723
727   MDRV_DEVICE_ADD("crtc", MC6845)
728   MDRV_DEVICE_CONFIG( crtc_pet80 )
724   MDRV_MC6845_ADD("crtc", MC6845, XTAL_12MHz / 2   /* This is a wild guess and mostly likely incorrect */, crtc_pet80)
729725
730726   MDRV_GFXDECODE( pet80 )
731727   MDRV_VIDEO_START( pet_crtc )
src/mess/drivers/pcw.c
r3957r3958
549549      /* disc motor on */
550550      case 9:
551551      {
552         floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1);
553         floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1);
554         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1,1);
555         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
552         floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1);
553         floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1);
554         floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1,1);
555         floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1,1);
556556      }
557557      break;
558558
559559      /* disc motor off */
560560      case 10:
561561      {
562         floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), 0);
563         floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), 0);
564         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1,1);
565         floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
562         floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 0);
563         floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 0);
564         floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1,1);
565         floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1,1);
566566      }
567567      break;
568568
r3957r3958
751751static MACHINE_START( pcw )
752752{
753753   fdc_interrupt_code = 0;
754   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
754   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
755755}
756756
757757
r3957r3958
987987   MDRV_CPU_ADD("main", Z80, 4000000)       /* clock supplied to chip, but in reality it is 3.4 MHz */
988988   MDRV_CPU_PROGRAM_MAP(pcw_map, 0)
989989   MDRV_CPU_IO_MAP(pcw_io, 0)
990   MDRV_INTERLEAVE(1)
990   MDRV_QUANTUM_TIME(HZ(60))
991991
992992   MDRV_MACHINE_START(pcw)
993993
src/mess/drivers/mk2.c
r3957r3958
170170   /* basic machine hardware */
171171   MDRV_CPU_ADD("main", M6502, 1000000)        /* 6504 */
172172   MDRV_CPU_PROGRAM_MAP(mk2_mem, 0)
173   MDRV_INTERLEAVE(1)
173   MDRV_QUANTUM_TIME(HZ(60))
174174
175175   MDRV_MACHINE_START( mk2 )
176176
src/mess/drivers/c16.c
r3957r3958
369369   MDRV_CPU_PROGRAM_MAP(c16_map, 0)
370370   MDRV_CPU_VBLANK_INT("main", c16_frame_interrupt)
371371   MDRV_CPU_PERIODIC_INT(ted7360_raster_interrupt, TED7360_HRETRACERATE)
372   MDRV_INTERLEAVE(1)
372   MDRV_QUANTUM_TIME(HZ(60))
373373
374374   MDRV_MACHINE_RESET( c16 )
375375
r3957r3958
410410   MDRV_IMPORT_FROM( c16 )
411411   MDRV_IMPORT_FROM( cpu_c1551 )
412412#ifdef CPU_SYNC
413   MDRV_INTERLEAVE(1)
413   MDRV_QUANTUM_TIME(HZ(60))
414414#else
415   MDRV_INTERLEAVE(100)
415   MDRV_QUANTUM_TIME(HZ(6000))
416416#endif
417417MACHINE_DRIVER_END
418418
r3957r3958
421421   MDRV_IMPORT_FROM( c16 )
422422   MDRV_IMPORT_FROM( cpu_vc1541 )
423423#ifdef CPU_SYNC
424   MDRV_INTERLEAVE(1)
424   MDRV_QUANTUM_TIME(HZ(60))
425425#else
426   MDRV_INTERLEAVE(5000)
426   MDRV_QUANTUM_TIME(HZ(300000))
427427#endif
428428MACHINE_DRIVER_END
429429
r3957r3958
445445   MDRV_SCREEN_MODIFY("main")
446446   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
447447#ifdef CPU_SYNC
448   MDRV_INTERLEAVE(1)
448   MDRV_QUANTUM_TIME(HZ(60))
449449#else
450   MDRV_INTERLEAVE(1000)
450   MDRV_QUANTUM_TIME(HZ(60000))
451451#endif
452452MACHINE_DRIVER_END
453453
r3957r3958
459459   MDRV_SCREEN_MODIFY("main")
460460   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
461461#ifdef CPU_SYNC
462   MDRV_INTERLEAVE(1)
462   MDRV_QUANTUM_TIME(HZ(60))
463463#else
464   MDRV_INTERLEAVE(5000)
464   MDRV_QUANTUM_TIME(HZ(300000))
465465#endif
466466MACHINE_DRIVER_END
467467
src/mess/drivers/studio2.c
r3957r3958
237237static CDP1861_INTERFACE( studio2_cdp1861_intf )
238238{
239239   SCREEN_TAG,
240   XTAL_3_52128MHz,
241240   studio2_int_w,
242241   studio2_dmao_w,
243242   studio2_efx_w
r3957r3958
272271static CDP1864_INTERFACE( mpt02_cdp1864_intf )
273272{
274273   SCREEN_TAG,
275   CDP1864_CLOCK,
276274   CDP1864_INTERLACED,
277275   mpt02_int_w,
278276   mpt02_dmao_w,
r3957r3958
458456   MDRV_PALETTE_INIT(black_and_white)
459457   MDRV_VIDEO_UPDATE(studio2)
460458
461   MDRV_DEVICE_ADD(CDP1861_TAG, CDP1861)
462   MDRV_DEVICE_CONFIG(studio2_cdp1861_intf)
459   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz, studio2_cdp1861_intf)
463460
464461   // sound hardware
465462
r3957r3958
491488   MDRV_PALETTE_INIT(black_and_white)
492489   MDRV_VIDEO_UPDATE(studio2)
493490
494   MDRV_DEVICE_ADD(CDP1861_TAG, CDP1861)
495   MDRV_DEVICE_CONFIG(studio2_cdp1861_intf)
491   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz, studio2_cdp1861_intf)
496492
497493   // sound hardware
498494
r3957r3958
523519   MDRV_PALETTE_LENGTH(8+8)
524520   MDRV_VIDEO_UPDATE(mpt02)
525521
526   MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
527   MDRV_DEVICE_CONFIG(mpt02_cdp1864_intf)
522   MDRV_CDP1864_ADD(CDP1864_TAG, CDP1864_CLOCK, mpt02_cdp1864_intf)
528523
529524   // sound hardware
530525
src/mess/drivers/osi.c
r3957r3958
708708   pia_config(machine, 0, &osi470_pia_intf);
709709
710710   /* set floppy index hole callback */
711   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(IO_FLOPPY, 0), osi470_index_callback);
711   floppy_drive_set_index_pulse_callback(image_from_devtype_and_index(machine, IO_FLOPPY, 0), osi470_index_callback);
712712}
713713
714714/* Machine Drivers */
r3957r3958
732732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
733733
734734   /* cassette ACIA */
735   MDRV_DEVICE_ADD("acia_0", ACIA6850)
736   MDRV_DEVICE_CONFIG(osi600_acia_intf)
735   MDRV_ACIA6850_ADD("acia_0", osi600_acia_intf)
737736
738737   /* cassette */
739738   MDRV_TIMER_ADD_PERIODIC("cassette", cassette_tick, HZ(4800))
r3957r3958
753752   MDRV_IMPORT_FROM(uk101_video)
754753
755754   /* cassette ACIA */
756   MDRV_DEVICE_ADD("acia_0", ACIA6850)
757   MDRV_DEVICE_CONFIG(uk101_acia_intf)
755   MDRV_ACIA6850_ADD("acia_0", uk101_acia_intf)
758756
759757   /* cassette */
760758   MDRV_TIMER_ADD_PERIODIC("cassette", cassette_tick, HZ(4800))
r3957r3958
782780   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
783781
784782   /* cassette ACIA */
785   MDRV_DEVICE_ADD("acia_0", ACIA6850)
786   MDRV_DEVICE_CONFIG(osi600_acia_intf)
783   MDRV_ACIA6850_ADD("acia_0", osi600_acia_intf)
787784
788785   /* cassette */
789786   MDRV_TIMER_ADD_PERIODIC("cassette", cassette_tick, HZ(4800))
r3957r3958
799796   MDRV_MACHINE_START(c1pmf)
800797
801798   /* floppy ACIA */
802   MDRV_DEVICE_ADD("acia_1", ACIA6850)
803   MDRV_DEVICE_CONFIG(osi470_acia_intf)
799   MDRV_ACIA6850_ADD("acia_1", osi470_acia_intf)
804800MACHINE_DRIVER_END
805801
806802/* ROMs */
src/mess/drivers/bw2.c
r3957r3958
4141#include "video/msm6255.h"
4242#include "bw2.lh"
4343
44static const device_config *get_floppy_image(int drive)
44static const device_config *get_floppy_image(running_machine *machine, int drive)
4545{
46   return image_from_devtype_and_index(IO_FLOPPY, drive);
46   return image_from_devtype_and_index(machine, IO_FLOPPY, drive);
4747}
4848
4949static int get_ramdisk_size(running_machine *machine)
r3957r3958
478478
479479   data |= state->mfdbk << 5;
480480   
481   data |= floppy_drive_get_flag_state(get_floppy_image(state->selected_drive), FLOPPY_DRIVE_DISK_WRITE_PROTECTED) ? 0x00 : 0x80;
481   data |= floppy_drive_get_flag_state(get_floppy_image(device->machine, state->selected_drive), FLOPPY_DRIVE_DISK_WRITE_PROTECTED) ? 0x00 : 0x80;
482482
483483   return data;
484484}
r3957r3958
515515   driver_state->mtron = state;
516516   driver_state->mfdbk = !state;
517517         
518   floppy_drive_set_motor_state(get_floppy_image(0), !driver_state->mtron);
519   floppy_drive_set_motor_state(get_floppy_image(1), !driver_state->mtron);
518   floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), !driver_state->mtron);
519   floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), !driver_state->mtron);
520520   
521   floppy_drive_set_ready_state(get_floppy_image(0), 1, 1);
522   floppy_drive_set_ready_state(get_floppy_image(1), 1, 1);
521   floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), 1, 1);
522   floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), 1, 1);
523523}
524524
525525static const struct pit8253_config bw2_pit8253_interface =
r3957r3958
841841   MDRV_MACHINE_START( bw2 )
842842   MDRV_MACHINE_RESET( bw2 )
843843
844   MDRV_DEVICE_ADD( PIT8253_TAG, PIT8253 )
845   MDRV_DEVICE_CONFIG( bw2_pit8253_interface )
846
844   MDRV_PIT8253_ADD( PIT8253_TAG, bw2_pit8253_interface )
847845   MDRV_PPI8255_ADD( PPI8255_TAG, bw2_ppi8255_interface )
848846
849847   /* video hardware */
src/mess/drivers/oric.c
r3957r3958
355355   /* basic machine hardware */
356356   MDRV_CPU_ADD("main", M6502, 1000000)
357357   MDRV_CPU_PROGRAM_MAP(oric_mem, 0)
358   MDRV_INTERLEAVE(1)
358   MDRV_QUANTUM_TIME(HZ(60))
359359
360360   MDRV_MACHINE_START( oric )
361361   MDRV_MACHINE_RESET( oric )
src/mess/drivers/enterp.c
r3957r3958
230230
231231   cpu_set_input_line_vector(machine->cpu[0],0,0x0ff);
232232
233   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
233   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_DS_80);
234234}
235235
236236static MACHINE_START(enterprise)
r3957r3958
541541   MDRV_CPU_ADD("main", Z80, 4000000)
542542   MDRV_CPU_PROGRAM_MAP(enterprise_mem, 0)
543543   MDRV_CPU_IO_MAP(enterprise_io, 0)
544   MDRV_INTERLEAVE(1)
544   MDRV_QUANTUM_TIME(HZ(60))
545545
546546   MDRV_MACHINE_START( enterprise )
547547
src/mess/drivers/mekd2.c
r3957r3958
201201   /* basic machine hardware */
202202   MDRV_CPU_ADD("main", M6800, 614400)        /* 614.4 kHz */
203203   MDRV_CPU_PROGRAM_MAP(mekd2_mem, 0)
204   MDRV_INTERLEAVE(1)
204   MDRV_QUANTUM_TIME(HZ(60))
205205
206206    /* video hardware */
207207   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/at.c
r3957r3958
44
55***************************************************************************/
66
7/* mingw-gcc defines this */
8#ifdef i386
9#undef i386
10#endif /* i386 */
11
712#include "driver.h"
8//#include "cpu/i86/i286.h"
13#include "cpu/i86/i86.h"
14#include "cpu/i86/i286.h"
915#include "cpu/i386/i386.h"
1016#include "sound/3812intf.h"
1117#include "machine/8255ppi.h"
r3957r3958
412418#endif
413419
414420
415#define MDRV_CPU_ATPC(mem, port, type, clock)   \
416   MDRV_CPU_ADD("main", type, clock)               \
417   MDRV_CPU_PROGRAM_MAP(mem##_map, 0)            \
418   MDRV_CPU_IO_MAP(port##_io, 0)               \
419   MDRV_CPU_CONFIG(i286_address_mask)
420
421421static MACHINE_DRIVER_START( ibm5170 )
422422   /* basic machine hardware */
423   MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/)
423   MDRV_CPU_ADD("main", I80286, 6000000 /*6000000*/)
424   MDRV_CPU_PROGRAM_MAP(at16_map, 0)
425   MDRV_CPU_IO_MAP(at16_io, 0)
426   MDRV_CPU_CONFIG(i286_address_mask)
424427
425   MDRV_INTERLEAVE(1)
428   MDRV_QUANTUM_TIME(HZ(60))
426429
427430   MDRV_PIT8254_ADD( "pit8254", at_pit8254_config )
428431
r3957r3958
485488
486489static MACHINE_DRIVER_START( ibm5162 )
487490   /* basic machine hardware */
488   MDRV_CPU_ATPC(at16, at16, I80286, 6000000 /*6000000*/)
491   MDRV_CPU_ADD("main", I80286, 6000000 /*6000000*/)
492   MDRV_CPU_PROGRAM_MAP(at16_map, 0)
493   MDRV_CPU_IO_MAP(at16_io, 0)
494   MDRV_CPU_CONFIG(i286_address_mask)
489495
490   MDRV_INTERLEAVE(1)
496   MDRV_QUANTUM_TIME(HZ(60))
491497
492498   MDRV_PIT8254_ADD( "pit8254", at_pit8254_config )
493499
r3957r3958
534540
535541static MACHINE_DRIVER_START( ps2m30286 )
536542   /* basic machine hardware */
537   MDRV_CPU_ATPC(at16, at16, I80286, 12000000)
543   MDRV_CPU_ADD("main", I80286, 12000000)
544   MDRV_CPU_PROGRAM_MAP(at16_map, 0)
545   MDRV_CPU_IO_MAP(at16_io, 0)
546   MDRV_CPU_CONFIG(i286_address_mask)
538547
539548   MDRV_PIT8254_ADD( "pit8254", at_pit8254_config )
540549
r3957r3958
596605
597606static MACHINE_DRIVER_START( atvga )
598607   /* basic machine hardware */
599   MDRV_CPU_ATPC(at16, at16, I80286, 12000000)
608   MDRV_CPU_ADD("main", I80286, 12000000)
609   MDRV_CPU_PROGRAM_MAP(at16_map, 0)
610   MDRV_CPU_IO_MAP(at16_io, 0)
611   MDRV_CPU_CONFIG(i286_address_mask)
600612
601613   MDRV_PIT8254_ADD( "pit8254", at_pit8254_config )
602614
r3957r3958
661673static MACHINE_DRIVER_START( at386 )
662674    /* basic machine hardware */
663675   /* original at 6 MHz, at03 8 megahertz */
664   MDRV_CPU_ATPC(at386, at386, I386, 12000000)
676   MDRV_CPU_ADD("main", I386, 12000000)
677   MDRV_CPU_PROGRAM_MAP(at386_map, 0)
678   MDRV_CPU_IO_MAP(at386_io, 0)
679   MDRV_CPU_CONFIG(i286_address_mask)
665680
666681   MDRV_MACHINE_START( at )
667682   MDRV_MACHINE_RESET( at )
src/mess/drivers/snes.c
r3957r3958
202202   MDRV_CPU_ADD("sound", SPC700, 1024000)   /* 1.024 MHz */
203203   MDRV_CPU_PROGRAM_MAP(spc_map, 0)
204204
205   MDRV_INTERLEAVE(800)
205   MDRV_QUANTUM_TIME(HZ(48000))
206206
207207   MDRV_MACHINE_START( snes_mess )
208208   MDRV_MACHINE_RESET( snes )
src/mess/drivers/vc20.c
r3957r3958
301301   MDRV_IMPORT_FROM( vic20 )
302302   MDRV_IMPORT_FROM( cpu_vc1540 )
303303#ifdef CPU_SYNC
304   MDRV_INTERLEAVE(1)
304   MDRV_QUANTUM_TIME(HZ(60))
305305#else
306   MDRV_INTERLEAVE(3000)
306   MDRV_QUANTUM_TIME(HZ(180000))
307307#endif
308308MACHINE_DRIVER_END
309309
r3957r3958
312312   MDRV_IMPORT_FROM( vic20 )
313313   /*MDRV_IMPORT_FROM( cpu_c2031 )*/
314314#if 1 || CPU_SYNC
315   MDRV_INTERLEAVE(1)
315   MDRV_QUANTUM_TIME(HZ(60))
316316#else
317   MDRV_INTERLEAVE(3000)
317   MDRV_QUANTUM_TIME(HZ(180000))
318318#endif
319319
320320   MDRV_CPU_MODIFY( "main" )
r3957r3958
339339   MDRV_IMPORT_FROM( vc20 )
340340   MDRV_IMPORT_FROM( cpu_vc1540 )
341341#ifdef CPU_SYNC
342   MDRV_INTERLEAVE(1)
342   MDRV_QUANTUM_TIME(HZ(60))
343343#else
344   MDRV_INTERLEAVE(3000)
344   MDRV_QUANTUM_TIME(HZ(180000))
345345#endif
346346MACHINE_DRIVER_END
347347
src/mess/drivers/partner.c
r3957r3958
163163   MDRV_SOUND_ADD("cassette", WAVE, 0)
164164   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
165165
166   MDRV_DEVICE_ADD("dma8257", DMA8257)
167   MDRV_DEVICE_CONFIG(partner_dma)
166   MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, partner_dma)
168167
169168   MDRV_CASSETTE_ADD( "cassette", partner_cassette_config )
170169   
src/mess/drivers/ql.c
r3957r3958
488488static ZX8301_INTERFACE( ql_zx8301_intf )
489489{
490490   SCREEN_TAG,
491   X1,
492491   ql_vsync_w,
493492   ql_ram_r,
494493   ql_ram_w
r3957r3958
517516
518517static ZX8302_INTERFACE( ql_zx8302_intf )
519518{
520   X1,
521519   X2,
522520   MDV1_TAG,
523521   MDV2_TAG,
r3957r3958
616614
617615   MDRV_MACHINE_START(ql)
618616
619   MDRV_DEVICE_ADD(ZX8302_TAG, ZX8302)
620   MDRV_DEVICE_CONFIG(ql_zx8302_intf)
617   MDRV_ZX8302_ADD(ZX8302_TAG, X1, ql_zx8302_intf)
621618
622   MDRV_DEVICE_ADD(MDV1_TAG, MICRODRIVE)
623   MDRV_DEVICE_ADD(MDV2_TAG, MICRODRIVE)
619   MDRV_DEVICE_ADD(MDV1_TAG, MICRODRIVE, 0)
620   MDRV_DEVICE_ADD(MDV2_TAG, MICRODRIVE, 0)
624621
625622   // video hardware
626623
r3957r3958
635632   MDRV_PALETTE_INIT(zx8301)
636633   MDRV_VIDEO_UPDATE(ql)
637634
638   MDRV_DEVICE_ADD(ZX8301_TAG, ZX8301)
639   MDRV_DEVICE_CONFIG(ql_zx8301_intf)
635   MDRV_ZX8301_ADD(ZX8301_TAG, X1, ql_zx8301_intf)
640636
641637   // sound hardware
642638   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/saturn.c
r3957r3958
18631863   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
18641864   cpuexec_boost_interleave(space->machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
18651865   cpuexec_trigger(space->machine, 1000);
1866   cpu_set_info_int(space->machine->cpu[1], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
1866   device_set_info_int(space->machine->cpu[1], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
18671867}
18681868
18691869static WRITE32_HANDLER( sinit_w )
18701870{
18711871   logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
18721872   cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost));
1873   cpu_set_info_int(space->machine->cpu[0], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
1873   device_set_info_int(space->machine->cpu[0], CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE);
18741874}
18751875
18761876static UINT32 backup[64*1024/4];
r3957r3958
21862186   saturn_region = rgn;
21872187
21882188   // set compatible options
2189   cpu_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2190   cpu_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2189   device_set_info_int(machine->cpu[0], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2190   device_set_info_int(machine->cpu[1], CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
21912191
21922192   /* get the current date/time from the core */
21932193   mame_get_current_datetime(machine, &systime);
src/mess/drivers/mikrosha.c
r3957r3958
141141         direct->decrypted = mikrosha_io_mirror;
142142         direct->min = 0x8000;
143143         direct->max = 0xffff;
144         mikrosha_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8080_STATUS);
144         mikrosha_io_mirror[address] = cpu_get_reg(space->machine->cpu[0], I8085_STATUS);
145145   }
146146   return address;
147147}
r3957r3958
208208   MDRV_SOUND_ADD("cassette", WAVE, 0)
209209   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
210210
211   MDRV_DEVICE_ADD("dma8257", DMA8257)
212   MDRV_DEVICE_CONFIG(radio86_dma)
211   MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, radio86_dma)
213212
214213   MDRV_CASSETTE_ADD( "cassette", mikrosha_cassette_config )
215214MACHINE_DRIVER_END
src/mess/drivers/amiga.c
r3957r3958
1919/* Core includes */
2020#include "driver.h"
2121#include "cpu/m68000/m68000.h"
22#include "deprecat.h"
2322#include "includes/amiga.h"
2423
2524/* Components */
r3957r3958
224223static const cia6526_interface cia_0_ntsc_intf =
225224{
226225   amiga_cia_0_irq,                           /* irq_func */
227   AMIGA_68000_NTSC_CLOCK / 10,                  /* clock */
228226   60,                                       /* tod_clock */
229227   {
230228      { amiga_cia_0_portA_r, amiga_cia_0_portA_w },   /* port A */
r3957r3958
235233static const cia6526_interface cia_0_pal_intf =
236234{
237235   amiga_cia_0_irq,                           /* irq_func */
238   AMIGA_68000_PAL_CLOCK / 10,                     /* clock */
239236   50,                                       /* tod_clock */
240237   {
241238      { amiga_cia_0_portA_r, amiga_cia_0_portA_w },   /* port A */
r3957r3958
246243static const cia6526_interface cia_1_intf =
247244{
248245   amiga_cia_1_irq,                           /* irq_func */
249   0,                                       /* clock */
250246   0,                                       /* tod_clock */
251247   {
252248      { NULL, NULL, },                        /* port A */
r3957r3958
257253static const cia6526_interface cia_0_cdtv_intf =
258254{
259255   amiga_cia_0_irq,                           /* irq_func */
260   CDTV_CLOCK_X1 / 40,                           /* clock */
261256   0,                                       /* tod_clock */
262257   {
263258      { amiga_cia_0_portA_r, amiga_cia_0_portA_w },   /* port A */
r3957r3958
268263static const cia6526_interface cia_1_cdtv_intf =
269264{
270265   amiga_cia_1_irq,                           /* irq_func */
271   0,                                       /* clock */
272266   0,                                       /* tod_clock */
273267   {
274268      { NULL, NULL, },                        /* port A */
r3957r3958
299293   MDRV_VIDEO_UPDATE(amiga)
300294
301295   /* devices */
302   MDRV_DEVICE_ADD("rtc", MSM6242)
296   MDRV_MSM6242_ADD("rtc")
303297
304298   /* sound hardware */
305299   MDRV_SPEAKER_STANDARD_STEREO("left", "right")
r3957r3958
312306   MDRV_SOUND_ROUTE(3, "left", 0.50)
313307
314308   /* cia */
315   MDRV_DEVICE_ADD("cia_0", CIA8520)
316   MDRV_DEVICE_CONFIG(cia_0_ntsc_intf)
317   MDRV_DEVICE_ADD("cia_1", CIA8520)
318   MDRV_DEVICE_CONFIG(cia_1_intf)
309   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_ntsc_intf)
310   MDRV_CIA8520_ADD("cia_1", 0, cia_1_intf)
319311MACHINE_DRIVER_END
320312
321313static MACHINE_DRIVER_START( cdtv )
r3957r3958
336328   MDRV_CDROM_ADD( "cdrom" )
337329
338330   /* cia */
339   MDRV_DEVICE_MODIFY("cia_0", CIA8520)
340   MDRV_DEVICE_CONFIG(cia_0_cdtv_intf)
341   MDRV_DEVICE_MODIFY("cia_1", CIA8520)
342   MDRV_DEVICE_CONFIG(cia_1_cdtv_intf)
331   MDRV_CIA8520_REMOVE("cia_0")
332   MDRV_CIA8520_REMOVE("cia_1")
333   MDRV_CIA8520_ADD("cia_0", CDTV_CLOCK_X1 / 40, cia_0_cdtv_intf)
334   MDRV_CIA8520_ADD("cia_1", 0, cia_1_cdtv_intf)
343335MACHINE_DRIVER_END
344336
345337static MACHINE_DRIVER_START( a1000n )
r3957r3958
360352   MDRV_SCREEN_VISIBLE_AREA(214, (228*4)-1, 34, 312-1)
361353
362354   /* cia */
363   MDRV_DEVICE_MODIFY("cia_0", CIA8520)
364   MDRV_DEVICE_CONFIG(cia_0_pal_intf)
355   MDRV_CIA8520_REMOVE("cia_0")
356   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_PAL_CLOCK / 10, cia_0_pal_intf)
365357MACHINE_DRIVER_END
366358
367359static MACHINE_DRIVER_START( a1000p )
r3957r3958
410402   output_set_value("power_led", ( data & 2 ) ? 0 : 1);
411403}
412404
413static UINT16 amiga_read_joy0dat(void)
405static UINT16 amiga_read_joy0dat(running_machine *machine)
414406{
415   running_machine *machine = Machine;
416407   if ( input_port_read(machine, "input") & 0x20 ) {
417408      /* Joystick */
418409      return input_port_read_safe(machine, "JOY0DAT", 0xffff);
r3957r3958
425416   }
426417}
427418
428static UINT16 amiga_read_joy1dat(void)
419static UINT16 amiga_read_joy1dat(running_machine *machine)
429420{
430   running_machine *machine = Machine;
431421   if ( input_port_read(machine, "input") & 0x10 ) {
432422      /* Joystick */
433423      return input_port_read_safe(machine, "JOY1DAT", 0xffff);
r3957r3958
440430   }
441431}
442432
443static UINT16 amiga_read_dskbytr(void)
433static UINT16 amiga_read_dskbytr(running_machine *machine)
444434{
445435   return amiga_fdc_get_byte();
446436}
447437
448static void amiga_write_dsklen(UINT16 data)
438static void amiga_write_dsklen(running_machine *machine, UINT16 data)
449439{
450440   if ( data & 0x8000 ) {
451441      if ( CUSTOM_REG(REG_DSKLEN) & 0x8000 )
452         amiga_fdc_setup_dma(Machine);
442         amiga_fdc_setup_dma(machine);
453443   }
454444}
455445
456446
457static void amiga_reset(void)
447static void amiga_reset(running_machine *machine)
458448{
459   running_machine *machine = Machine;
460449   if (input_port_read(machine, "hardware") & 0x08)
461450   {
462451      /* Install RTC */
src/mess/drivers/channelf.c
r3957r3958
237237   MDRV_CPU_ADD("main", F8, 3579545/2)        /* Colorburst/2 */
238238   MDRV_CPU_PROGRAM_MAP(channelf_map, 0)
239239   MDRV_CPU_IO_MAP(channelf_io, 0)
240   MDRV_INTERLEAVE(1)
240   MDRV_QUANTUM_TIME(HZ(60))
241241
242242   /* video hardware */
243243   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/apple1.c
r3957r3958
231231       is 2 cycles of the fundamental 14.31818 MHz oscillator.  The
232232       total blanking time is about 4450 microseconds. */
233233   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((int) (70 * 65 * 7 * 2 / 14.31818)))
234   MDRV_INTERLEAVE(1)
234   MDRV_QUANTUM_TIME(HZ(60))
235235
236236   MDRV_MACHINE_RESET( apple1 )
237237
src/mess/drivers/abc80x.c
r3957r3958
842842
843843static const z80ctc_interface ctc_intf =
844844{
845   Z80_TAG,         /* cpu */
846   ABC800_X01/2/2,      /* clock */
847845   0,                 /* timer disables */
848846   ctc_interrupt,      /* interrupt handler */
849847   ctc_z0_w,         /* ZC/TO0 callback */
r3957r3958
887885
888886static const z80sio_interface sio_intf =
889887{
890   Z80_TAG,            /* cpu */
891   ABC800_X01/2/2,         /* clock */
892888   sio_interrupt,         /* interrupt handler */
893889   sio_dtr_w,            /* DTR changed handler */
894890   0,                  /* RTS changed handler */
r3957r3958
12661262   MDRV_IMPORT_FROM(abc800m_video)
12671263   
12681264   /* Z80 CTC */
1269   MDRV_Z80CTC_ADD(Z80CTC_TAG, ctc_intf)
1265   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
12701266   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
12711267
12721268   /* Z80 SIO/2 */
1273   MDRV_Z80SIO_ADD(Z80SIO_TAG, sio_intf)
1269   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
12741270
12751271   /* Z80 DART */
12761272   MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf)
r3957r3958
13131309   MDRV_IMPORT_FROM(abc800c_video)
13141310
13151311   /* Z80 CTC */
1316   MDRV_Z80CTC_ADD(Z80CTC_TAG, ctc_intf)
1312   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
13171313   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
13181314
13191315   /* Z80 SIO/2 */
1320   MDRV_Z80SIO_ADD(Z80SIO_TAG, sio_intf)
1316   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
13211317
13221318   /* Z80 DART */
13231319   MDRV_Z80DART_ADD(Z80DART_TAG, abc800_dart_intf)
r3957r3958
13601356   MDRV_IMPORT_FROM(abc802_video)
13611357
13621358   /* Z80 CTC */
1363   MDRV_Z80CTC_ADD(Z80CTC_TAG, ctc_intf)
1359   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
13641360   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
13651361
13661362   /* Z80 SIO/2 */
1367   MDRV_Z80SIO_ADD(Z80SIO_TAG, sio_intf)
1363   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
13681364
13691365   /* Z80 DART */
13701366   MDRV_Z80DART_ADD(Z80DART_TAG, abc802_dart_intf)
r3957r3958
14071403   MDRV_IMPORT_FROM(abc806_video)
14081404
14091405   /* Z80 CTC */
1410   MDRV_Z80CTC_ADD(Z80CTC_TAG, ctc_intf)
1406   MDRV_Z80CTC_ADD(Z80CTC_TAG, ABC800_X01/2/2, ctc_intf)
14111407   MDRV_TIMER_ADD_PERIODIC("ctc", ctc_tick, HZ(ABC800_X01/2/2/2))
14121408
14131409   /* Z80 SIO/2 */
1414   MDRV_Z80SIO_ADD(Z80SIO_TAG, sio_intf)
1410   MDRV_Z80SIO_ADD(Z80SIO_TAG, ABC800_X01/2/2, sio_intf)
14151411
14161412   /* Z80 DART */
14171413   MDRV_Z80DART_ADD(Z80DART_TAG, abc806_dart_intf)
src/mess/drivers/tmc2000e.c
r3957r3958
150150static CDP1864_INTERFACE( tmc2000e_cdp1864_intf )
151151{
152152   SCREEN_TAG,
153   XTAL_1_75MHz,
154153   CDP1864_INTERLACED,
155154   tmc2000e_int_w,
156155   tmc2000e_dmao_w,
r3957r3958
318317   MDRV_PALETTE_LENGTH(8)
319318   MDRV_VIDEO_UPDATE(tmc2000e)
320319
321   MDRV_DEVICE_ADD(CDP1864_TAG, CDP1864)
322   MDRV_DEVICE_CONFIG(tmc2000e_cdp1864_intf)
320   MDRV_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000e_cdp1864_intf)
323321
324322   // sound hardware
325323
src/mess/drivers/bebox.c
r3957r3958
8989   MDRV_CPU_ADD("ppc2", PPC603, 66000000)   /* 66 MHz */
9090   MDRV_CPU_PROGRAM_MAP(bebox_mem, 0)
9191
92   MDRV_INTERLEAVE(1)
92   MDRV_QUANTUM_TIME(HZ(60))
9393
9494   MDRV_PIT8254_ADD( "pit8254", bebox_pit8254_config )
9595
src/mess/drivers/a7800.c
r3957r3958
267267   MDRV_CPU_PROGRAM_MAP(a7800_mem, 0)
268268   MDRV_CPU_VBLANK_INT_HACK(a7800_interrupt, 262)
269269
270   MDRV_INTERLEAVE(1)
270   MDRV_QUANTUM_TIME(HZ(60))
271271
272272   MDRV_MACHINE_RESET( a7800 )
273273
src/mess/drivers/apogee.c
r3957r3958
150150   MDRV_SOUND_ADD("cassette", WAVE, 0)
151151   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
152152
153   MDRV_DEVICE_ADD("dma8257", DMA8257)
154   MDRV_DEVICE_CONFIG(radio86_dma)
153   MDRV_DMA8257_ADD("dma8257", XTAL_16MHz / 9, radio86_dma)
155154
156155   MDRV_CASSETTE_ADD( "cassette", apogee_cassette_config )
157156MACHINE_DRIVER_END
src/mess/drivers/newbrain.c
r3957r3958
559559
560560   */
561561
562   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), BIT(data, 0));
563   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0);
562   floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), BIT(data, 0));
563   floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1, 0);
564564
565565   nec765_set_reset_state(fdc, BIT(data, 1));
566566
r3957r3958
864864
865865static ADC080X_INTERFACE( newbrain_adc0809_intf )
866866{
867   500000,
868867   newbrain_adc_on_eoc_changed,
869868   newbrain_adc_vref_pos_r,
870869   newbrain_adc_vref_neg_r,
r3957r3958
11171116
11181117static const z80ctc_interface newbrain_ctc_intf =
11191118{
1120   Z80_TAG,            /* cpu */
1121   0,                  /* clock */
11221119   0,                    /* timer disables */
11231120   NULL,                 /* interrupt handler */
11241121   NULL,               /* ZC/TO0 callback */
r3957r3958
12531250   MDRV_MACHINE_START(newbrain)
12541251   MDRV_MACHINE_RESET(newbrain)
12551252
1256   MDRV_Z80CTC_ADD( "z80ctc", newbrain_ctc_intf )
1253   MDRV_Z80CTC_ADD( "z80ctc", 0, newbrain_ctc_intf )
12571254
12581255   // A/D converter
1259   MDRV_ADC0809_ADD(ADC0809_TAG, newbrain_adc0809_intf)
1256   MDRV_ADC0809_ADD(ADC0809_TAG, 500000, newbrain_adc0809_intf)
12601257
12611258   // video hardware
12621259
r3957r3958
12661263   MDRV_CASSETTE_ADD( "cassette2", newbrain_cassette_config )
12671264   
12681265   /* acia */
1269   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1270   MDRV_DEVICE_CONFIG(newbrain_acia_intf)   
1266   MDRV_ACIA6850_ADD("acia_0", newbrain_acia_intf)
12711267     
12721268   MDRV_NEC765A_ADD("nec765", newbrain_nec765_interface)   
12731269MACHINE_DRIVER_END
r3957r3958
12891285   MDRV_MACHINE_START(newbrain)
12901286   MDRV_MACHINE_RESET(newbrain)
12911287
1292   MDRV_Z80CTC_ADD( "z80ctc", newbrain_ctc_intf )
1288   MDRV_Z80CTC_ADD( "z80ctc", 0, newbrain_ctc_intf )
12931289
12941290   // video hardware
12951291
r3957r3958
12991295   MDRV_CASSETTE_ADD( "cassette2", newbrain_cassette_config )
13001296
13011297   /* acia */
1302   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1303   MDRV_DEVICE_CONFIG(newbrain_acia_intf)   
1298   MDRV_ACIA6850_ADD("acia_0", newbrain_acia_intf)
13041299MACHINE_DRIVER_END
13051300
13061301static MACHINE_DRIVER_START( newbraia )
r3957r3958
13281323   MDRV_CASSETTE_ADD( "cassette2", newbrain_cassette_config )
13291324
13301325   /* acia */
1331   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1332   MDRV_DEVICE_CONFIG(newbrain_acia_intf)   
1326   MDRV_ACIA6850_ADD("acia_0", newbrain_acia_intf)
13331327MACHINE_DRIVER_END
13341328
13351329static MACHINE_DRIVER_START( newbraiv )
r3957r3958
13491343   MDRV_MACHINE_START(newbrain)
13501344   MDRV_MACHINE_RESET(newbrain)
13511345
1352   MDRV_Z80CTC_ADD( "z80ctc", newbrain_ctc_intf )
1346   MDRV_Z80CTC_ADD( "z80ctc", 0, newbrain_ctc_intf )
13531347
13541348   // video hardware
13551349
r3957r3958
13591353   MDRV_CASSETTE_ADD( "cassette2", newbrain_cassette_config )
13601354
13611355   /* acia */
1362   MDRV_DEVICE_ADD("acia_0", ACIA6850)
1363   MDRV_DEVICE_CONFIG(newbrain_acia_intf)   
1356   MDRV_ACIA6850_ADD("acia_0", newbrain_acia_intf)
13641357MACHINE_DRIVER_END
13651358
13661359/* ROMs */
src/mess/drivers/mtx.c
r3957r3958
250250   MDRV_SOUND_ADD("sn76489a", SN76489A, MTX_SYSTEM_CLOCK)
251251   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
252252
253   MDRV_Z80CTC_ADD( "z80ctc", mtx_ctc_intf )
253   MDRV_Z80CTC_ADD( "z80ctc", MTX_SYSTEM_CLOCK, mtx_ctc_intf )
254254
255255   /* printer */
256256   MDRV_PRINTER_ADD("printer")
src/mess/drivers/einstein.c
r3957r3958
258258
259259static const mc6845_interface einstein_crtc6845_interface = {
260260   "main",
261   EINSTEIN_SYSTEM_CLOCK /*?*/,
262261   8 /*?*/,
263262   NULL,
264263   einstein_6845_update_row,
r3957r3958
525524      case DEVINFO_FCT_IRQ_RETI:                  info->f = (genf *)einstein_daisy_irq_reti;            break;
526525
527526      /* --- the following bits of info are returned as NULL-terminated strings --- */
528      case DEVINFO_STR_NAME:                     info->s = "Einstein daisy";                        break;
529      case DEVINFO_STR_FAMILY:                  info->s = "Z80";                              break;
530      case DEVINFO_STR_VERSION:                  info->s = "1.0";                              break;
531      case DEVINFO_STR_SOURCE_FILE:               info->s = __FILE__;                              break;
532      case DEVINFO_STR_CREDITS:                  info->s = "Copyright the MESS Team";               break;
527      case DEVINFO_STR_NAME:                     strcpy(info->s, "Einstein daisy");                        break;
528      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "Z80");                              break;
529      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                              break;
530      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                              break;
531      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright the MESS Team");               break;
533532   }
534533}
535534
r3957r3958
14511450   /* a reset causes the fire int, adc int, keyboard int mask
14521451    to be set to 1, which causes all these to be DISABLED */
14531452   einstein_int_mask = 0;
1454   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
1453   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
14551454
14561455   cpu_set_irq_callback(machine->cpu[0], einstein_cpu_acknowledge_int);
14571456
r3957r3958
17221721   MDRV_CPU_PROGRAM_MAP(einstein_mem, 0)
17231722   MDRV_CPU_IO_MAP(einstein_io, 0)
17241723   MDRV_CPU_CONFIG(einstein_daisy_chain)
1725   MDRV_INTERLEAVE(1)
1724   MDRV_QUANTUM_TIME(HZ(60))
17261725
17271726   MDRV_MACHINE_START( einstein )
17281727   MDRV_MACHINE_RESET( einstein )
r3957r3958
17661765   MDRV_SCREEN_SIZE(640, 400)
17671766   MDRV_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
17681767
1769   MDRV_DEVICE_ADD("crtc", MC6845)
1770   MDRV_DEVICE_CONFIG( einstein_crtc6845_interface )
1768   MDRV_MC6845_ADD("crtc", MC6845, EINSTEIN_SYSTEM_CLOCK /*?*/, einstein_crtc6845_interface)
17711769
17721770   MDRV_VIDEO_UPDATE( einstein2 )
17731771MACHINE_DRIVER_END
src/mess/drivers/intv.c
r3957r3958
384384   MDRV_CPU_ADD("main", CP1610, XTAL_3_579545MHz/4)        /* Colorburst/4 */
385385   MDRV_CPU_PROGRAM_MAP(intv_mem, 0)
386386   MDRV_CPU_VBLANK_INT("main", intv_interrupt)
387   MDRV_INTERLEAVE(1)
387   MDRV_QUANTUM_TIME(HZ(60))
388388
389389   MDRV_MACHINE_RESET( intv )
390390
r3957r3958
419419   MDRV_CPU_PROGRAM_MAP(intv2_mem, 0)
420420   MDRV_CPU_VBLANK_INT("main", intv_interrupt2)
421421
422   MDRV_INTERLEAVE(100)
422   MDRV_QUANTUM_TIME(HZ(6000))
423423
424424    /* video hardware */
425425   MDRV_GFXDECODE(intvkbd)
src/mess/drivers/votrpss.c
r3957r3958
139139    MDRV_CPU_ADD("main", Z80, XTAL_8MHz/2)  /* 4.000 MHz, verified */
140140    MDRV_CPU_PROGRAM_MAP(z80_mem, 0)
141141    MDRV_CPU_IO_MAP(z80_io, 0)
142    MDRV_INTERLEAVE(1)
142    MDRV_QUANTUM_TIME(HZ(60))
143143
144144    /* video hardware */
145145   MDRV_DEFAULT_LAYOUT(layout_votrpss)
src/mess/drivers/jupiter.c
r3957r3958
306306   MDRV_CPU_ADD("main", Z80, XTAL_6_5MHz/2)        /* 3.25 MHz */
307307   MDRV_CPU_PROGRAM_MAP(jupiter_mem, 0)
308308   MDRV_CPU_IO_MAP(jupiter_io, 0)
309   MDRV_INTERLEAVE(1)
309   MDRV_QUANTUM_TIME(HZ(60))
310310
311311   MDRV_MACHINE_START( jupiter )
312312
src/mess/drivers/exelv.c
r3957r3958
563563   MDRV_CPU_PROGRAM_MAP(exelv_tms7040_map, 0)
564564   MDRV_CPU_IO_MAP(exelv_tms7040_port, 0)
565565
566   MDRV_INTERLEAVE(1)
566   MDRV_QUANTUM_TIME(HZ(60))
567567
568568   MDRV_MACHINE_RESET( exelv )
569569
src/mess/drivers/osborne1.c
r3957r3958
171171
172172   MDRV_MACHINE_RESET( osborne1 )
173173
174   MDRV_DEVICE_ADD( "osborne1_daisy", OSBORNE1_DAISY )
174   MDRV_DEVICE_ADD( "osborne1_daisy", OSBORNE1_DAISY, 0 )
175175
176176   MDRV_SCREEN_ADD("main", RASTER)
177177   MDRV_SCREEN_FORMAT( BITMAP_FORMAT_INDEXED16 )
src/mess/drivers/mephisto.c
r3957r3958
201201   /* basic machine hardware */
202202   MDRV_CPU_ADD("main",M65C02,4915200)        /* 65C02 */
203203   MDRV_CPU_PROGRAM_MAP(mephisto_mem, 0)
204   MDRV_INTERLEAVE(1)
204   MDRV_QUANTUM_TIME(HZ(60))
205205   MDRV_MACHINE_START( mephisto )
206206   MDRV_MACHINE_RESET( mephisto )
207207
src/mess/drivers/ssystem3.c
r3957r3958
320320   /* basic machine hardware */
321321   MDRV_CPU_ADD("main", M6502, 1000000)
322322   MDRV_CPU_PROGRAM_MAP(ssystem3_map, 0)
323   MDRV_INTERLEAVE(1)
323   MDRV_QUANTUM_TIME(HZ(60))
324324
325325    /* video hardware */
326326   MDRV_SCREEN_ADD("main", LCD)
src/mess/drivers/vtech1.c
r3957r3958
315315    MDRV_CPU_IO_MAP(vtech1_io, 0)
316316   MDRV_SCREEN_ADD("main", RASTER)
317317   MDRV_SCREEN_REFRESH_RATE(M6847_PAL_FRAMES_PER_SECOND)
318    MDRV_INTERLEAVE(1)
318    MDRV_QUANTUM_TIME(HZ(60))
319319
320320   MDRV_MACHINE_START(laser110)
321321
r3957r3958
453453      if (!autorun)
454454         memory_write_byte(space, 0x7929, 0xb6);   /* turn off autorun */
455455
456      cpu_set_reg(cpu, REG_PC, 0x791e);
456      cpu_set_reg(cpu, REG_GENPC, 0x791e);
457457   }
458458   else
459459   {
460460      if (autorun)
461         cpu_set_reg(cpu, REG_PC, execute_address);
461         cpu_set_reg(cpu, REG_GENPC, execute_address);
462462   }
463463}
464464
src/mess/drivers/amstrad.c
r3957r3958
14551455         /* FDC Motor Control - Bit 0 defines the state of the FDD motor:
14561456          * "1" the FDD motor will be active.
14571457          * "0" the FDD motor will be in-active.*/
1458               floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), (data & 0x01));
1459               floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 1), (data & 0x01));
1460               floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1,1);
1461               floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
1458               floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), (data & 0x01));
1459               floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), (data & 0x01));
1460               floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), 1,1);
1461               floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 1), 1,1);
14621462           break;
14631463
14641464        case 0x03: /* Write Data register of FDC */
r3957r3958
20422042   memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_BANK15);
20432043   memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_BANK16);
20442044
2045   cpu_reset(space->machine->cpu[0]);
2045   device_reset(space->machine->cpu[0]);
20462046   if(amstrad_system_type == SYSTEM_CPC)
20472047      cpu_set_input_line_vector(machine->cpu[0], 0,0xff);
20482048   else
r3957r3958
20502050
20512051   if(amstrad_system_type != SYSTEM_GX4000)
20522052   {
2053      floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0),  FLOPPY_DRIVE_SS_40);
2054      floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1),  FLOPPY_DRIVE_SS_40);
2053      floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0),  FLOPPY_DRIVE_SS_40);
2054      floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1),  FLOPPY_DRIVE_SS_40);
20552055   }
20562056/* Every microsecond:
20572057
r3957r3958
20702070
20712071   /* Using the cool code Juergen has provided, I will override
20722072    the timing tables with the values for the amstrad */
2073   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_op, (void*)amstrad_cycle_table_op);
2074   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_cb, (void*)amstrad_cycle_table_cb);
2075   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_ed, (void*)amstrad_cycle_table_ed);
2076   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_xy, (void*)amstrad_cycle_table_xy);
2077   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_xycb, (void*)amstrad_cycle_table_xycb);
2078   cpu_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_ex, (void*)amstrad_cycle_table_ex);
2073   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_op, (void*)amstrad_cycle_table_op);
2074   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_cb, (void*)amstrad_cycle_table_cb);
2075   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_ed, (void*)amstrad_cycle_table_ed);
2076   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_xy, (void*)amstrad_cycle_table_xy);
2077   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_xycb, (void*)amstrad_cycle_table_xycb);
2078   device_set_info_ptr(machine->cpu[0],CPUINFO_PTR_Z80_CYCLE_TABLE+Z80_TABLE_ex, (void*)amstrad_cycle_table_ex);
20792079
20802080   /* Juergen is a cool dude! */
20812081   cpu_set_irq_callback(machine->cpu[0], amstrad_cpu_acknowledge_int);
r3957r3958
22462246   amstrad_common_init(machine);
22472247   amstrad_reset_machine(machine);
22482248
2249   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0),  FLOPPY_DRIVE_DS_80);
2250   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1),  FLOPPY_DRIVE_DS_80);
2249   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0),  FLOPPY_DRIVE_DS_80);
2250   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1),  FLOPPY_DRIVE_DS_80);
22512251}
22522252
22532253/* Memory is banked in 16k blocks. However, the multiface
r3957r3958
29512951   MDRV_CPU_PROGRAM_MAP(amstrad_mem, 0)
29522952   MDRV_CPU_IO_MAP(amstrad_io, 0)
29532953
2954   MDRV_INTERLEAVE(1)
2954   MDRV_QUANTUM_TIME(HZ(60))
29552955
29562956   MDRV_MACHINE_RESET( amstrad )
29572957
src/mess/drivers/sms.c
r3957r3958
308308   MDRV_CPU_PROGRAM_MAP(sms_mem, 0)
309309   MDRV_CPU_IO_MAP(sms_io, 0)
310310
311   MDRV_INTERLEAVE(1)
311   MDRV_QUANTUM_TIME(HZ(60))
312312
313313   MDRV_MACHINE_START(sms)
314314   MDRV_MACHINE_RESET(sms)
r3957r3958
353353   MDRV_CPU_PROGRAM_MAP(sms_mem, 0)
354354   MDRV_CPU_IO_MAP(sms_io, 0)
355355
356   MDRV_INTERLEAVE(1)
356   MDRV_QUANTUM_TIME(HZ(60))
357357
358358   MDRV_MACHINE_START(sms)
359359   MDRV_MACHINE_RESET(sms)
r3957r3958
400400   MDRV_CPU_PROGRAM_MAP(sms_mem, 0)
401401   MDRV_CPU_IO_MAP(gg_io, 0)
402402
403   MDRV_INTERLEAVE(1)
403   MDRV_QUANTUM_TIME(HZ(60))
404404
405405   MDRV_MACHINE_START(sms)
406406   MDRV_MACHINE_RESET(sms)
src/mess/drivers/avigo.c
r3957r3958
860860   MDRV_CPU_ADD("main", Z80, 4000000)
861861   MDRV_CPU_PROGRAM_MAP(avigo_mem, 0)
862862   MDRV_CPU_IO_MAP(avigo_io, 0)
863   MDRV_INTERLEAVE(1)
863   MDRV_QUANTUM_TIME(HZ(60))
864864
865865   MDRV_MACHINE_START( avigo )
866866   MDRV_MACHINE_RESET( avigo )
src/mess/drivers/psx.c
r3957r3958
309309   /* todo */
310310}
311311
312static void psx_sio0( int n_data )
312static void psx_sio0( running_machine *machine, int n_data )
313313{
314314   /* todo: raise data & ack when nothing is driving it low */
315   psx_pad( Machine, 0, n_data );
315   psx_pad( machine, 0, n_data );
316316   psx_mcd( 0, n_data );
317   psx_pad( Machine, 1, n_data ^ PSX_SIO_OUT_DTR );
317   psx_pad( machine, 1, n_data ^ PSX_SIO_OUT_DTR );
318318   psx_mcd( 1, n_data ^ PSX_SIO_OUT_DTR );
319319}
320320
src/mess/drivers/samcoupe.c
r3957r3958
536536
537537   /* devices */
538538   MDRV_DRIVER_DATA(coupe_asic)
539   MDRV_DEVICE_ADD("sambus_clock", MSM6242)
539   MDRV_MSM6242_ADD("sambus_clock")
540540
541541   /* sound hardware */
542542   MDRV_SPEAKER_STANDARD_MONO("mono")
src/mess/drivers/tutor.c
r3957r3958
138138   TMS9928A_interrupt(device->machine);
139139}
140140
141static const device_config *printer_fp(void)
141static const device_config *printer_fp(running_machine *machine)
142142{
143   return image_from_devtype_and_index(IO_PARALLEL, 0);
143   return image_from_devtype_and_index(machine, IO_PARALLEL, 0);
144144}
145145
146146
r3957r3958
331331   {
332332   case 0x20:
333333      /* busy */
334      reply = printer_fp() ? 0xff : 0x00;
334      reply = printer_fp(space->machine) ? 0xff : 0x00;
335335      break;
336336
337337   default:
r3957r3958
358358      if (data && ! printer_strobe)
359359      {
360360         /* strobe is asserted: output data */
361         if (printer_fp())
362            image_fwrite(printer_fp(), & printer_data, 1);
361         if (printer_fp(space->machine))
362            image_fwrite(printer_fp(space->machine), & printer_data, 1);
363363      }
364364      printer_strobe = data != 0;
365365      break;
src/mess/drivers/trs80.c
r3957r3958
385385   MDRV_CPU_IO_MAP(io_level1, 0)
386386   MDRV_CPU_VBLANK_INT("main", trs80_frame_interrupt)
387387   MDRV_CPU_PERIODIC_INT(trs80_timer_interrupt, 40)
388   MDRV_INTERLEAVE(1)
388   MDRV_QUANTUM_TIME(HZ(60))
389389
390390   MDRV_MACHINE_RESET( trs80 )
391391
src/mess/drivers/odyssey2.c
r3957r3958
170170   MDRV_CPU_ADD("main", I8048, ( ( XTAL_7_15909MHz * 3 ) / 4 ) )
171171   MDRV_CPU_PROGRAM_MAP(odyssey2_mem, 0)
172172   MDRV_CPU_IO_MAP(odyssey2_io, 0)
173   MDRV_INTERLEAVE(1)
173   MDRV_QUANTUM_TIME(HZ(60))
174174
175175   MDRV_MACHINE_RESET( odyssey2 )
176176
r3957r3958
203203   MDRV_CPU_ADD("main", I8048, ( XTAL_17_73447MHz / 3 ) )
204204   MDRV_CPU_PROGRAM_MAP(odyssey2_mem, 0)
205205   MDRV_CPU_IO_MAP(odyssey2_io, 0)
206   MDRV_INTERLEAVE(1)
206   MDRV_QUANTUM_TIME(HZ(60))
207207
208208   MDRV_MACHINE_RESET( odyssey2 )
209209
r3957r3958
235235   MDRV_CPU_ADD("main", I8048, 5911000 )
236236   MDRV_CPU_PROGRAM_MAP(odyssey2_mem, 0)
237237   MDRV_CPU_IO_MAP(g7400_io, 0)
238   MDRV_INTERLEAVE(1)
238   MDRV_QUANTUM_TIME(HZ(60))
239239
240240   MDRV_MACHINE_RESET( odyssey2 )
241241
src/mess/drivers/apple2.c
r3957r3958
563563   MDRV_CPU_ADD("main", M6502, 1021800)      /* close to actual CPU frequency of 1.020484 MHz */
564564   MDRV_CPU_PROGRAM_MAP(apple2_map, 0)
565565   MDRV_CPU_VBLANK_INT_HACK(apple2_interrupt, 192/8)
566   MDRV_INTERLEAVE(1)
566   MDRV_QUANTUM_TIME(HZ(60))
567567
568568   MDRV_MACHINE_START( apple2 )
569569
src/mess/drivers/ti85.c
r3957r3958
335335   MDRV_SCREEN_ADD("main", LCD)
336336   MDRV_SCREEN_REFRESH_RATE(50)
337337   MDRV_SCREEN_VBLANK_TIME(0)
338   MDRV_INTERLEAVE(1)
338   MDRV_QUANTUM_TIME(HZ(60))
339339
340340   MDRV_MACHINE_START( ti81 )
341341
src/mess/drivers/c64.c
r3957r3958
480480   MDRV_CPU_PROGRAM_MAP(c64_mem, 0)
481481   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
482482   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC6567_HRETRACERATE)
483   MDRV_INTERLEAVE(1)
483   MDRV_QUANTUM_TIME(HZ(60))
484484
485485   MDRV_MACHINE_START( c64 )
486486
r3957r3958
505505   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
506506
507507   /* cia */
508   MDRV_DEVICE_ADD("cia_0", CIA6526R1)
509   MDRV_DEVICE_CONFIG(c64_ntsc_cia0)
510   MDRV_DEVICE_ADD("cia_1", CIA6526R1)
511   MDRV_DEVICE_CONFIG(c64_ntsc_cia1)
508   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 0, c64_ntsc_cia0)
509   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 0, c64_ntsc_cia1)
512510
513511   /* via */
514512   MDRV_VIA6522_ADD("via6522_2", 0, vc1541_via2)
r3957r3958
520518   MDRV_CPU_PROGRAM_MAP(c64_mem, 0)
521519   MDRV_CPU_VBLANK_INT("main", c64_frame_interrupt)
522520   MDRV_CPU_PERIODIC_INT(vic2_raster_irq, VIC6569_HRETRACERATE)
523   MDRV_INTERLEAVE(1)
521   MDRV_QUANTUM_TIME(HZ(60))
524522
525523   MDRV_MACHINE_START( c64 )
526524
r3957r3958
545543   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
546544
547545   /* cia */
548   MDRV_DEVICE_ADD("cia_0", CIA6526R1)
549   MDRV_DEVICE_CONFIG(c64_pal_cia0)
550   MDRV_DEVICE_ADD("cia_1", CIA6526R1)
551   MDRV_DEVICE_CONFIG(c64_pal_cia1)
546   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 0, c64_pal_cia0)
547   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 0, c64_pal_cia1)
552548MACHINE_DRIVER_END
553549
554550static MACHINE_DRIVER_START( ultimax )
r3957r3958
581577   MDRV_SOUND_REMOVE( "dac" )
582578   MDRV_CASSETTE_REMOVE( "cassette" )
583579#ifdef CPU_SYNC
584   MDRV_INTERLEAVE(1)
580   MDRV_QUANTUM_TIME(HZ(60))
585581#else
586   MDRV_INTERLEAVE(3000)
582   MDRV_QUANTUM_TIME(HZ(180000))
587583#endif
588584   MDRV_VIA6522_ADD("via6522_2", 0, vc1541_via2)
589585   MDRV_VIA6522_ADD("via6522_3", 0, vc1541_via3)
src/mess/drivers/svi318.c
r3957r3958
275275   MDRV_CPU_PROGRAM_MAP( svi318_mem, 0 )
276276   MDRV_CPU_IO_MAP( svi318_io, 0 )
277277   MDRV_CPU_VBLANK_INT("main", svi318_interrupt)
278   MDRV_INTERLEAVE(1)
278   MDRV_QUANTUM_TIME(HZ(60))
279279
280280   MDRV_MACHINE_START( svi318_pal )
281281   MDRV_MACHINE_RESET( svi318 )
r3957r3958
322322static const mc6845_interface svi806_crtc6845_interface =
323323{
324324   "svi806",
325   XTAL_12MHz / 8,
326325   8 /*?*/,
327326   NULL,
328327   svi806_crtc6845_update_row,
r3957r3958
338337   MDRV_CPU_PROGRAM_MAP( svi328_806_mem, 0 )
339338   MDRV_CPU_IO_MAP( svi328_806_io, 0 )
340339   MDRV_CPU_VBLANK_INT("main", svi318_interrupt)
341   MDRV_INTERLEAVE(1)
340   MDRV_QUANTUM_TIME(HZ(60))
342341
343342   MDRV_MACHINE_START( svi318_pal )
344343   MDRV_MACHINE_RESET( svi328_806 )
r3957r3958
364363   MDRV_SCREEN_SIZE(640, 400)
365364   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
366365
367   MDRV_DEVICE_ADD("crtc", MC6845)
368   MDRV_DEVICE_CONFIG( svi806_crtc6845_interface )
366   MDRV_MC6845_ADD("crtc", MC6845, XTAL_12MHz / 8, svi806_crtc6845_interface)
369367
370368   MDRV_VIDEO_START( svi328_806 )
371369   MDRV_VIDEO_UPDATE( svi328_806 )
src/mess/drivers/pc.c
r3957r3958
103103
104104
105105#include "driver.h"
106//#include "cpu/nec/nec.h"
107//#include "cpu/i86/i86.h"
106#include "cpu/nec/nec.h"
107#include "cpu/i86/i86.h"
108108#include "deprecat.h"
109109
110110#include "machine/8255ppi.h"
r3957r3958
13311331   MDRV_CPU_IO_MAP(pc8_io, 0)
13321332   MDRV_CPU_VBLANK_INT_HACK(pc_frame_interrupt, 4)
13331333
1334   MDRV_INTERLEAVE(1)
1334   MDRV_QUANTUM_TIME(HZ(60))
13351335
13361336   MDRV_MACHINE_START(pc)
13371337   MDRV_MACHINE_RESET(pc)
r3957r3958
14591459   MDRV_CPU_IO_MAP(pc8_io, 0)
14601460   MDRV_CPU_CONFIG(i86_address_mask)
14611461
1462   MDRV_INTERLEAVE(1)
1462   MDRV_QUANTUM_TIME(HZ(60))
14631463
14641464   MDRV_MACHINE_START(pc)
14651465   MDRV_MACHINE_RESET(pc)
r3957r3958
15191519   /* basic machine hardware */
15201520   MDRV_CPU_PC(pc8, pc8, I8088, 4772720, pc_frame_interrupt)   /* 4,77 MHz */
15211521
1522   MDRV_INTERLEAVE(1)
1522   MDRV_QUANTUM_TIME(HZ(60))
15231523
15241524   MDRV_MACHINE_START(pc)
15251525   MDRV_MACHINE_RESET(pc)
src/mess/drivers/pce.c
r3957r3958
146146   MDRV_CPU_PROGRAM_MAP(pce_mem, 0)
147147   MDRV_CPU_IO_MAP(pce_io, 0)
148148   MDRV_CPU_VBLANK_INT_HACK(pce_interrupt, VDC_LPF)
149   MDRV_INTERLEAVE(1)
149   MDRV_QUANTUM_TIME(HZ(60))
150150
151151   MDRV_MACHINE_RESET( pce )
152152
r3957r3958
187187   MDRV_CPU_PROGRAM_MAP(sgx_mem, 0)
188188   MDRV_CPU_IO_MAP(sgx_io, 0)
189189   MDRV_CPU_VBLANK_INT_HACK(sgx_interrupt, VDC_LPF)
190   MDRV_INTERLEAVE(1)
190   MDRV_QUANTUM_TIME(HZ(60))
191191
192192   MDRV_MACHINE_RESET( pce )
193193
src/mess/drivers/vc4000.c
r3957r3958
193193   MDRV_CPU_PROGRAM_MAP(vc4000_mem, 0)
194194   MDRV_CPU_IO_MAP(vc4000_io, 0)
195195   MDRV_CPU_PERIODIC_INT(vc4000_video_line, 312*50)
196   MDRV_INTERLEAVE(1)
196   MDRV_QUANTUM_TIME(HZ(60))
197197
198198   /* video hardware */
199199   MDRV_SCREEN_ADD("main", RASTER)
src/mess/drivers/bbc.c
r3957r3958
727727   MDRV_SCREEN_ADD("main", RASTER)
728728   MDRV_SCREEN_REFRESH_RATE(50)
729729   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(128))
730   MDRV_INTERLEAVE(1)
730   MDRV_QUANTUM_TIME(HZ(60))
731731
732732   MDRV_MACHINE_START( bbca )
733733   MDRV_MACHINE_RESET( bbca )
r3957r3958
752752   MDRV_CASSETTE_ADD( "cassette", bbc_cassette_config )
753753
754754   /* acia */
755   MDRV_DEVICE_ADD("acia6850", ACIA6850)
756   MDRV_DEVICE_CONFIG(bbc_acia6850_interface)
755   MDRV_ACIA6850_ADD("acia6850", bbc_acia6850_interface)
757756   
758757   /* devices */
759758   MDRV_UPD7002_ADD("upd7002",BBC_uPD7002)
r3957r3958
806805   MDRV_CPU_PROGRAM_MAP( bbcm_mem, 0 )
807806   MDRV_CPU_VBLANK_INT("main", bbcb_vsync)            /* screen refresh interrupts */
808807   MDRV_CPU_PERIODIC_INT(bbcm_keyscan, 1000)      /* scan keyboard */
809   MDRV_INTERLEAVE(1)
808   MDRV_QUANTUM_TIME(HZ(60))
810809
811810   MDRV_MACHINE_START( bbcm )
812811   MDRV_MACHINE_RESET( bbcm )
r3957r3958
838837   MDRV_CASSETTE_ADD( "cassette", bbc_cassette_config )
839838
840839   /* acia */
841   MDRV_DEVICE_ADD("acia6850", ACIA6850)
842   MDRV_DEVICE_CONFIG(bbc_acia6850_interface)
840   MDRV_ACIA6850_ADD("acia6850", bbc_acia6850_interface)
843841   
844842   /* devices */
845843   MDRV_UPD7002_ADD("upd7002",BBC_uPD7002)
src/mess/drivers/compis.c
r3957r3958
3232 ******************************************************************************/
3333
3434#include "driver.h"
35//#include "cpu/i86/i86.h"
35#include "cpu/i86/i86.h"
3636#include "machine/8255ppi.h"
3737#include "includes/compis.h"
3838#include "video/i82720.h"
r3957r3958
240240   MDRV_CPU_VBLANK_INT("main", compis_vblank_int)
241241   MDRV_CPU_CONFIG(i86_address_mask)
242242
243   MDRV_INTERLEAVE(1)
243   MDRV_QUANTUM_TIME(HZ(60))
244244
245245   MDRV_MACHINE_RESET(compis)
246246
src/mess/drivers/bbcbc.c
r3957r3958
4949/* TODO */
5050static const z80pio_interface bbcbc_z80pio_intf =
5151{
52   "main",
53   0,
5452   NULL,   /* int callback */
5553   NULL,   /* port a read */
5654   NULL,   /* port b read */
src/mess/drivers/vtech2.c
r3957r3958
415415   MDRV_SCREEN_ADD("main", RASTER)
416416   MDRV_SCREEN_REFRESH_RATE(50)
417417   MDRV_SCREEN_VBLANK_TIME(0)
418   MDRV_INTERLEAVE(1)
418   MDRV_QUANTUM_TIME(HZ(60))
419419
420420   MDRV_MACHINE_RESET( laser350 )
421421
src/mess/drivers/kc.c
r3957r3958
318318
319319static const z80ctc_interface kc85_disc_ctc_intf =
320320{
321   "main",         /* cpu */
322   0,            /* timer clock */
323321   0,            /* timer disablers */
324322   NULL,         /* interrupt callback */
325323   NULL,         /* ZC/TO0 callback */
r3957r3958
347345   MDRV_CPU_PROGRAM_MAP(kc85_disc_hw_mem, 0)
348346   MDRV_CPU_IO_MAP(kc85_disc_hw_io, 0)
349347
350   MDRV_Z80CTC_ADD( "z80ctc_1", kc85_disc_ctc_intf )
348   MDRV_Z80CTC_ADD( "z80ctc_1", 0, kc85_disc_ctc_intf )
351349   
352350   MDRV_NEC765A_ADD("nec765", kc_fdc_interface)
353351MACHINE_DRIVER_END
r3957r3958
360358   MDRV_CPU_PROGRAM_MAP(kc85_3_mem, 0)
361359   MDRV_CPU_IO_MAP(kc85_3_io, 0)
362360   MDRV_CPU_CONFIG(kc85_daisy_chain)
363   MDRV_INTERLEAVE(1)
361   MDRV_QUANTUM_TIME(HZ(60))
364362
365363   MDRV_MACHINE_RESET( kc85_3 )
366364
367365   MDRV_Z80PIO_ADD( "z80pio", kc85_pio_intf )
368   MDRV_Z80CTC_ADD( "z80ctc", kc85_ctc_intf )
366   MDRV_Z80CTC_ADD( "z80ctc", 1379310.344828, kc85_ctc_intf )
369367
370368   /* video hardware */
371369   MDRV_SCREEN_ADD("main", RASTER)
r3957r3958
410408static MACHINE_DRIVER_START( kc85_4d )
411409   MDRV_IMPORT_FROM( kc85_4 )
412410   MDRV_IMPORT_FROM( cpu_kc_disc )
413   MDRV_INTERLEAVE( 2 )
411   MDRV_QUANTUM_TIME(HZ(120))
414412   MDRV_MACHINE_RESET( kc85_4d )
415413MACHINE_DRIVER_END
416414
docs/messnew.txt
r3957r3958
7070
7171Source Changes:
7272----------------
73- The core is based on MAME 0.128u6.  This incorporates all features of the
73- The core is based on MAME 0.128u7.  This incorporates all features of the
7474  update to this core.  [MAME team]
7575
7676- Changed the 8251 UART implementation to be a device.  [Nathan Woods]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team